[[create-connector-sync-job-api]]
=== Create connector sync job API
++++
<titleabbrev>Create connector sync job</titleabbrev>
++++

Creates a connector sync job.

[source, console]
--------------------------------------------------
POST _connector/_sync_job
{
  "id": "connector-id",
  "job_type": "full",
  "trigger_method": "on_demand"
}
--------------------------------------------------
// TEST[skip:there's no way to clean up after this code snippet, as we don't know the id ahead of time]


[[create-connector-sync-job-api-request]]
==== {api-request-title}
`POST _connector/_sync_job`


[[create-connector-sync-job-api-prereqs]]
==== {api-prereq-title}

* To sync data using connectors, it's essential to have the Elastic connectors service running.
* The `id` parameter should reference an existing connector.

[[create-connector-sync-job-api-desc]]
==== {api-description-title}

Creates a connector sync job document in the internal index and initializes its counters and timestamps with default values.
Certain values can be updated via the API.

[role="child_attributes"]
[[create-connector-sync-job-api-request-body]]
==== {api-request-body-title}

`id`::
(Required, string) The id of the connector to create the sync job for.

`job_type`::
(Optional, string) The job type of the created sync job. Defaults to `full`.

`trigger_method`::
(Optional, string) The trigger method of the created sync job. Defaults to `on_demand`.


[role="child_attributes"]
[[create-connector-sync-job-api-response-body]]
==== {api-response-body-title}

`id`::
(string) The ID associated with the connector sync job document.

[[create-connector-sync-job-api-response-codes]]
==== {api-response-codes-title}

`201`::
Indicates that the connector sync job was created successfully.

`400`::
Indicates that the request was malformed.

`404`::
Indicates that either the index or the referenced connector is missing.
