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

# Create a job in a workspace

> For Load Folder jobs, provide one complete Load Folder query in `queries`. The query destination is the target table, or the target topic when the destination is Kafka. `settings.kafka_default_topic` and Kafka-specific replicate options do not apply to Load Folder jobs. For non-Load-Folder, non-Reverse-ETL jobs with a Kafka destination, `replicate_options.enable_kafka_partitioning` defaults to `true` when omitted.



## OpenAPI

````yaml /26.4/en/rest-api/openapi-v2.json post /v2/workspaces/{workspace_id}/jobs
openapi: 3.0.3
info:
  title: CData Sync API
  description: >-
    REST API (v2) for CData Sync. The API lets you manage workspaces,
    connections, jobs, transformations, pipelines, and users, and to run and
    monitor data replication and transformation work.


    ## Base path

    All endpoints are served under the `/api.rsc` application path, e.g.
    `https://your-sync-host/api.rsc/v2/workspaces`.


    ## Authentication

    Requests are authenticated with an auth token passed in the
    `x-cdata-authtoken` header, or with HTTP Basic authentication using a Sync
    user's credentials. A token can be generated via `POST
    /v2/users/generate-token`.


    ## Response envelope

    Successful read/write responses return a JSON **array** of objects, even
    when a single resource is requested (the array then contains one element).
    `count` endpoints return an array containing a single `{ "count": <n> }`
    object. `DELETE` operations return `204 No Content`.


    ## Date/time format

    Date/time values are formatted as `yyyy-MM-dd'T'HH:mm:ssZZZ` (ISO-8601 with
    timezone offset). The format is also echoed in the `X-DateTime-Format`
    response header.


    ## Roles

    Most endpoints require the `cdata_user` role; workspace and user management
    endpoints require the `cdata_admin` role.
  version: '2.0'
servers:
  - url: '{baseUrl}'
    variables:
      baseUrl:
        default: https://sync.example.com/api.rsc/v2
        description: >-
          Base URL of your Sync instance, including scheme and application path
          (e.g. https://sync.example.com/api.rsc/v2).
security:
  - ApiKeyAuth: []
  - BasicAuth: []
tags:
  - name: Workspaces
    description: Manage workspaces and their child resources.
  - name: Connections
    description: Manage connections and inspect connection metadata.
  - name: Jobs
    description: Manage replication jobs, their tasks, history, and execution.
  - name: Transformations
    description: Manage transformations, their tasks, history, and execution.
  - name: Pipelines
    description: Manage pipelines, steps, events, history, and execution.
  - name: Users
    description: Manage users and generate auth tokens.
  - name: Vaults
    description: Manage vault registrations and the secrets stored in the Local vault.
  - name: Search
    description: Search accessible resources across workspaces.
paths:
  /v2/workspaces/{workspace_id}/jobs:
    parameters:
      - $ref: '#/components/parameters/WorkspaceId'
    post:
      tags:
        - Workspaces
      summary: Create a job in a workspace
      description: >-
        For Load Folder jobs, provide one complete Load Folder query in
        `queries`. The query destination is the target table, or the target
        topic when the destination is Kafka. `settings.kafka_default_topic` and
        Kafka-specific replicate options do not apply to Load Folder jobs. For
        non-Load-Folder, non-Reverse-ETL jobs with a Kafka destination,
        `replicate_options.enable_kafka_partitioning` defaults to `true` when
        omitted.
      operationId: createJob
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/JobInput'
      responses:
        '201':
          description: The requested resource.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Job'
        '400':
          $ref: '#/components/responses/BadRequest'
        '403':
          $ref: '#/components/responses/Forbidden'
components:
  parameters:
    WorkspaceId:
      name: workspace_id
      in: path
      required: true
      description: Workspace identifier.
      schema:
        type: string
  schemas:
    JobInput:
      type: object
      required:
        - name
        - type
        - source_connection
        - destination_connection
      properties:
        name:
          type: string
        type:
          type: string
          description: Job type (display name).
          enum:
            - Standard
            - Sync All
            - Load Folder
            - Reverse ETL
            - SQL Change Tracking
            - Oracle Flashback
            - Change Data Capture
        source_connection:
          $ref: '#/components/schemas/ConnectionReference'
        destination_connection:
          $ref: '#/components/schemas/ConnectionReference'
        queries:
          type: array
          description: >-
            Initial task queries. For a Load Folder job, provide a single
            complete Load Folder query whose destination identifies the target
            table or Kafka topic.
          items:
            type: string
        labels:
          type: array
          items:
            type: string
        pipeline_id:
          type: string
        schedule:
          $ref: '#/components/schemas/Schedule'
        settings:
          $ref: '#/components/schemas/JobSettings'
        replicate_options:
          $ref: '#/components/schemas/JobReplicateOptions'
        alerts:
          $ref: '#/components/schemas/Alerts'
        resync_options:
          $ref: '#/components/schemas/ResyncOptions'
        cdc_engine_settings:
          $ref: '#/components/schemas/CdcEngineSettings'
        pre_job_event:
          type: object
          properties:
            script:
              type: string
        post_job_event:
          type: object
          properties:
            script:
              type: string
    Job:
      type: object
      additionalProperties: false
      properties:
        id:
          type: string
        workspace_id:
          type: string
        name:
          type: string
        type:
          type: string
          enum:
            - Standard
            - Sync All
            - Load Folder
            - Reverse ETL
            - SQL Change Tracking
            - Oracle Flashback
            - Change Data Capture
        source_connection:
          $ref: '#/components/schemas/EntityRef'
        destination_connection:
          $ref: '#/components/schemas/EntityRef'
        schedule:
          $ref: '#/components/schemas/Schedule'
        replicate_options:
          $ref: '#/components/schemas/JobReplicateOptions'
        alerts:
          $ref: '#/components/schemas/Alerts'
        settings:
          $ref: '#/components/schemas/JobSettings'
        pre_job_event:
          $ref: '#/components/schemas/JobEventRef'
        post_job_event:
          $ref: '#/components/schemas/JobEventRef'
        cdc_engine_settings:
          $ref: '#/components/schemas/CdcEngineSettings'
        permissions:
          $ref: '#/components/schemas/Permissions'
        labels:
          type: array
          items:
            type: string
        license_state:
          type: string
        license_message:
          type: string
        pipeline_id:
          type: string
        last_run:
          $ref: '#/components/schemas/JobLastRun'
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    ConnectionReference:
      type: object
      description: References a connection by id or name. One of id or name is required.
      properties:
        id:
          type: string
        name:
          type: string
      minProperties: 1
    Schedule:
      type: object
      additionalProperties: false
      properties:
        enabled:
          type: boolean
        cron:
          type: string
        next_run_at:
          type: string
          format: date-time
          readOnly: true
    JobSettings:
      type: object
      additionalProperties: false
      properties:
        enable_parallel_processing:
          type: boolean
        worker_pool:
          type: integer
          default: 2
        verbosity:
          type: string
          enum:
            - None
            - Error
            - Info
            - Transfer
            - Verbose
        destination_schema:
          type: string
        automatic_job_retry:
          type: boolean
          default: true
        schema_strategy:
          type: string
        transfer_mode:
          type: string
          deprecated: true
          description: >-
            Deprecated compatibility field for Reverse ETL jobs. Use
            replicate_options.transfer_mode instead.
          enum:
            - InsertMode
            - UpsertMode
            - UpdateMode
            - DeleteMode
        kafka_default_topic:
          type: string
          description: >-
            Topic used with single-topic Kafka routing. Not applicable to Load
            Folder jobs, because their destination topic is stored in the task
            query.
    JobReplicateOptions:
      type: object
      additionalProperties: false
      properties:
        use_gmt_datetime:
          type: boolean
        truncate_table_data:
          type: boolean
        truncate_table_mode:
          type: string
          enum:
            - Delete
            - Truncate
          default: Delete
        drop_table:
          type: boolean
        auto_truncate_strings:
          type: boolean
        continue_on_error:
          type: boolean
        alter_schema:
          type: boolean
        command_timeout:
          type: integer
        deletion_behavior:
          type: string
        transfer_mode:
          type: string
          description: >-
            Reverse ETL jobs only. Values are matched case-insensitively and
            returned using the documented casing. When deletion_behavior is
            omitted, DeleteMode defaults it to HardDelete; the other modes
            default it to SkipDelete. TempTableMode is an internal engine mode
            and is not supported by this API.
          enum:
            - InsertMode
            - UpsertMode
            - UpdateMode
            - DeleteMode
        insert_mode:
          type: string
        history_mode:
          type: boolean
        include_replicated_column:
          type: boolean
          default: false
          description: >-
            Adds the _cdatasync_replicated timestamp column to destination
            tables when enabled.
        replicate_interval:
          type: integer
          default: 180
        replicate_interval_unit:
          type: string
        replicate_start_date:
          type: string
        snapshot_size:
          type: string
        skip_snapshot:
          type: string
        reset_strategy:
          type: string
        load_folder_file_name_pattern:
          type: string
        skip_formula_fields:
          type: boolean
        status_connection:
          type: string
        table_name_prefix:
          type: string
        table_name_suffix:
          type: string
        cache_schema:
          type: string
        additional_options:
          type: string
        snapshot_mode:
          type: string
        sync_id_source_column:
          type: string
        kafka_topic_routing_mode:
          type: string
          description: >-
            Kafka destinations only. Not applicable to Load Folder jobs, because
            their destination topic is stored in the task query.
        enable_kafka_partitioning:
          type: boolean
          description: >-
            Kafka destinations only. Uses the source table's single primary key
            as the Kafka message key. Tables without a primary key retain
            round-robin partitioning, and tables with multiple primary keys are
            not supported. Defaults to true when a Kafka destination job is
            created and the property is omitted. Existing jobs without the
            property remain false. Not applicable to Load Folder or Reverse ETL
            jobs.
    Alerts:
      type: object
      additionalProperties: false
      properties:
        send_email:
          type: boolean
        email_to:
          type: string
        email_subject:
          type: string
        email_error_only:
          type: boolean
    ResyncOptions:
      type: object
      properties:
        period:
          type: string
        replicate_start_date:
          type: string
        replicate_interval:
          type: integer
        replicate_interval_unit:
          type: string
        write_mode:
          type: string
    CdcEngineSettings:
      type: object
      additionalProperties: false
      description: >-
        Source CDC engine settings. Applicable fields depend on the source
        provider (PostgreSQL, Oracle, DB2 for i, etc.).
      properties:
        publication_name:
          type: string
          description: PostgreSQL.
        logical_replication_slot:
          type: string
          description: PostgreSQL.
        pluggable_database:
          type: string
          description: Oracle.
        journal_library:
          type: string
          description: DB2 for i (AS/400).
        journal_name:
          type: string
          description: DB2 for i (AS/400).
        source_schema:
          type: string
          description: DB2 for i (AS/400).
        additional_options:
          type: string
    EntityRef:
      type: object
      additionalProperties: false
      description: A lightweight reference to a related resource.
      properties:
        id:
          type: string
        name:
          type: string
        connector:
          type: string
          description: Present for connection references.
        error:
          type: string
          description: Populated if the reference could not be resolved.
    JobEventRef:
      type: object
      additionalProperties: false
      nullable: true
      properties:
        id:
          type: string
        script:
          type: string
        error:
          type: string
    Permissions:
      type: object
      additionalProperties: false
      properties:
        can_update:
          type: boolean
        can_delete:
          type: boolean
        can_execute:
          type: boolean
        can_remove:
          type: boolean
    JobLastRun:
      type: object
      additionalProperties: false
      nullable: true
      properties:
        run_start_date:
          type: string
          format: date-time
        status:
          type: string
        details:
          type: string
        records_affected:
          type: integer
        job_history_id:
          type: string
    Error:
      type: object
      additionalProperties: false
      properties:
        code:
          type: integer
          description: HTTP status code.
        message:
          type: string
          description: Short status message.
        error:
          type: string
          description: Detailed error description.
        error_code:
          type: string
          description: >-
            Stable Vault error category when the failure originated from a Vault
            operation.
          enum:
            - INVALID_REFERENCE
            - PROVIDER_NOT_FOUND
            - ITEM_NOT_FOUND
            - PROVIDER_UNAVAILABLE
            - AUTHENTICATION_FAILED
            - PERMISSION_DENIED
            - TYPE_MISMATCH
            - INVALID_REGISTRATION
            - READ_ONLY
            - UNKNOWN
        provider_id:
          type: string
          description: Vault provider identifier when safe and applicable.
        item_name:
          type: string
          description: Vault item name when safe and applicable.
  responses:
    BadRequest:
      description: The request was invalid.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Forbidden:
      description: The caller does not have permission to access this resource.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-cdata-authtoken
      description: A Sync user auth token. Generate one via POST /v2/users/generate-token.
    BasicAuth:
      type: http
      scheme: basic
      description: HTTP Basic authentication with a Sync user's username and API Token.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.