---
title: "CDC Sink: Update Task"
description: "How to update an existing CDC Sink task using the RavenDB Client API (UpdateCdcSinkOperation) and through the Management Studio."
url: "https://docs.ravendb.net/7.2/server/ongoing-tasks/cdc-sink/manage-cdc-sink-tasks/update-task"
version: "7.2"
language: "csharp"
---

# CDC Sink: Update Task

> Client language: C#.
>
> RavenDB publishes an official agent skill for coding assistants at https://docs.ravendb.net/skills/ravendb/SKILL.md (also installable with `npx skills add ravendb/skills`). The skill describes itself as: "Read this before writing any RavenDB query, client call or /databases/ request. Covers server setup, document modelling, the Node.js, .NET and Python clients, RQL, indexes, vector search and AI agents. Code written from recall tends to run and return the wrong rows, because RQL resembles SQL and the clients take field names as plain strings."

> **Note**
>
> - Update an existing CDC Sink task to change its column mappings, add or remove tables, adjust patch scripts,  
>   or modify other configuration settings.
>
> - This article shows how to **update** a CDC Sink task using the Client API, Studio, or the REST API.
>
> - In this article:
>   - [Update a CDC Sink task via Client API](#update-a-cdc-sink-task-via-client-api)
>   - [Update a CDC Sink task via Studio](#update-a-cdc-sink-task-via-studio)
>   - [Update a CDC Sink task via REST API](#update-a-cdc-sink-task-via-rest-api)

## Update a CDC Sink task via Client API {#update-a-cdc-sink-task-via-client-api}

Use `UpdateCdcSinkOperation` to modify an existing task.

Start from the existing task configuration, apply your changes, and send the complete updated `CdcSinkConfiguration`.

The update operation replaces the saved task configuration, so include any unchanged settings you want to keep.  
The task to update is selected by the `taskId` passed to `UpdateCdcSinkOperation`.

### Sync

```csharp
// config contains the existing task configuration with the changes applied.

config.Tables.Add(new CdcSinkTableConfig
{
    CollectionName = "Customers",
    SourceTableName = "customers",
    PrimaryKeyColumns = new List<string> { "id" },
    Columns =
    [
        new CdcColumnMapping() { Column = "id",    Name = "Id" },
        new CdcColumnMapping() { Column = "name",  Name = "Name" },
        new CdcColumnMapping() { Column = "email", Name = "Email" },
    ]
});

// Execute the operation by passing it to Maintenance.Send      
store.Maintenance.Send(new UpdateCdcSinkOperation(taskId, config));
```

### Async

```csharp
// config contains the existing task configuration with the changes applied.

config.Tables.Add(new CdcSinkTableConfig
{
    CollectionName = "Customers",
    SourceTableName = "customers",
    PrimaryKeyColumns = new List<string> { "id" },
    Columns =
    [
        new CdcColumnMapping() { Column = "id",    Name = "Id" },
        new CdcColumnMapping() { Column = "name",  Name = "Name" },
        new CdcColumnMapping() { Column = "email", Name = "Email" },
    ]
});

// Execute the operation by passing it to Maintenance.SendAsync     
await store.Maintenance.SendAsync(new UpdateCdcSinkOperation(taskId, config));
```

---

> **Note**
>
> For PostgreSQL tasks, adding or removing tables can require updating the PostgreSQL publication.  
> See [PostgreSQL - Cleanup and Maintenance](https://docs.ravendb.net/7.2/server/ongoing-tasks/cdc-sink/source-database-setup/postgres/cleanup-and-maintenance.md) for details.

## Update a CDC Sink task via Studio {#update-a-cdc-sink-task-via-studio}

To edit a CDC Sink task in the Studio:

![Created CDC Sink task](https://docs.ravendb.net/assets/images/create-task-12-030cf32f970be0224a780c683c4de9f3.png)

1. Navigate to **Databases** → your database → **Tasks** → **Ongoing Tasks**.
2. Under the **SINK (SOURCE ⇒ RavenDB)** group,  
   click the task's name (or the edit icon) to open the same configuration form used for creation, now in edit mode.
3. Modify the connection string, tables, column mappings, or patches as needed.
4. Optionally, click **Verify tables** to check the updated configuration against the source database.  
   Verification does not stop or disconnect the running task.  
   See [Verify tables](https://docs.ravendb.net/7.2/server/ongoing-tasks/cdc-sink/manage-cdc-sink-tasks/create-task.md#verify-tables).
5. Click **Save task configuration**.  
   If you changed the connection string selection, the PostgreSQL publication or slot name, or the table configuration,  
   Studio verifies the updated configuration before saving, unless a verification result is already available for it.  
   Changes to other settings, such as the task name, task state, or responsible node, do not trigger a new verification.  
   If the current verification result includes warnings or an error, click **Save anyway** to save the changes,
   see [Save the task configuration](https://docs.ravendb.net/7.2/server/ongoing-tasks/cdc-sink/manage-cdc-sink-tasks/create-task.md#save-the-task-configuration).

## Update a CDC Sink task via REST API {#update-a-cdc-sink-task-via-rest-api}

To update a CDC Sink task through REST, send a `PUT` request to the same endpoint used to create a task,  
with the task ID in the `id` query string parameter.

The request body must contain the complete updated JSON `CdcSinkConfiguration`.  
If `id` is omitted, the same endpoint creates a new CDC Sink task.

| Method | Endpoint | Auth |
| - | - | - |
| `PUT` | `/databases/{databaseName}/admin/cdc-sink?id={taskId}` | `DatabaseAdmin` |

To verify the updated configuration against the source database before sending it,
see [Verify the configuration](https://docs.ravendb.net/7.2/server/ongoing-tasks/cdc-sink/manage-cdc-sink-tasks/create-task.md#verify-the-configuration).

## See also

- [Create a Task](https://docs.ravendb.net/7.2/server/ongoing-tasks/cdc-sink/manage-cdc-sink-tasks/create-task.md)
- [Configuration Reference](https://docs.ravendb.net/7.2/server/ongoing-tasks/cdc-sink/manage-cdc-sink-tasks/configuration-reference.md)
- [Source Schema Changes](https://docs.ravendb.net/7.2/server/ongoing-tasks/cdc-sink/source-schema-changes.md)
