PermuteDocs
Go to Permute

Write syncs · writeSyncsUpdate

Update a write sync

Replaces a paused definition using expectedVersion from the latest read. Invalidates previous previews. Source, destination, stable key, matching field, and managed fields become fixed once execution has been requested.

PUT/v1/write-syncs/{writeSyncId}
betaapiKeyworkspace

When to use

Replace the complete definition of a paused sync.

For agents

Read the latest numeric version and pass expectedVersion. Saving creates a definition revision and invalidates previous previews; review a new preview before publishing through revisions.publish with its runId and the version token from revisions.list.

Example

typescript
import { PermuteClient } from '@permute/sdk';

const orgClient = new PermuteClient({
  apiKey: process.env.PERMUTE_API_KEY!,
});

const client = orgClient.withWorkspace(process.env.PERMUTE_WORKSPACE_ID!);

const result = await client.writeSyncs.update('wsyn_contacts123', {
  "definition": {
    "source": {
      "resourceId": "oper_contacts123",
      "object": "contacts",
      "scope": ""
    },
    "destination": {
      "resourceId": "conn_quo123",
      "object": "contacts",
      "scope": ""
    },
    "input": {
      "type": "operation",
      "operationId": "oper_contacts123",
      "revisionId": "rvsn_contacts123",
      "table": "contacts"
    },
    "keyColumn": "email",
    "fields": {
      "emails": "email",
      "firstName": "first_name",
      "lastName": "last_name"
    }
  },
  "expectedVersion": 1
});

Request body

json
{
  "definition": {
    "source": {
      "resourceId": "oper_contacts123",
      "object": "contacts",
      "scope": ""
    },
    "destination": {
      "resourceId": "conn_quo123",
      "object": "contacts",
      "scope": ""
    },
    "input": {
      "type": "operation",
      "operationId": "oper_contacts123",
      "revisionId": "rvsn_contacts123",
      "table": "contacts"
    },
    "keyColumn": "email",
    "fields": {
      "emails": "email",
      "firstName": "first_name",
      "lastName": "last_name"
    }
  },
  "expectedVersion": 1
}

Response

json
{
  "data": {
    "id": "wsyn_contacts123",
    "name": "Contacts → Quo contacts",
    "definition": {
      "source": {
        "resourceId": "oper_contacts123",
        "object": "contacts",
        "scope": ""
      },
      "destination": {
        "resourceId": "conn_quo123",
        "object": "contacts",
        "scope": ""
      },
      "input": {
        "type": "operation",
        "operationId": "oper_contacts123",
        "revisionId": "rvsn_contacts123",
        "table": "contacts"
      },
      "keyColumn": "email",
      "fields": {
        "emails": "email",
        "firstName": "first_name",
        "lastName": "last_name"
      }
    },
    "version": 2,
    "isEnabled": false,
    "createdAt": "2026-09-30T12:00:00.000Z",
    "updatedAt": "2026-09-30T12:00:00.000Z"
  }
}