> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://apidocs.polytomic.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://apidocs.polytomic.com/_mcp/server.

# Create Sync

POST https://app.polytomic.com/api/syncs
Content-Type: application/json

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.

Reference: https://apidocs.polytomic.com/api-reference/model-sync/create

## Authentication

- `Authorization` header (bearer token, required) — Bearer user API key
- `Authorization` header (basic auth, required) — Basic organization-scoped API key

## Request

### Body (application/json)

This endpoint expects a CreateModelSyncV5Request.

- `fields` (list of SyncField, 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` (ModelSyncV5Target, required)
- `active` (boolean, optional) — Whether the sync is enabled and scheduled.
- `encryption_passphrase` (string, optional) — Passphrase for encrypting the sync data.
- `identities` (ModelSyncIdentities, optional) — Identity mappings for the sync and the strategy combining them, replacing any the sync has. When this is omitted, 'identity' is used instead; updating a sync with more than one mapping requires this property.
- `model_filters` (ModelFilters, optional) — Filters applied to the records read from the source.
- `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 OverrideFieldInput, optional, nullable) — Target fields which are set to a fixed value for every record, rather than mapped from a model field.
- `overrides` (list of Override, 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.
- `target_filters` (TargetFilters, optional) — Filters applied to the destination records the sync has matched. Only some destinations and sync modes support them; 'supports\_target\_filters' on the mode returned by GET /api/connections/\{id}/modelsync/target/fields says which.
- `filter_logic` (string, optional, deprecated) — Deprecated. Use 'model_filters.logic'. Combines the model filters in 'filters' only.
- `filters` (list of Filter, optional, nullable, deprecated) — Deprecated. Use 'model_filters.conditions' and 'target_filters.conditions', which say which kind each condition is rather than inferring it. Ignored when either of those is present, except that a request carrying both shapes is rejected if they describe different filters.
- `identity` (Identity, optional, deprecated) — Deprecated. Use 'identities'. Reports and accepts the first identity mapping only.

## Response

### 200

OK

- `data` (ModelSyncV5Response, optional)

## Errors

### 400 Bad Request Error

Bad Request

- `key` (string, optional)
- `message` (string, optional)
- `metadata` (map from string to any, optional)
- `status` (integer, optional)

### 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

### SyncField

- `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` (Source, 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.

### ModelSyncV5Target

- `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.
- `object` (string, optional)
- `filter_logic` (string, optional, deprecated) — Deprecated. Use 'target_filters.logic', which combines the conditions it is grouped with.
- `new_name` (string, optional, deprecated) — Name for a new target object.
- `search_values` (map from string to any, optional, deprecated)

### ModelSyncIdentities

Identity mappings determining how records are matched between source and destination.

- `mappings` (list of Identity, required) — Identity mappings in priority order. An empty list removes every identity mapping.
- `strategy` (enum, optional) — How the mappings are combined: 'priority' matches each record on the first mapping that finds a destination record, and 'and' requires every mapping to match. Required when there is more than one mapping; a single mapping is always 'priority'.
  - Allowed values: `priority`, `and`

### ModelFilters

Filters applied to the records read from the source.

- `conditions` (list of ModelFilterCondition, optional, nullable) — Conditions a source record must satisfy to be read. An empty list reads every record.
- `logic` (string, optional) — Expression combining the conditions in this object by their labels; 'and', 'or', and parentheses are supported. The operators are not case-sensitive but the labels are, and the expression has to name every condition in this object -- a condition may be repeated, as in '(A and B) or (A and C)' -- and an expression which leaves one out is rejected. An empty expression means every condition must be satisfied.

### OverrideFieldInput

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` (Source, 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.

### Override

Either `field` or `field_id` must be provided. If `field_id` is provided, `field` is ignored.

- `field` (Source, 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)

### TargetFilters

Filters applied to the destination records the sync has matched. Only some destinations and sync modes support them; 'supports\_target\_filters' on the mode returned by GET /api/connections/\{id}/modelsync/target/fields says which.

- `conditions` (list of TargetFilterCondition, optional, nullable) — Conditions a destination record must satisfy to be written. An empty list writes every matched record.
- `logic` (string, optional) — Expression combining the conditions in this object by their labels; 'and', 'or', and parentheses are supported. The operators are not case-sensitive but the labels are, and the expression has to name every condition in this object -- a condition may be repeated, as in '(A and B) or (A and C)' -- and an expression which leaves one out is rejected. An empty expression means every condition must be satisfied.

### Filter

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` (Source, 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` (Source, 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'.

### Identity

- `function` (enum, required)
  - Allowed values: `Equality`, `ISubstring`, `OneOf`, `DomainMatch`, `HostnameMatch`
- `source` (Source, required)
- `target` (string, required)
- `new_field` (boolean, optional)
- `remote_field_type_id` (string, optional, nullable)

### ModelSyncV5Response

- `active` (boolean, optional)
- `created_at` (datetime, optional)
- `created_by` (OutputActor, optional)
- `encryption_passphrase` (string, optional)
- `fields` (list of SyncField, optional)
- `id` (string, optional)
- `identities` (ModelSyncIdentities, optional) — Identity mappings for the sync and the strategy combining them.
- `mode` (enum, optional)
  - Allowed values: `create`, `update`, `updateOrCreate`, `replace`, `append`, `remove`, `snapshot`
- `model_filters` (ModelFilters, optional) — Filters applied to the records read from the source.
- `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 OverrideField, optional)
- `overrides` (list of Override, optional)
- `policies` (list of string, optional)
- `problems` (list of ModelSyncProblem, optional, nullable) — Parts of this configuration which could not be resolved when it was read. The configuration is reported unchanged, references included, so it can be corrected and written back; this property is ignored on input.
- `schedule` (Schedule, optional)
- `skip_initial_backfill` (boolean, optional)
- `sync_all_records` (boolean, optional)
- `target` (ModelSyncV5Target, optional)
- `target_filters` (TargetFilters, optional) — Filters applied to the destination records the sync has matched. Only some destinations and sync modes support them; 'supports\_target\_filters' on the mode returned by GET /api/connections/\{id}/modelsync/target/fields says which.
- `updated_at` (datetime, optional)
- `updated_by` (OutputActor, optional)
- `filter_logic` (string, optional, deprecated) — Deprecated. Use 'model_filters.logic'.
- `filters` (list of Filter, optional, deprecated) — Deprecated. Use 'model_filters.conditions' and 'target_filters.conditions'. Reports the same filters, with the two kinds interleaved and told apart by 'field_type'.
- `identity` (Identity, optional, deprecated) — Deprecated. Use 'identities'. Reports the first identity mapping only.

### Source

- `field` (string, required)
- `model_id` (string, required)

### RunAfter

- `bulk_sync_ids` (list of string, optional)
- `sync_ids` (list of string, optional)

### ModelFilterCondition

- `function` (enum, required) — Comparison this condition applies to the field's value.
  - 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`
- `source` (Source, required) — Model field this condition tests, named the same way as a field mapping's source.
- `label` (string, optional) — Handle naming this condition in 'logic'. A label starts with a letter or underscore and continues with letters, digits and underscores. Labels are scoped to this object, so a model condition and a target condition may share one. Optional: label every condition in the object or none of them, and an unlabelled object is labelled by position -- A, B, C -- which is how labels are always reported back.
- `value` (any, optional) — Value the field is compared against. Omitted for functions which take no value, such as 'IsNotNull'.

### TargetFilterCondition

- `field` (string, required) — Destination field this condition tests, identified the same way as a field mapping's target.
- `function` (enum, required) — Comparison this condition applies to the field's value.
  - 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`
- `label` (string, optional) — Handle naming this condition in 'logic'. A label starts with a letter or underscore and continues with letters, digits and underscores. Labels are scoped to this object, so a model condition and a target condition may share one. Optional: label every condition in the object or none of them, and an unlabelled object is labelled by position -- A, B, C -- which is how labels are always reported back.
- `value` (any, optional) — Value the field is compared against. Omitted for functions which take no value, such as 'IsNotNull'.
- `value_source` (Source, optional) — Model field whose value the destination field is compared against, resolved separately for every record, named the way a model condition names its source. Mutually exclusive with 'value', and accepted only by destinations reporting 'supports_filter_value_fields'.

### OutputActor

- `id` (string, optional)
- `name` (string, optional)
- `type` (string, optional)

### OverrideField

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.

### ModelSyncProblem

- `code` (string, optional) — Stable identifier for the kind of problem. Branch on this rather than on 'message'.
- `message` (string, optional) — Description of the problem, suitable for showing to a person.
- `path` (string, optional) — JSON path of the part of this configuration the problem is about, relative to the sync object.
- `severity` (enum, optional) — How serious the problem is. Every problem reported today is an error, which stops the sync from running; read this rather than assuming.
  - Allowed values: `error`

## 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"
      }
    ],
    "id": "248df4b7-aa70-47b8-a036-33ac447e668d",
    "identities": {
      "mappings": [
        {
          "function": "Equality",
          "source": {
            "field": "id",
            "model_id": "248df4b7-aa70-47b8-a036-33ac447e668d"
          },
          "target": "name",
          "new_field": true,
          "remote_field_type_id": "string"
        }
      ],
      "strategy": "priority"
    },
    "mode": "create",
    "model_filters": {
      "conditions": [
        {
          "function": "Equality",
          "source": {
            "field": "id",
            "model_id": "248df4b7-aa70-47b8-a036-33ac447e668d"
          },
          "label": "A",
          "value": null
        }
      ],
      "logic": "A and B or C"
    },
    "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"
    ],
    "problems": [
      {
        "code": "unknown_target_field",
        "message": "string",
        "path": "target_filters.conditions[1].field",
        "severity": "error"
      }
    ],
    "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"
      },
      "object": "Users",
      "filter_logic": "string",
      "new_name": "string",
      "search_values": {
        "name": "value"
      }
    },
    "target_filters": {
      "conditions": [
        {
          "field": "Email",
          "function": "Equality",
          "label": "A",
          "value": null,
          "value_source": {
            "field": "id",
            "model_id": "248df4b7-aa70-47b8-a036-33ac447e668d"
          }
        }
      ],
      "logic": "A and B"
    },
    "updated_at": "2024-01-15T09:30:00Z",
    "updated_by": {
      "id": "12345678-1234-1234-1234-123456789012",
      "name": "John Doe",
      "type": "user"
    },
    "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"
        }
      }
    ],
    "identity": {
      "function": "Equality",
      "source": {
        "field": "id",
        "model_id": "248df4b7-aa70-47b8-a036-33ac447e668d"
      },
      "target": "name",
      "new_field": true,
      "remote_field_type_id": "string"
    }
  }
}
```

**SDK Code**

```python
import requests

url = "https://app.polytomic.com/api/syncs"

payload = {
    "fields": [{ "target": "name" }],
    "mode": "create",
    "name": "Users Sync",
    "target": { "connection_id": "248df4b7-aa70-47b8-a036-33ac447e668d" }
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://app.polytomic.com/api/syncs';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', '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"

	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("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	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")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
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<String> response = Unirest.post("https://app.polytomic.com/api/syncs")
  .header("Authorization", "Bearer <token>")
  .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
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://app.polytomic.com/api/syncs', [
  'body' => '{
  "fields": [
    {
      "target": "name"
    }
  ],
  "mode": "create",
  "name": "Users Sync",
  "target": {
    "connection_id": "248df4b7-aa70-47b8-a036-33ac447e668d"
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://app.polytomic.com/api/syncs");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
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 headers = [
  "Authorization": "Bearer <token>",
  "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")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
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()
```