> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hightouch.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Update Sync

> Update an existing sync

Patch a sync based on its Hightouch ID. A sync bound to a sync template
takes its configuration from the template: change this sync's values
with `syncTemplateOverrides`, bind it to another template or detach it
with `syncTemplateId`, but do not set `configuration` while it is bound.
In a workspace that requires sync templates for audience activation, a
sync on an audience cannot be detached from its template.



## OpenAPI

````yaml https://api.hightouch.io/api/swagger.json patch /syncs/{syncId}
openapi: 3.0.0
info:
  title: Hightouch API
  version: 1.0.0
  description: Hightouch Public Rest API to access syncs, models, sources and destinations
  contact:
    name: Hightouch
    url: https://hightouch.com
servers:
  - url: https://api.hightouch.com/api/v1
security: []
paths:
  /syncs/{syncId}:
    patch:
      summary: Update Sync
      description: |-
        Update an existing sync

        Patch a sync based on its Hightouch ID. A sync bound to a sync template
        takes its configuration from the template: change this sync's values
        with `syncTemplateOverrides`, bind it to another template or detach it
        with `syncTemplateId`, but do not set `configuration` while it is bound.
        In a workspace that requires sync templates for audience activation, a
        sync on an audience cannot be detached from its template.
      operationId: UpdateSync
      parameters:
        - description: The sync's ID
          in: path
          name: syncId
          required: true
          schema:
            type: number
            format: double
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SyncUpdate'
            example:
              configuration:
                mode: upsert
                object: contacts
                mappings:
                  - to: email
                    from: email
                    type: standard
                objectId: 0-1
                externalIdMapping:
                  to: firstname
                  from: test_id
                  type: standard
                associationMappings: []
              schedule: null
              disabled: true
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/Sync'
                  - $ref: '#/components/schemas/ValidateErrorJSON'
                  - $ref: '#/components/schemas/InternalServerError'
              examples:
                Example 1:
                  value:
                    id: 1
                    slug: testsync3
                    workspaceId: 1
                    createdAt: '2022-02-16T21:37:58.510Z'
                    updatedAt: '2022-03-19T19:24:34.320Z'
                    createdBy:
                      id: 1
                      name: Jane Doe
                      email: jane.doe@example.com
                    updatedBy:
                      id: 1
                      name: Jane Doe
                      email: jane.doe@example.com
                    destinationId: 1
                    modelId: 4
                    configuration:
                      mode: upsert
                      object: contacts
                      mappings:
                        - to: email
                          from: email
                          type: standard
                      objectId: 0-1
                      externalIdMapping:
                        to: firstname
                        from: test_id
                        type: standard
                      associationMappings: []
                    schedule:
                      type: interval
                      schedule:
                        interval:
                          unit: day
                          quantity: 1
                    status: success
                    disabled: true
                    lastRunAt: '2022-02-16T21:37:58.510Z'
                    referencedColumns:
                      - email
                      - name
                    primaryKey: id
                    externalSegment: {}
                    tags:
                      foo: bar
                    syncTemplateId: null
                    syncTemplateOverrides: null
        '401':
          description: Unauthorized
        '404':
          description: Not found
        '422':
          description: Validation Failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidateErrorJSON'
        '500':
          description: Something went wrong
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalServerError'
      security:
        - bearerAuth: []
