> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://apidocs.polytomic.com/2023-04-25/api-reference/model-sync/update/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://apidocs.polytomic.com/_mcp/server. # Update Sync PATCH https://app.polytomic.com/api/syncs/{id} Content-Type: application/json Updates a model sync's configuration. Updating a model sync is a **full replacement** of the sync's configuration. Every field in the request body is written to the sync; any field you omit is cleared or reset to its default value. To make a partial change — for example, toggling `active` or adjusting a single field mapping — fetch the current sync with [`GET /api/syncs/{id}`](../../../api-reference/model-sync/get), modify the fields you want to change, and send the complete object back in the update request. Updates to `active`, `schedule`, and `policies` take effect immediately. Changes to source fields, target configuration, filters, or field mappings take effect on the sync's next execution. Reference: https://apidocs.polytomic.com/2023-04-25/api-reference/model-sync/update ## Authentication - `Authorization` header (basic auth, required) — This is the Polytomic deployment key (on-premises only) - `Authorization` header (bearer token, required) — This is the Polytomic API key ## Request ### Path parameters - `id` (string, required) ### Body (application/json) This endpoint expects a V2UpdateSyncRequest. - `fields` (list of V2SyncField, required) — Fields to sync from source to destination. - `mode` (enum, required) - Allowed values: `create`, `update`, `updateOrCreate`, `replace`, `append`, `remove`, `snapshot` - `name` (string, required) - `schedule` (Schedule, required) - `target` (V2Target, required) - `active` (boolean, optional) — Whether the sync is enabled and scheduled. - `encryption_passphrase` (string, optional) — Passphrase for encrypting the sync data. - `filter_logic` (string, optional) — Logical expression combining this sync's model filters -- the entries in 'filters' whose 'field_type' is 'Model' -- by their labels. The operators are not case-sensitive but the labels are, and the expression has to name every model filter at least once -- a filter may be repeated, as in '(A and B) or (A and C)' -- and an expression which leaves one out is rejected. Target filters are combined by 'target.filter_logic'. - `filters` (list of V2Filter, optional, nullable) — Filters on this sync. The array holds both filters on the records read from the source and filters on the records written to the destination; a filter's 'field_type' says which it is. - `identity` (V2Identity, optional) - `only_enrich_updates` (boolean, optional) — 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_id` (string, optional, nullable) — Organization ID for the sync; read-only with a partner key. - `override_fields` (list of V2OverrideFieldInput, optional, nullable) — Target fields which are set to a fixed value for every record, rather than mapped from a model field. - `overrides` (list of V2Override, optional, nullable) — Conditional value replacement for fields. - `policies` (list of string, optional, nullable) - `skip_initial_backfill` (boolean, optional) — Whether to skip the initial backfill of records; if true only records seen after the sync is enabled will be synced. - `sync_all_records` (boolean, optional) — Whether to sync all records from the source, regardless of whether they've changed since the previous execution. ## Response ### 200 OK - `data` (V2SyncResponse, optional) ## Errors ### 400 Bad Request Error Bad Request - `key` (string, optional) - `message` (string, optional) - `metadata` (map from string to any, optional) - `status` (integer, optional) ### 401 Unauthorized Error Unauthorized - `code` (integer, optional) — Application-specific error code. - `context` (map from string to any, optional) — Application context. - `error` (string, optional) — Error message. - `status` (string, optional) — Status text. ### 403 Forbidden Error Forbidden - `key` (string, optional) - `message` (string, optional) - `metadata` (map from string to any, optional) - `status` (integer, optional) ### 404 Not Found Error Not Found - `key` (string, optional) - `message` (string, optional) - `metadata` (map from string to any, optional) - `status` (integer, optional) ### 422 Unprocessable Entity Error Unprocessable Entity - `key` (string, optional) - `message` (string, optional) - `metadata` (map from string to any, optional) - `status` (integer, optional) ### 500 Internal Server Error Internal Server Error - `key` (string, optional) - `message` (string, optional) - `metadata` (map from string to any, optional) - `status` (integer, optional) ## Types ### V2SyncField - `target` (string, required) — Target field ID the source field value will be written to. - `encryption_enabled` (boolean, optional) — Whether the field should be encrypted. - `new` (boolean, optional, default: false) — New is set to true if the target field should be created by Polytomic. This is not supported by all backends. - `override_value` (string, optional) — Value to set in the target field; a mapping with an override value and no source is stored as an override field. - `source` (V2Source, optional) - `sync_mode` (string, optional) — Sync mode for the field; defaults to 'updateOrCreate'. If set to 'create', the field will not be synced if it already has a value. This is not supported by all backends. ### Schedule - `connection_id` (string, optional) - `day_of_month` (string, optional, nullable) - `day_of_week` (string, optional, nullable) - `frequency` (enum, optional) - Allowed values: `manual`, `continuous`, `hourly`, `daily`, `weekly`, `custom`, `builder`, `runafter`, `multi`, `dbtcloud` - `hour` (string, optional, nullable) - `job_id` (integer, optional, nullable) - `minute` (string, optional, nullable) - `month` (string, optional, nullable) - `run_after` (RunAfter, optional) - `run_after_success_only` (boolean, optional, nullable) — If true, the sync will only run if the dependent syncs completed successfully. ### V2Target - `connection_id` (string, required) - `configuration` (map from string to any, optional) - `create` (map from string to string, optional) — Create a new target object with these properties. - `filter_logic` (string, optional) — Logical expression combining this sync's target filters -- the entries in 'filters' whose 'field_type' is 'Target' -- by their labels. The operators are not case-sensitive but the labels are, and the expression has to name every target filter at least once -- a filter may be repeated, as in '(A and B) or (A and C)' -- and an expression which leaves one out is rejected. - `object` (string, optional) - `new_name` (string, optional, deprecated) — Name for a new target object. - `search_values` (map from string to any, optional, deprecated) ### V2Filter A filter on this sync. Either `field` or `field_id` must be provided; if `field_id` is provided, `field` is ignored. `field` names a model field by model and source name. `field_id` is a model field's UUID when `field_type` is `Model`, and the destination's own field identifier when it is `Target`. - `function` (enum, required) - Allowed values: `Equality`, `Inequality`, `IsNull`, `IsNotNull`, `True`, `False`, `OnOrAfter`, `OnOrBefore`, `GreaterThan`, `GreaterThanEqual`, `LessThan`, `LessThanEqual`, `StringContains`, `StringStartsWith`, `StringEndsWith`, `StringDoesNotContain`, `StringDoesNotStartWith`, `StringDoesNotEndWith`, `StringOneOf`, `StringNotOneOf`, `Between`, `ArrayContains`, `ArrayDoesNotContain`, `InTheLast`, `RelativeOnOrBefore`, `RelativeOnOrAfter`, `StringLike`, `StringNotLike`, `StringMatchesTrimmed` - `field` (V2Source, optional) - `field_id` (string, optional) — Identifier of the field to filter on: a model field's UUID when 'field_type' is 'Model', or the destination's own field identifier when it is 'Target'. - `field_type` (enum, optional) - Allowed values: `Model`, `Target` - `label` (string, optional) - `value` (any, optional) - `value_field` (V2Source, optional) — Model field whose value this filter compares against, resolved separately for each record. Only valid on a target filter, mutually exclusive with 'value', and accepted only by destinations reporting 'supports_filter_value_fields'. ### V2Identity - `function` (enum, required) - Allowed values: `Equality`, `ISubstring`, `OneOf`, `DomainMatch`, `HostnameMatch` - `source` (V2Source, required) - `target` (string, required) - `new_field` (boolean, optional) - `remote_field_type_id` (string, optional, nullable) ### V2OverrideFieldInput A target field which is set to a fixed value for every record; unlike a field mapping, an override field has no source field. The field mapping properties are accepted for backwards compatibility. - `target` (string, required) — Target field ID the value will be written to. - `new` (boolean, optional, default: false) — New is set to true if the target field should be created by Polytomic. This is not supported by all backends. - `override_value` (string, optional) — Value written to the target field for every record; required unless a source is provided. - `sync_mode` (string, optional) — Sync mode for the field; defaults to 'updateOrCreate'. If set to 'create', the field will not be synced if it already has a value. This is not supported by all backends. - `encryption_enabled` (boolean, optional, deprecated) — Deprecated. Encryption is ignored for override fields. - `source` (V2Source, optional, deprecated) — Deprecated. Override fields have no source; entries which name one are stored as a field mapping instead. Use 'fields' to map a source field. ### V2Override Either `field` or `field_id` must be provided. If `field_id` is provided, `field` is ignored. - `field` (V2Source, optional) - `field_id` (string, optional) — Field ID of the model field to override. - `function` (enum, optional) - Allowed values: `Equality`, `Inequality`, `IsNull`, `IsNotNull`, `True`, `False`, `OnOrAfter`, `OnOrBefore`, `GreaterThan`, `GreaterThanEqual`, `LessThan`, `LessThanEqual`, `StringContains`, `StringStartsWith`, `StringEndsWith`, `StringDoesNotContain`, `StringDoesNotStartWith`, `StringDoesNotEndWith`, `StringOneOf`, `StringNotOneOf`, `Between`, `ArrayContains`, `ArrayDoesNotContain`, `InTheLast`, `RelativeOnOrBefore`, `RelativeOnOrAfter`, `StringLike`, `StringNotLike`, `StringMatchesTrimmed` - `override` (any, optional) - `value` (any, optional) ### V2SyncResponse - `active` (boolean, optional) - `created_at` (datetime, optional) - `created_by` (OutputActor, optional) - `encryption_passphrase` (string, optional) - `fields` (list of V2SyncField, optional) - `filter_logic` (string, optional) - `filters` (list of V2Filter, optional) - `id` (string, optional) - `identity` (V2Identity, optional) - `mode` (enum, optional) - Allowed values: `create`, `update`, `updateOrCreate`, `replace`, `append`, `remove`, `snapshot` - `model_ids` (list of string, optional) — Model IDs used in the sync. - `name` (string, optional) - `only_enrich_updates` (boolean, optional) - `organization_id` (string, optional) - `override_fields` (list of V2OverrideField, optional) - `overrides` (list of V2Override, optional) - `policies` (list of string, optional) - `schedule` (Schedule, optional) - `skip_initial_backfill` (boolean, optional) - `sync_all_records` (boolean, optional) - `target` (V2Target, optional) - `updated_at` (datetime, optional) - `updated_by` (OutputActor, optional) ### V2Source - `field` (string, required) - `model_id` (string, required) ### RunAfter - `bulk_sync_ids` (list of string, optional) - `sync_ids` (list of string, optional) ### OutputActor - `id` (string, optional) - `name` (string, optional) - `type` (string, optional) ### V2OverrideField A target field which is set to a fixed value for every record; unlike a field mapping, an override field has no source field. - `override_value` (string, required) — Value written to the target field for every record. - `target` (string, required) — Target field ID the value will be written to. - `new` (boolean, optional, default: false) — New is set to true if the target field should be created by Polytomic. This is not supported by all backends. - `sync_mode` (string, optional) — Sync mode for the field; defaults to 'updateOrCreate'. If set to 'create', the field will not be synced if it already has a value. This is not supported by all backends. ## Examples **Request** ```json { "fields": [ { "target": "name" } ], "mode": "create", "name": "Users Sync", "target": { "connection_id": "248df4b7-aa70-47b8-a036-33ac447e668d" } } ``` **Response** ```json { "data": { "active": true, "created_at": "2024-01-15T09:30:00Z", "created_by": { "id": "12345678-1234-1234-1234-123456789012", "name": "John Doe", "type": "user" }, "encryption_passphrase": "string", "fields": [ { "target": "name", "encryption_enabled": true, "new": false, "override_value": "fixed_value", "source": { "field": "id", "model_id": "248df4b7-aa70-47b8-a036-33ac447e668d" }, "sync_mode": "create" } ], "filter_logic": "string", "filters": [ { "function": "Equality", "field": { "field": "id", "model_id": "248df4b7-aa70-47b8-a036-33ac447e668d" }, "field_id": "field1", "field_type": "Model", "label": "A", "value": null, "value_field": { "field": "id", "model_id": "248df4b7-aa70-47b8-a036-33ac447e668d" } } ], "id": "248df4b7-aa70-47b8-a036-33ac447e668d", "identity": { "function": "Equality", "source": { "field": "id", "model_id": "248df4b7-aa70-47b8-a036-33ac447e668d" }, "target": "name", "new_field": true, "remote_field_type_id": "string" }, "mode": "create", "model_ids": [ "string" ], "name": "Users Sync", "only_enrich_updates": false, "organization_id": "248df4b7-aa70-47b8-a036-33ac447e668d", "override_fields": [ { "override_value": "fixed_value", "target": "name", "new": false, "sync_mode": "create" } ], "overrides": [ { "field": { "field": "id", "model_id": "248df4b7-aa70-47b8-a036-33ac447e668d" }, "field_id": "field1", "function": "Equality", "override": null, "value": null } ], "policies": [ "248df4b7-aa70-47b8-a036-33ac447e668d" ], "schedule": { "connection_id": "248df4b7-aa70-47b8-a036-33ac447e668d", "day_of_month": "1", "day_of_week": "monday", "frequency": "manual", "hour": "12", "job_id": 1, "minute": "30", "month": "1", "run_after": { "bulk_sync_ids": [ "248df4b7-aa70-47b8-a036-33ac447e668d" ], "sync_ids": [ "248df4b7-aa70-47b8-a036-33ac447e668d" ] }, "run_after_success_only": true }, "skip_initial_backfill": false, "sync_all_records": false, "target": { "connection_id": "248df4b7-aa70-47b8-a036-33ac447e668d", "configuration": { "key": "value" }, "create": { "name": "value" }, "filter_logic": "A and B", "object": "Users", "new_name": "string", "search_values": { "name": "value" } }, "updated_at": "2024-01-15T09:30:00Z", "updated_by": { "id": "12345678-1234-1234-1234-123456789012", "name": "John Doe", "type": "user" } } } ``` **SDK Code** ```python import requests url = "https://app.polytomic.com/api/syncs/248df4b7-aa70-47b8-a036-33ac447e668d" payload = { "fields": [{ "target": "name" }], "mode": "create", "name": "Users Sync", "target": { "connection_id": "248df4b7-aa70-47b8-a036-33ac447e668d" } } headers = { "X-Polytomic-Version": "X-Polytomic-Version" "Content-Type": "application/json" } response = requests.patch(url, json=payload, headers=headers, auth=("", "")) print(response.json()) ``` ```javascript const url = 'https://app.polytomic.com/api/syncs/248df4b7-aa70-47b8-a036-33ac447e668d'; const credentials = btoa(":"); const options = { method: 'PATCH', headers: { 'X-Polytomic-Version': 'X-Polytomic-Version', Authorization: `Basic ${credentials}`, 'Content-Type': 'application/json' }, body: '{"fields":[{"target":"name"}],"mode":"create","name":"Users Sync","target":{"connection_id":"248df4b7-aa70-47b8-a036-33ac447e668d"}}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://app.polytomic.com/api/syncs/248df4b7-aa70-47b8-a036-33ac447e668d" payload := strings.NewReader("{\n \"fields\": [\n {\n \"target\": \"name\"\n }\n ],\n \"mode\": \"create\",\n \"name\": \"Users Sync\",\n \"target\": {\n \"connection_id\": \"248df4b7-aa70-47b8-a036-33ac447e668d\"\n }\n}") req, _ := http.NewRequest("PATCH", url, payload) req.Header.Add("X-Polytomic-Version", "X-Polytomic-Version") req.SetBasicAuth("", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby require 'uri' require 'net/http' url = URI("https://app.polytomic.com/api/syncs/248df4b7-aa70-47b8-a036-33ac447e668d") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Patch.new(url) request["X-Polytomic-Version"] = 'X-Polytomic-Version' request.basic_auth("", "") request["Content-Type"] = 'application/json' request.body = "{\n \"fields\": [\n {\n \"target\": \"name\"\n }\n ],\n \"mode\": \"create\",\n \"name\": \"Users Sync\",\n \"target\": {\n \"connection_id\": \"248df4b7-aa70-47b8-a036-33ac447e668d\"\n }\n}" response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.patch("https://app.polytomic.com/api/syncs/248df4b7-aa70-47b8-a036-33ac447e668d") .header("X-Polytomic-Version", "X-Polytomic-Version") .basicAuth("", "") .header("Content-Type", "application/json") .body("{\n \"fields\": [\n {\n \"target\": \"name\"\n }\n ],\n \"mode\": \"create\",\n \"name\": \"Users Sync\",\n \"target\": {\n \"connection_id\": \"248df4b7-aa70-47b8-a036-33ac447e668d\"\n }\n}") .asString(); ``` ```php request('PATCH', 'https://app.polytomic.com/api/syncs/248df4b7-aa70-47b8-a036-33ac447e668d', [ 'body' => '{ "fields": [ { "target": "name" } ], "mode": "create", "name": "Users Sync", "target": { "connection_id": "248df4b7-aa70-47b8-a036-33ac447e668d" } }', 'headers' => [ 'Content-Type' => 'application/json', 'X-Polytomic-Version' => 'X-Polytomic-Version', ], 'auth' => ['', ''], ]); echo $response->getBody(); ``` ```csharp using RestSharp; using RestSharp.Authenticators; var client = new RestClient("https://app.polytomic.com/api/syncs/248df4b7-aa70-47b8-a036-33ac447e668d"); client.Authenticator = new HttpBasicAuthenticator("", ""); var request = new RestRequest(Method.PATCH); request.AddHeader("X-Polytomic-Version", "X-Polytomic-Version"); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"fields\": [\n {\n \"target\": \"name\"\n }\n ],\n \"mode\": \"create\",\n \"name\": \"Users Sync\",\n \"target\": {\n \"connection_id\": \"248df4b7-aa70-47b8-a036-33ac447e668d\"\n }\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let credentials = Data(":".utf8).base64EncodedString() let headers = [ "X-Polytomic-Version": "X-Polytomic-Version", "Authorization": "Basic \(credentials)", "Content-Type": "application/json" ] let parameters = [ "fields": [["target": "name"]], "mode": "create", "name": "Users Sync", "target": ["connection_id": "248df4b7-aa70-47b8-a036-33ac447e668d"] ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://app.polytomic.com/api/syncs/248df4b7-aa70-47b8-a036-33ac447e668d")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "PATCH" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```