For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Log inBook a demo
GuidesAPI Reference
GuidesAPI Reference
  • API Reference
      • GETGet Sync Source
      • GETModel Sync Field Query
      • GETList Syncs
      • POSTCreate Sync
      • GETGet Sync Schedule Options
      • GETGet Sync
      • PUTUpdate Sync
      • DELDelete Model Sync
      • POSTActivate Sync
      • POSTCancel Sync
      • POSTStart Sync
      • GETGet Sync Status
Logo
Log inBook a demo
API ReferenceModel Sync

Create Sync

POST
https://app.polytomic.com/api/syncs
POST
/api/syncs
$curl -X POST https://app.polytomic.com/api/syncs \
> -H "Authorization: Bearer <token>" \
> -H "Content-Type: application/json" \
> -d '{
> "fields": [
> {
> "target": "name"
> }
> ],
> "mode": "create",
> "name": "Users Sync",
> "schedule": {},
> "target": {
> "connection_id": "248df4b7-aa70-47b8-a036-33ac447e668d"
> }
>}'
1{
2 "data": {
3 "active": true,
4 "created_at": "2024-01-15T09:30:00Z",
5 "created_by": {
6 "id": "12345678-1234-1234-1234-123456789012",
7 "name": "John Doe",
8 "type": "user"
9 },
10 "encryption_passphrase": "string",
11 "fields": [
12 {
13 "target": "name",
14 "encryption_enabled": true,
15 "new": false,
16 "override_value": "fixed_value",
17 "source": {
18 "field": "id",
19 "model_id": "248df4b7-aa70-47b8-a036-33ac447e668d"
20 },
21 "sync_mode": "create"
22 }
23 ],
24 "filter_logic": "string",
25 "filters": [
26 {
27 "function": "Equality",
28 "field": {
29 "field": "id",
30 "model_id": "248df4b7-aa70-47b8-a036-33ac447e668d"
31 },
32 "field_id": "field1",
33 "field_type": "Model",
34 "label": "A",
35 "value": null
36 }
37 ],
38 "id": "248df4b7-aa70-47b8-a036-33ac447e668d",
39 "identity": {
40 "function": "Equality",
41 "source": {
42 "field": "id",
43 "model_id": "248df4b7-aa70-47b8-a036-33ac447e668d"
44 },
45 "target": "name",
46 "new_field": true,
47 "remote_field_type_id": "string"
48 },
49 "mode": "create",
50 "model_ids": [
51 "string"
52 ],
53 "name": "Users Sync",
54 "only_enrich_updates": false,
55 "organization_id": "248df4b7-aa70-47b8-a036-33ac447e668d",
56 "override_fields": [
57 {
58 "target": "name",
59 "encryption_enabled": true,
60 "new": false,
61 "override_value": "fixed_value",
62 "source": {
63 "field": "id",
64 "model_id": "248df4b7-aa70-47b8-a036-33ac447e668d"
65 },
66 "sync_mode": "create"
67 }
68 ],
69 "overrides": [
70 {
71 "field": {
72 "field": "id",
73 "model_id": "248df4b7-aa70-47b8-a036-33ac447e668d"
74 },
75 "field_id": "field1",
76 "function": "Equality",
77 "override": null,
78 "value": null
79 }
80 ],
81 "policies": [
82 "248df4b7-aa70-47b8-a036-33ac447e668d"
83 ],
84 "schedule": {
85 "connection_id": "248df4b7-aa70-47b8-a036-33ac447e668d",
86 "day_of_month": "1",
87 "day_of_week": "monday",
88 "frequency": "manual",
89 "hour": "12",
90 "job_id": 1,
91 "minute": "30",
92 "month": "1",
93 "run_after": {
94 "bulk_sync_ids": [
95 "248df4b7-aa70-47b8-a036-33ac447e668d"
96 ],
97 "sync_ids": [
98 "248df4b7-aa70-47b8-a036-33ac447e668d"
99 ]
100 },
101 "run_after_success_only": true
102 },
103 "skip_initial_backfill": false,
104 "sync_all_records": false,
105 "target": {
106 "connection_id": "248df4b7-aa70-47b8-a036-33ac447e668d",
107 "configuration": {
108 "key": "value"
109 },
110 "create": {
111 "name": "value"
112 },
113 "filter_logic": "string",
114 "object": "Users",
115 "new_name": "string",
116 "search_values": {
117 "name": "value"
118 }
119 },
120 "updated_at": "2024-01-15T09:30:00Z",
121 "updated_by": {
122 "id": "12345678-1234-1234-1234-123456789012",
123 "name": "John Doe",
124 "type": "user"
125 }
126 }
127}
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](https://docs.polytomic.com/docs/sync-destinations) is configurable via the API. Guides: - [Model sync (Reverse ETL) from Snowflake query to Salesforce](../../guides/code-examples/model-sync-reverse-etl-from-snowflake-query-to-salesforce) - [Joined model sync from Postgres, Airtable, and Stripe to Hubspot](../../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](../../api-reference/model-sync/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](../../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](../../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](../../api-reference/model-sync/targets/list) endpoint returns information about whether a connection supports target creation.
Was this page helpful?
Previous

Get Sync Schedule Options

Next

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.

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

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.

1"target": {
2 "connection_id": "248df4b7-aa70-47b8-a036-33ac447e668d",
3 "create": {
4 "name": "New audience",
5 "type": "user_audience"
6 }
7},

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

Authentication

AuthorizationBearer
Bearer user API key
OR
AuthorizationBasic

Basic organization-scoped API key

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 objects or nullOptional
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_idstring or nullOptionalformat: "uuid"

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

override_fieldslist of objects or nullOptional
Values to set in the target unconditionally.
overrideslist of objects or nullOptional
Conditional value replacement for fields.
policieslist of strings or nullOptional
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
Bad Request Error
403
Forbidden Error
422
Unprocessable Entity Error
500
Internal Server Error