Model 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

Request

  • Base URL
    https://app.polytomic.com
  • Auth
    • HTTP bearer
    • or HTTP basic

Headers

X-Polytomic-Versionstring

Request body

activeboolean

Whether the sync is enabled and scheduled

encryption_passphrasestring

Passphrase for encrypting the sync data

filter_logicstring

Deprecated. Use 'model_filters.logic'. Combines the model filters in 'filters' only.

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

Name of the model sync

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

Ignored for user and organization-scoped API keys, which always act in their own organization

policiesstring[] nullable

Permissions policy IDs applied to the sync. On update, a non-empty list replaces the sync's policies and an empty or omitted list leaves them unchanged.

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",
      "value_field": {
        "field": "id",
        "model_id": "248df4b7-aa70-47b8-a036-33ac447e668d"
      }
    }
  ],
  "identities": {
    "mappings": [
      {
        "remote_field_type_id": "string",
        "source": {
          "field": "id",
          "model_id": "248df4b7-aa70-47b8-a036-33ac447e668d"
        },
        "target": "name"
      }
    ],
    "strategy": "priority"
  },
  "identity": {
    "remote_field_type_id": "string",
    "source": {
      "field": "id",
      "model_id": "248df4b7-aa70-47b8-a036-33ac447e668d"
    },
    "target": "name"
  },
  "model_filters": {
    "conditions": [
      {
        "label": "A",
        "source": {
          "field": "id",
          "model_id": "248df4b7-aa70-47b8-a036-33ac447e668d"
        },
        "value": "value"
      }
    ],
    "logic": "A and B or C"
  },
  "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": "1",
    "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"
    }
  },
  "target_filters": {
    "conditions": [
      {
        "field": "Email",
        "label": "A",
        "value": "value",
        "value_source": {
          "field": "id",
          "model_id": "248df4b7-aa70-47b8-a036-33ac447e668d"
        }
      }
    ],
    "logic": "A and B"
  }
}

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",
        "value_field": {
          "field": "id",
          "model_id": "248df4b7-aa70-47b8-a036-33ac447e668d"
        }
      }
    ],
    "id": "248df4b7-aa70-47b8-a036-33ac447e668d",
    "identities": {
      "mappings": [
        {
          "remote_field_type_id": "string",
          "source": {
            "field": "id",
            "model_id": "248df4b7-aa70-47b8-a036-33ac447e668d"
          },
          "target": "name"
        }
      ],
      "strategy": "priority"
    },
    "identity": {
      "remote_field_type_id": "string",
      "source": {
        "field": "id",
        "model_id": "248df4b7-aa70-47b8-a036-33ac447e668d"
      },
      "target": "name"
    },
    "model_filters": {
      "conditions": [
        {
          "label": "A",
          "source": {
            "field": "id",
            "model_id": "248df4b7-aa70-47b8-a036-33ac447e668d"
          },
          "value": "value"
        }
      ],
      "logic": "A and B or C"
    },
    "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"
    ],
    "problems": [
      {
        "code": "unknown_target_field",
        "path": "target_filters.conditions[1].field",
        "severity": "error"
      }
    ],
    "schedule": {
      "connection_id": "248df4b7-aa70-47b8-a036-33ac447e668d",
      "day_of_month": "1",
      "day_of_week": "1",
      "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"
      }
    },
    "target_filters": {
      "conditions": [
        {
          "field": "Email",
          "label": "A",
          "value": "value",
          "value_source": {
            "field": "id",
            "model_id": "248df4b7-aa70-47b8-a036-33ac447e668d"
          }
        }
      ],
      "logic": "A and B"
    },
    "updated_by": {
      "id": "12345678-1234-1234-1234-123456789012",
      "name": "John Doe",
      "type": "user"
    }
  }
}

