Syncs API

Syncs define how data moves from a model to a destination. Each sync specifies the source model, target destination, field mappings, sync mode, and schedule.

Endpoints

MethodPathDescription
GET/api/v1/workspaces/{id}/syncsList all syncs
POST/api/v1/workspaces/{id}/syncsCreate a sync
GET/api/v1/workspaces/{id}/syncs/{syncId}Get a sync
PUT/api/v1/workspaces/{id}/syncs/{syncId}Update a sync
DELETE/api/v1/workspaces/{id}/syncs/{syncId}Delete a sync
POST/api/v1/workspaces/{id}/syncs/{syncId}/triggerTrigger a sync run
GET/api/v1/workspaces/{id}/syncs/{syncId}/runsList sync runs
GET/api/v1/workspaces/{id}/syncs/{syncId}/runs/{runId}Get a sync run

List Syncs

GET /api/v1/workspaces/{id}/syncs

Returns all syncs in the workspace.

Response

[
  {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "workspace_id": "660e8400-e29b-41d4-a716-446655440000",
    "model_id": "770e8400-e29b-41d4-a716-446655440000",
    "destination_id": "880e8400-e29b-41d4-a716-446655440000",
    "name": "Customers to Salesforce",
    "description": "Sync active customers to Salesforce contacts",
    "field_mapping": [
      {"source_column": "email", "destination_field": "Email"},
      {"source_column": "first_name", "destination_field": "FirstName"},
      {"source_column": "last_name", "destination_field": "LastName"}
    ],
    "sync_mode": "upsert",
    "schedule": "0 */6 * * *",
    "config": {},
    "primary_key": "customer_id",
    "status": "active",
    "status_error": "",
    "created_by": "990e8400-e29b-41d4-a716-446655440000",
    "created_at": "2024-01-15T09:30:00Z",
    "updated_at": "2024-01-15T09:30:00Z",
    "last_synced_at": "2024-01-15T15:00:00Z",
    "last_run_id": "aae8400-e29b-41d4-a716-446655440000"
  }
]

Example

curl -X GET https://your-instance.signalsmith.io/api/v1/workspaces/{id}/syncs \
  -H "Authorization: Bearer <token>" \
  -H "X-Workspace-ID: <workspace-id>"

Create Sync

POST /api/v1/workspaces/{id}/syncs

Creates a new sync between a model and a destination.

Request Body

FieldTypeRequiredDescription
namestringYesDisplay name
descriptionstringNoDescription
model_idstring (UUID)YesSource model ID
destination_idstring (UUID)YesTarget destination ID
field_mappingarrayYesColumn-to-field mappings
sync_modestringYesupsert, insert, update, or mirror
schedulestringNoCron expression for scheduling (e.g., 0 */6 * * *)
primary_keystringYesColumn used as the unique identifier for upsert/mirror
configobjectNoAdditional sync-specific configuration

Sync Modes

ModeDescription
upsertCreates new records and updates existing ones based on the primary key
insertOnly creates new records; ignores existing ones
updateOnly updates existing records; does not create new ones
mirrorFull sync: creates, updates, and deletes records to match the source exactly

Field Mapping

{
  "field_mapping": [
    {
      "source_column": "email",
      "destination_field": "Email"
    },
    {
      "source_column": "revenue",
      "destination_field": "Annual_Revenue",
      "type_cast": "number"
    }
  ]
}
FieldTypeRequiredDescription
source_columnstringYesColumn name from the model
destination_fieldstringYesField name in the destination
type_caststringNoType conversion to apply

Example

curl -X POST https://your-instance.signalsmith.io/api/v1/workspaces/{id}/syncs \
  -H "Authorization: Bearer <token>" \
  -H "X-Workspace-ID: <workspace-id>" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Customers to Salesforce",
    "model_id": "770e8400-e29b-41d4-a716-446655440000",
    "destination_id": "880e8400-e29b-41d4-a716-446655440000",
    "field_mapping": [
      {"source_column": "email", "destination_field": "Email"},
      {"source_column": "first_name", "destination_field": "FirstName"}
    ],
    "sync_mode": "upsert",
    "primary_key": "customer_id",
    "schedule": "0 */6 * * *"
  }'

