v1

latestOpenAPI 3.0.32026-08-06138294578.6 KB
Model Sync

Create Sync

Creates a new model sync.

Create a new sync from one or more models to a destination.

All of the functionality described in the product documentation is configurable via the API.

Guides:

  • Model sync (Reverse ETL) from Snowflake query to Salesforce
  • Joined model sync from Postgres, Airtable, and Stripe to Hubspot

Targets (Destinations)

Polytomic refers to a model sync's destination as the "target object", or target. Target objects are identified by a connection ID and an object ID. You can retrieve a list of all target objects for a connection using the Get Target Objects endpoint.

The target object in the request specifies information about the sync destination.

"target": {
    "connection_id": "248df4b7-aa70-47b8-a036-33ac447e668d",
    "object": "Users",
},

Some connections support additional configuration for targets. For example, Salesforce connections support optionally specifying the ingestion API to use. The target specific options are passed as configuration; consult the integration guides for details about specific connection configurations.

Creating a new target

Some integrations support creating a new target when creating a model sync. For example, an ad audience or database table.

When creating a new target, object is omitted and create is specified instead. The create property is an object containing integration specific configuration for the new target.

"target": {
    "connection_id": "248df4b7-aa70-47b8-a036-33ac447e668d",
    "create": {
        "name": "New audience",
        "type": "user_audience"
    }
},

The Get Target List endpoint returns information about whether a connection supports target creation.

post/api/syncs

Headers

X-Polytomic-Versionstring

Request body

activeboolean

Whether the sync is enabled and scheduled.

encryption_passphrasestring

Passphrase for encrypting the sync data.

filter_logicstring

Logical expression to combine filters.

mode'create' | 'update' | 'updateOrCreate' | 'replace' | 'append' | 'remove' | 'snapshot' required
namestring required
only_enrich_updatesboolean

Whether to use enrichment models as a source of possible changes to sync. If true, only changes to the base models will cause a record to sync.

organization_idstring uuid nullable

Organization ID for the sync; read-only with a partner key.

policiesstring[] nullable
skip_initial_backfillboolean

Whether to skip the initial backfill of records; if true only records seen after the sync is enabled will be synced.

sync_all_recordsboolean

Whether to sync all records from the source, regardless of whether they've changed since the previous execution.

Example request

{
  "active": true,
  "fields": [
    {
      "override_value": "fixed_value",
      "source": {
        "field": "id",
        "model_id": "248df4b7-aa70-47b8-a036-33ac447e668d"
      },
      "sync_mode": "create",
      "target": "name"
    }
  ],
  "filter_logic": "A and B or C",
  "filters": [
    {
      "field": {
        "field": "id",
        "model_id": "248df4b7-aa70-47b8-a036-33ac447e668d"
      },
      "field_id": "field1",
      "label": "A",
      "value": "value"
    }
  ],
  "identity": {
    "remote_field_type_id": "string",
    "source": {
      "field": "id",
      "model_id": "248df4b7-aa70-47b8-a036-33ac447e668d"
    },
    "target": "name"
  },
  "name": "Users Sync",
  "organization_id": "248df4b7-aa70-47b8-a036-33ac447e668d",
  "override_fields": [
    {
      "override_value": "fixed_value",
      "source": {
        "field": "id",
        "model_id": "248df4b7-aa70-47b8-a036-33ac447e668d"
      },
      "sync_mode": "create",
      "target": "name"
    }
  ],
  "overrides": [
    {
      "field": {
        "field": "id",
        "model_id": "248df4b7-aa70-47b8-a036-33ac447e668d"
      },
      "field_id": "field1",
      "override": "new_value",
      "value": "value"
    }
  ],
  "policies": [
    "248df4b7-aa70-47b8-a036-33ac447e668d"
  ],
  "schedule": {
    "connection_id": "248df4b7-aa70-47b8-a036-33ac447e668d",
    "day_of_month": "1",
    "day_of_week": "monday",
    "hour": "12",
    "minute": "30",
    "month": "1",
    "run_after": {
      "bulk_sync_ids": [
        "248df4b7-aa70-47b8-a036-33ac447e668d"
      ],
      "sync_ids": [
        "248df4b7-aa70-47b8-a036-33ac447e668d"
      ]
    }
  },
  "target": {
    "configuration": {
      "key": "value"
    },
    "connection_id": "248df4b7-aa70-47b8-a036-33ac447e668d",
    "create": {
      "name": "value"
    },
    "object": "Users",
    "search_values": {
      "name": "value"
    }
  }
}

Response

OK

Example response

{
  "data": {
    "active": true,
    "created_by": {
      "id": "12345678-1234-1234-1234-123456789012",
      "name": "John Doe",
      "type": "user"
    },
    "fields": [
      {
        "override_value": "fixed_value",
        "source": {
          "field": "id",
          "model_id": "248df4b7-aa70-47b8-a036-33ac447e668d"
        },
        "sync_mode": "create",
        "target": "name"
      }
    ],
    "filters": [
      {
        "field": {
          "field": "id",
          "model_id": "248df4b7-aa70-47b8-a036-33ac447e668d"
        },
        "field_id": "field1",
        "label": "A",
        "value": "value"
      }
    ],
    "id": "248df4b7-aa70-47b8-a036-33ac447e668d",
    "identity": {
      "remote_field_type_id": "string",
      "source": {
        "field": "id",
        "model_id": "248df4b7-aa70-47b8-a036-33ac447e668d"
      },
      "target": "name"
    },
    "name": "Users Sync",
    "organization_id": "248df4b7-aa70-47b8-a036-33ac447e668d",
    "override_fields": [
      {
        "override_value": "fixed_value",
        "sync_mode": "create",
        "target": "name"
      }
    ],
    "overrides": [
      {
        "field": {
          "field": "id",
          "model_id": "248df4b7-aa70-47b8-a036-33ac447e668d"
        },
        "field_id": "field1",
        "override": "new_value",
        "value": "value"
      }
    ],
    "policies": [
      "248df4b7-aa70-47b8-a036-33ac447e668d"
    ],
    "schedule": {
      "connection_id": "248df4b7-aa70-47b8-a036-33ac447e668d",
      "day_of_month": "1",
      "day_of_week": "monday",
      "hour": "12",
      "minute": "30",
      "month": "1",
      "run_after": {
        "bulk_sync_ids": [
          "248df4b7-aa70-47b8-a036-33ac447e668d"
        ],
        "sync_ids": [
          "248df4b7-aa70-47b8-a036-33ac447e668d"
        ]
      }
    },
    "target": {
      "configuration": {
        "key": "value"
      },
      "connection_id": "248df4b7-aa70-47b8-a036-33ac447e668d",
      "create": {
        "name": "value"
      },
      "object": "Users",
      "search_values": {
        "name": "value"
      }
    },
    "updated_by": {
      "id": "12345678-1234-1234-1234-123456789012",
      "name": "John Doe",
      "type": "user"
    }
  }
}