Create Sync

Create a new sync from one or more models to a destination. All of the functionality described in [the product documentation](https://docs.polytomic.com/docs/sync-destinations) is configurable via the API. Guides: - [Model sync (Reverse ETL) from Snowflake query to Salesforce](https://apidocs.polytomic.com/2024-02-08/guides/code-examples/model-sync-reverse-etl-from-snowflake-query-to-salesforce) - [Joined model sync from Postgres, Airtable, and Stripe to Hubspot](https://apidocs.polytomic.com/2024-02-08/guides/code-examples/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](./targets/list) endpoint. The `target` object in the request specifies information about the sync destination. ```json "target": { "connection_id": "248df4b7-aa70-47b8-a036-33ac447e668d", "object": "Users", }, ``` Some connections support additional configuration for targets. For example, [Salesforce connections](https://apidocs.polytomic.com/2024-02-08/guides/configuring-your-connections/connections/salesforce#target) support optionally specifying the ingestion API to use. The target specific options are passed as `configuration`; consult the [integration guides](https://apidocs.polytomic.com/2024-02-08/guides/configuring-your-connections/overview) 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. ```json "target": { "connection_id": "248df4b7-aa70-47b8-a036-33ac447e668d", "create": { "name": "New audience", "type": "user_audience" } }, ``` The [Get Target List](./targets/list) endpoint returns information about whether a connection supports target creation.

Authentication

AuthorizationBearer

Bearer authentication of the form Bearer <token>, where token is your auth token.

Headers

X-Polytomic-VersionstringOptional

Request

This endpoint expects an object.
fieldslist of objectsRequired
Fields to sync from source to destination.
modeenumRequired
namestringRequired
scheduleobjectRequired
targetobjectRequired
activebooleanOptional
Whether the sync is enabled and scheduled.
encryption_passphrasestringOptional
Passphrase for encrypting the sync data.
filter_logicstringOptional
Logical expression to combine filters.
filterslist of objectsOptional
Filters to apply to the source data.
identityobjectOptional
only_enrich_updatesbooleanOptional
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_idstringOptionalformat: "uuid"

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

override_fieldslist of objectsOptional
Values to set in the target unconditionally.
overrideslist of objectsOptional
Conditional value replacement for fields.
policieslist of stringsOptional
skip_initial_backfillbooleanOptional

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

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

Response

OK
dataobject

Errors

400
Model Sync Create Request Bad Request Error
401
Model Sync Create Request Unauthorized Error
403
Model Sync Create Request Forbidden Error
422
Model Sync Create Request Unprocessable Entity Error
500
Model Sync Create Request Internal Server Error