Get Sync

GET /api/v1/workspaces/{id}/syncs/{syncId}

Returns a single sync by ID.

Example

curl -X GET https://your-instance.signalsmith.io/api/v1/workspaces/{id}/syncs/{syncId} \
  -H "Authorization: Bearer <token>" \
  -H "X-Workspace-ID: <workspace-id>"

Update Sync

PUT /api/v1/workspaces/{id}/syncs/{syncId}

Updates an existing sync configuration.

Request Body

Same fields as create. Only include fields you want to change.

Example

curl -X PUT https://your-instance.signalsmith.io/api/v1/workspaces/{id}/syncs/{syncId} \
  -H "Authorization: Bearer <token>" \
  -H "X-Workspace-ID: <workspace-id>" \
  -H "Content-Type: application/json" \
  -d '{
    "schedule": "0 */12 * * *",
    "status": "paused"
  }'

Delete Sync

DELETE /api/v1/workspaces/{id}/syncs/{syncId}

Deletes a sync.

Response

{
  "status": "deleted"
}

Trigger Sync Run

POST /api/v1/workspaces/{id}/syncs/{syncId}/trigger

Manually triggers a sync run outside of the configured schedule.

Response

Returns the created sync run object with status 201 Created.

{
  "id": "bbe8400-e29b-41d4-a716-446655440000",
  "sync_id": "550e8400-e29b-41d4-a716-446655440000",
  "workspace_id": "660e8400-e29b-41d4-a716-446655440000",
  "status": "pending",
  "started_at": "2024-01-15T15:00:00Z",
  "rows_synced": 0,
  "rows_failed": 0,
  "triggered_by": "990e8400-e29b-41d4-a716-446655440000",
  "created_at": "2024-01-15T15:00:00Z"
}

Example

curl -X POST https://your-instance.signalsmith.io/api/v1/workspaces/{id}/syncs/{syncId}/trigger \
  -H "Authorization: Bearer <token>" \
  -H "X-Workspace-ID: <workspace-id>"

List Sync Runs

GET /api/v1/workspaces/{id}/syncs/{syncId}/runs

Returns the execution history for a sync.

Response

[
  {
    "id": "bbe8400-e29b-41d4-a716-446655440000",
    "sync_id": "550e8400-e29b-41d4-a716-446655440000",
    "workspace_id": "660e8400-e29b-41d4-a716-446655440000",
    "status": "completed",
    "started_at": "2024-01-15T15:00:00Z",
    "completed_at": "2024-01-15T15:02:30Z",
    "rows_synced": 5420,
    "rows_failed": 3,
    "error_message": "",
    "triggered_by": "990e8400-e29b-41d4-a716-446655440000",
    "created_at": "2024-01-15T15:00:00Z"
  }
]

Sync Run Statuses

StatusDescription
pendingRun is queued
runningRun is in progress
completedRun finished successfully
failedRun failed with an error
cancelledRun was manually cancelled

Get Sync Run

GET /api/v1/workspaces/{id}/syncs/{syncId}/runs/{runId}

Returns details of a specific sync run.

Example

curl -X GET https://your-instance.signalsmith.io/api/v1/workspaces/{id}/syncs/{syncId}/runs/{runId} \
  -H "Authorization: Bearer <token>" \
  -H "X-Workspace-ID: <workspace-id>"

Sync Object

FieldTypeDescription
idstring (UUID)Unique identifier
workspace_idstring (UUID)Owning workspace
model_idstring (UUID)Source model
destination_idstring (UUID)Target destination
namestringDisplay name
descriptionstringDescription
field_mappingarrayColumn-to-field mappings
sync_modestringupsert, insert, update, or mirror
schedulestringCron expression
configobjectAdditional configuration
primary_keystringPrimary key column
statusstringdraft, active, paused, or error
status_errorstringError message when status is error
created_bystring (UUID)Account that created the sync
created_atstring (ISO 8601)Creation timestamp
updated_atstring (ISO 8601)Last update timestamp
last_synced_atstring (ISO 8601) or nullLast successful sync time
last_run_idstring (UUID) or nullID of the most recent run