Changes

    • breaking

      added to the // request property allOf list

    • breaking

      added to the // request property allOf list

    • breaking

      added to the // request property allOf list

    • breaking

      added to the request property allOf list

    • breaking

      added to the request property allOf list

    • breaking

      added to the request property allOf list

    • breaking

      added to the request property allOf list

    • breaking

      added to the //// request property allOf list

    • breaking

      added to the // request property allOf list

    • breaking

      added to the // request property allOf list

    • breaking

      added to the // request property allOf list

    • breaking

      added to the //// request property allOf list

    • breaking

      added to the // request property allOf list

    • breaking

      added to the // request property allOf list

    • breaking

      added to the request property allOf list

    • breaking

      removed the enum value ArrayContains of the request property //

    • breaking

      removed the enum value ArrayContains of the request property //

    • breaking

      removed the enum value ArrayDoesNotContain of the request property //

    • breaking

      removed the enum value ArrayDoesNotContain of the request property //

    • breaking

      removed the enum value Between of the request property //

    • breaking

      removed the enum value Between of the request property //

    • breaking

      removed the enum value DomainMatch of the request property ////

    • breaking

      removed the enum value DomainMatch of the request property //

    • breaking

      removed the enum value Equality of the request property //

    • breaking

      removed the enum value Equality of the request property ////

    • breaking

      removed the enum value Equality of the request property //

    • breaking

      removed the enum value Equality of the request property //

    • breaking

      removed the enum value False of the request property //

    • breaking

      removed the enum value False of the request property //

    • breaking

      removed the enum value GreaterThan of the request property //

    • breaking

      removed the enum value GreaterThan of the request property //

    • breaking

      removed the enum value GreaterThanEqual of the request property //

    • breaking

      removed the enum value GreaterThanEqual of the request property //

    • breaking

      removed the enum value HostnameMatch of the request property ////

    • breaking

      removed the enum value HostnameMatch of the request property //

    • breaking

      removed the enum value ISubstring of the request property ////

    • breaking

      removed the enum value ISubstring of the request property //

    • breaking

      removed the enum value InTheLast of the request property //

    • breaking

      removed the enum value InTheLast of the request property //

    • breaking

      removed the enum value Inequality of the request property //

    • breaking

      removed the enum value Inequality of the request property //

    • breaking

      removed the enum value IsNotNull of the request property //

    • breaking

      removed the enum value IsNotNull of the request property //

    • breaking

      removed the enum value IsNull of the request property //

    • breaking

      removed the enum value IsNull of the request property //

    • breaking

      removed the enum value LessThan of the request property //

    • breaking

      removed the enum value LessThan of the request property //

    • breaking

      removed the enum value LessThanEqual of the request property //

    • breaking

      removed the enum value LessThanEqual of the request property //

    • breaking

      removed the enum value Model of the request property //

    • breaking

      removed the enum value OnOrAfter of the request property //

    • breaking

      removed the enum value OnOrAfter of the request property //

    • breaking

      removed the enum value OnOrBefore of the request property //

    • breaking

      removed the enum value OnOrBefore of the request property //

    • breaking

      removed the enum value OneOf of the request property ////

    • breaking

      removed the enum value OneOf of the request property //

    • breaking

      removed the enum value RelativeOnOrAfter of the request property //

    • breaking

      removed the enum value RelativeOnOrAfter of the request property //

    • breaking

      removed the enum value RelativeOnOrBefore of the request property //

    • breaking

      removed the enum value RelativeOnOrBefore of the request property //

    • breaking

      removed the enum value StringContains of the request property //

    • breaking

      removed the enum value StringContains of the request property //

    • breaking

      removed the enum value StringDoesNotContain of the request property //

    • breaking

      removed the enum value StringDoesNotContain of the request property //

    • breaking

      removed the enum value StringDoesNotEndWith of the request property //

    • breaking

      removed the enum value StringDoesNotEndWith of the request property //

    • breaking

      removed the enum value StringDoesNotStartWith of the request property //

    • breaking

      removed the enum value StringDoesNotStartWith of the request property //

    • breaking

      removed the enum value StringEndsWith of the request property //

    • breaking

      removed the enum value StringEndsWith of the request property //

    • breaking

      removed the enum value StringLike of the request property //

    • breaking

      removed the enum value StringLike of the request property //

    • breaking

      removed the enum value StringMatchesTrimmed of the request property //

    • breaking

      removed the enum value StringMatchesTrimmed of the request property //

    • breaking

      removed the enum value StringNotLike of the request property //

    • breaking

      removed the enum value StringNotLike of the request property //

    • breaking

      removed the enum value StringNotOneOf of the request property //

    • breaking

      removed the enum value StringNotOneOf of the request property //

    • breaking

      removed the enum value StringOneOf of the request property //

    • breaking

      removed the enum value StringOneOf of the request property //

    • breaking

      removed the enum value StringStartsWith of the request property //

    • breaking

      removed the enum value StringStartsWith of the request property //

    • breaking

      removed the enum value Target of the request property //

    • breaking

      removed the enum value True of the request property //

    • breaking

      removed the enum value True of the request property //

    • breaking

      removed the enum value append of the request property

    • breaking

      removed the enum value create of the request property

    • breaking

      removed the enum value remove of the request property

    • breaking

      removed the enum value replace of the request property

    • breaking

      removed the enum value snapshot of the request property

    • breaking

      removed the enum value update of the request property

    • breaking

      removed the enum value updateOrCreate of the request property

    • breaking

      the // request property type changed from object to no type

    • breaking

      the // request property type changed from object to no type

    • breaking

      the // request property type changed from string to no type

    • breaking

      the // request property type changed from string to no type

    • breaking

      the //// request property type changed from string to no type

    • breaking

      the //// request property type changed from object to no type

    • breaking

      the // request property type changed from string to no type

    • breaking

      the // request property type changed from object to no type

    • breaking

      the request property type changed from string to no type

    • breaking

      the request property type changed from object to no type

    • breaking

      the // request property type changed from object to no type

    • breaking

      the // request property type changed from string to no type

    • breaking

      the request property type changed from object to no type

    • breaking

      the request property type changed from object to no type

    • breaking

      the request property type changed from object to no type

    • breaking

      the response's property type changed from object to no type for status

    • warning

      removed the request property ///

    • warning

      removed the request property ///

    • warning

      removed the request property ///

    • warning

      removed the request property ///

    • warning

      removed the request property /////

    • warning

      removed the request property /////

    • warning

      removed the request property ///

    • warning

      removed the request property ///

    • warning

      removed the request property /

    • warning

      removed the request property /

    • warning

      removed the request property ///

    • warning

      removed the request property ///

    • warning

      removed the request property /

    • warning

      removed the request property /

    • warning

      removed the request property /

    • warning

      removed the request property /

    • warning

      removed the request property /

    • warning

      removed the request property /

    • warning

      removed the request property /

    • warning

      removed the request property /

    • warning

      removed the request property /

    • warning

      removed the request property /

    • warning

      removed the request property /

    • warning

      removed the request property /

    • warning

      removed the request property /

    • warning

      removed the request property /

    • warning

      removed the request property /

    • warning

      removed the request property /

    • warning

      removed the request property /

    • warning

      removed the request property /

    • warning

      removed the request property /

    • warning

      removed the optional property / from the response with the status

    • warning

      removed the optional property / from the response with the status

    • warning

      removed the optional property / from the response with the status

    • warning

      removed the optional property / from the response with the status

    • warning

      removed the optional property / from the response with the status

    • warning

      removed the optional property / from the response with the status

    • warning

      removed the optional property / from the response with the status

    • warning

      removed the optional property / from the response with the status

    • warning

      removed the optional property / from the response with the status

    • warning

      removed the optional property / from the response with the status

    • warning

      removed the optional property / from the response with the status

    • warning

      removed the optional property / from the response with the status

    • warning

      removed the optional property / from the response with the status

    • warning

      removed the optional property / from the response with the status

    • warning

      removed the optional property / from the response with the status

    • warning

      removed the optional property / from the response with the status

    • warning

      removed the optional property / from the response with the status

    • warning

      removed the optional property / from the response with the status

    • warning

      removed the optional property / from the response with the status

    • warning

      removed the optional property / from the response with the status

    • warning

      removed the optional property / from the response with the status

    • warning

      removed the optional property / from the response with the status

    • warning

      removed the optional property / from the response with the status

    • warning

      removed the optional property / from the response with the status

    • warning

      removed the optional property / from the response with the status

    • warning

      removed the optional property / from the response with the status

    • warning

      removed the optional property / from the response with the status

    • info

      added to the response property allOf list for the response status

    • breaking

      added to the request property allOf list

    • breaking

      the request property type changed from object to no type

    • breaking

      the / response's property type changed from object to no type for status

    • breaking

      removed the required property // from the response with the status

    • breaking

      removed the required property // from the response with the status

    • breaking

      removed the required property // from the response with the status

    • warning

      removed the request property /

    • warning

      removed the request property /

    • warning

      removed the request property /

    • warning

      removed the request property /

    • warning

      removed the request property /

    • warning

      removed the optional property // from the response with the status

    • warning

      removed the optional property // from the response with the status

    • info

      added the new optional request property

    • info

      added the optional property / to the response with the status

    • info

      added to the / response property allOf list for the response status