components:
  schemas:
    SyncUpdate:
      description: The input for updating a Sync
      properties:
        configuration:
          properties: {}
          additionalProperties: {}
          type: object
          description: >-
            The sync's configuration. This specifies how data is mapped, among
            other

            configuration.


            The schema depends on the destination type.


            For a sync bound to a sync template this is the effective
            configuration:

            the template's configuration with this sync's
            `syncTemplateOverrides`

            applied.


            Consumers should NOT make assumptions on the contents of the

            configuration. It may change as Hightouch updates its internal code.
        schedule:
          properties:
            schedule:
              anyOf:
                - $ref: '#/components/schemas/IntervalSchedule'
                - $ref: '#/components/schemas/CronSchedule'
                - $ref: '#/components/schemas/VisualCronSchedule'
                - $ref: '#/components/schemas/DBTSchedule'
            type:
              type: string
          required:
            - type
          type: object
          nullable: true
          description: >-
            The scheduling configuration. It can be triggered based on several
            ways:


            Interval: the sync will be triggered based on certain
            interval(minutes/hours/days/weeks)


            Cron: the sync will be triggered based on cron expression
            https://en.wikipedia.org/wiki/Cron.


            Visual: the sync will be triggered based a visual cron configuration
            on UI


            DBT-cloud: the sync will be triggered based on a dbt cloud job


            Match Booster (type "match_booster"): the sync will be triggered
            after each

            Match Booster enrichment run of its model completes. Requires the
            model to

            have Match Booster enabled, and takes no inner schedule payload.
        disabled:
          type: boolean
          description: Whether the sync has been disabled by the user.
        syncTemplateId:
          type: number
          format: double
          nullable: true
          description: >-
            The id of a Sync Template to bind the sync to, or null to detach the
            sync

            from its template. Binding requires the template's destination to
            match

            the sync's destination; while bound, the sync follows the template's

            configuration and `configuration` cannot be set directly. Detaching

            copies the sync's effective configuration, schedule and other
            inherited

            settings onto the sync so it keeps running unchanged.
        syncTemplateOverrides:
          properties: {}
          additionalProperties: {}
          type: object
          nullable: true
          description: >-
            Replaces the sync's template overrides, keyed by configuration field

            path. Only fields the template's `overrideConfig` marks as
            overridable

            are accepted; null clears every override. Requires the sync to be,
            or to

            become, bound to a sync template.
      type: object
      additionalProperties: false
    Sync:
      description: >-
        Syncs define how data from models are mapped to destinations. Each time
        a

        sync runs, Hightouch calculates the rows that have changed since the
        last

        run, and syncs them to Sync's destination.
      properties:
        id:
          type: number
          format: double
          description: The sync's id
        slug:
          type: string
          description: The sync's slug
        workspaceId:
          type: number
          format: double
          description: The id of the workspace that the sync belongs to
        createdAt:
          type: string
          format: date-time
          description: The timestamp when the sync was created
        updatedAt:
          type: string
          format: date-time
          description: The timestamp when the sync was last updated
        createdBy:
          allOf:
            - $ref: '#/components/schemas/UserReference'
          nullable: true
          description: The user who created the sync, or null if no user was recorded
        updatedBy:
          allOf:
            - $ref: '#/components/schemas/UserReference'
          nullable: true
          description: The user who last updated the sync, or null if no user was recorded
        destinationId:
          type: number
          format: double
          description: The id of the Destination that sync is connected to
        modelId:
          type: number
          format: double
          description: The id of the Model that sync is connected to
        configuration:
          properties: {}
          additionalProperties: {}
          type: object
          description: >-
            The sync's configuration. This specifies how data is mapped, among
            other

            configuration.


            The schema depends on the destination type.


            For a sync bound to a sync template this is the effective
            configuration:

            the template's configuration with this sync's
            `syncTemplateOverrides`

            applied.


            Consumers should NOT make assumptions on the contents of the

            configuration. It may change as Hightouch updates its internal code.
        schedule:
          properties:
            schedule:
              anyOf:
                - $ref: '#/components/schemas/IntervalSchedule'
                - $ref: '#/components/schemas/CronSchedule'
                - $ref: '#/components/schemas/VisualCronSchedule'
                - $ref: '#/components/schemas/DBTSchedule'
            type:
              type: string
          required:
            - type
          type: object
          nullable: true
          description: >-
            The scheduling configuration. It can be triggered based on several
            ways:


            Interval: the sync will be triggered based on certain
            interval(minutes/hours/days/weeks)


            Cron: the sync will be triggered based on cron expression
            https://en.wikipedia.org/wiki/Cron.


            Visual: the sync will be triggered based a visual cron configuration
            on UI


            DBT-cloud: the sync will be triggered based on a dbt cloud job


            Match Booster (type "match_booster"): the sync will be triggered
            after each

            Match Booster enrichment run of its model completes. Requires the
            model to

            have Match Booster enabled, and takes no inner schedule payload.
        status:
          $ref: '#/components/schemas/SyncStatus'
          description: The overall status of the sync
        disabled:
          type: boolean
          description: Whether the sync has been disabled by the user.
        lastRunAt:
          type: string
          format: date-time
          nullable: true
          description: The timestamp of the last sync run
        referencedColumns:
          items:
            type: string
          type: array
          description: The reference column that sync depends on to sync data from source
        primaryKey:
          type: string
          description: The primary key that sync uses to identify data from source
        externalSegment:
          properties:
            id:
              type: string
          type: object
          description: >-
            The user facing ID for any created lists or audiences in the sync
            destination
        tags:
          properties: {}
          additionalProperties:
            type: string
          type: object
          description: The tags of the sync
        syncTemplateId:
          type: number
          format: double
          nullable: true
          description: >-
            The id of the sync template this sync is bound to, or null when the
            sync

            owns its configuration. A bound sync takes its destination and

            configuration from the template and follows later changes to the

            template; `configuration` is the effective merged configuration and

            `syncTemplateOverrides` holds this sync's own values.
        syncTemplateOverrides:
          properties: {}
          additionalProperties: {}
          type: object
          nullable: true
          description: >-
            The template configuration fields this sync overrides, keyed by

            configuration field path (for example "externalIdMapping" or

            "target.schema"). Null when the sync is not bound to a sync template
            or

            has no overrides.
      required:
        - id
        - slug
        - workspaceId
        - createdAt
        - updatedAt
        - createdBy
        - updatedBy
        - destinationId
        - modelId
        - configuration
        - schedule
        - status
        - disabled
        - lastRunAt
        - referencedColumns
        - primaryKey
        - externalSegment
        - tags
        - syncTemplateId
        - syncTemplateOverrides
      type: object
      additionalProperties: false
    ValidateErrorJSON:
      properties:
        message:
          type: string
          enum:
            - Validation failed
          nullable: false
        details:
          properties: {}
          additionalProperties: {}
          type: object
      required:
        - message
        - details
      type: object
      additionalProperties: false
    InternalServerError:
      type: string
      enum:
        - Internal Server Error
      nullable: false
    IntervalSchedule:
      properties:
        interval:
          $ref: '#/components/schemas/Interval'
      required:
        - interval
      type: object
      additionalProperties: false
    CronSchedule:
      properties:
        expression:
          type: string
      required:
        - expression
      type: object
      additionalProperties: false
    VisualCronSchedule:
      properties:
        expressions:
          items:
            properties:
              days:
                $ref: '#/components/schemas/Record_Day.boolean-or-undefined_'
              time:
                type: string
            required:
              - days
              - time
            type: object
          type: array
      required:
        - expressions
      type: object
      additionalProperties: false
    DBTSchedule:
      properties:
        account:
          properties:
            id:
              type: string
          required:
            - id
          type: object
        job:
          properties:
            id:
              type: string
          required:
            - id
          type: object
      required:
        - account
        - job
      type: object
      additionalProperties: false
    UserReference:
      description: >-
        The Hightouch user who created or last updated a resource. Changes made
        with

        an API key are attributed to the user who created the key.
      properties:
        id:
          type: number
          format: double
          description: The user's id
        name:
          type: string
          description: The user's name
        email:
          type: string
          description: The user's email address
      required:
        - id
        - name
        - email
      type: object
      additionalProperties: false
    SyncStatus:
      description: SyncStatus
      enum:
        - disabled
        - pending
        - cancelled
        - failed
        - queued
        - success
        - warning
        - querying
        - processing
        - reporting
        - interrupted
      type: string
    Interval:
      properties:
        unit:
          $ref: '#/components/schemas/IntervalUnit'
        quantity:
          type: number
          format: double
      required:
        - unit
        - quantity
      type: object
      additionalProperties: false
    Record_Day.boolean-or-undefined_:
      properties:
        monday:
          type: boolean
        tuesday:
          type: boolean
        wednesday:
          type: boolean
        thursday:
          type: boolean
        friday:
          type: boolean
        saturday:
          type: boolean
        sunday:
          type: boolean
      type: object
      description: Construct a type with a set of properties K of type T
    IntervalUnit:
      enum:
        - minute
        - hour
        - day
        - week
      type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: Bearer

````