---
type: api
title: Claim a connector sync job
description: This action updates the job status to `in_progress` and sets the `last_seen` and `started_at` timestamps to the current time.
url: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/elasticsearch/v8/operation/operation-connector-sync-job-claim
resource: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/elasticsearch/v8/operation/operation-connector-sync-job-claim
products:
  - Elasticsearch
---

# Claim a connector sync job

Availability: Preview

## Paths

- `PUT` `/_connector/_sync_job/{connector_sync_job_id}/_claim`

#### Path parameters

- `connector_sync_job_id` (string) — required
  The unique identifier of the connector sync job.

## Description

This action updates the job status to `in_progress` and sets the `last_seen` and `started_at` timestamps to the current time.
Additionally, it can set the `sync_cursor` property for the sync job.

This API is not intended for direct connector management by users.
It supports the implementation of services that utilize the connector protocol to communicate with Elasticsearch.

To sync data using self-managed connectors, you need to deploy the Elastic connector service on your own infrastructure.
This service runs automatically on Elastic Cloud for Elastic managed connectors.

## Authentication

- Api key: `Authorization: <value>`
  Elasticsearch APIs support key-based authentication.
  You must create an API key and use the encoded value in the request header.
  For example:
  
  
  ```
  curl -X GET "${ES_URL}/_cat/indices?v=true" \
    -H "Authorization: ApiKey ${API_KEY}"
  ```
  
  To get API keys, use the `/_security/api_key` APIs.
- Basic: `Authorization: Basic <credentials>`
- Bearer: `Authorization: Bearer <token>`
  Elasticsearch APIs support the use of bearer tokens in the `Authorization` HTTP header to authenticate with the API.
  For examples, refer to [Token-based authentication services](https://www.elastic.co/guide/en/elasticsearch/reference/current/token-authentication-services.html)

## Request body

`application/json`

- `sync_cursor` (object) — optional
  The cursor object from the last incremental sync job.
This should reference the `sync_cursor` field in the connector state for which the job runs.
- `worker_hostname` (string) — required
  The host name of the current system that will run the job.

## Response

`application/json`

Type: `object`

## Code examples

#### Console

```console
PUT _connector/_sync_job/my-connector-sync-job-id/_claim
{
  "worker_hostname": "some-machine"
}
```

#### JavaScript

```javascript
const response = await client.connector.syncJobClaim({
  connector_sync_job_id: "my-connector-sync-job-id",
  worker_hostname: "some-machine",
});
```

#### Python

```python
resp = client.connector.sync_job_claim(
    connector_sync_job_id="my-connector-sync-job-id",
    worker_hostname="some-machine",
)
```

#### curl

```curl
curl -X PUT "$ELASTICSEARCH_URL/_connector/_sync_job/my-connector-sync-job-id/_claim" \
  -H "Authorization: ApiKey $ELASTIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "worker_hostname": "some-machine"
  }'
```

#### Java

```java
client.connector().syncJobClaim(s -> s
    .connectorSyncJobId("my-connector-sync-job-id")
    .workerHostname("some-machine")
);
```

#### PHP

```php
$resp = $client->connector()->syncJobClaim([
    "connector_sync_job_id" => "my-connector-sync-job-id",
    "body" => [
        "worker_hostname" => "some-machine",
    ],
]);
```

#### Ruby

```ruby
response = client.connector.sync_job_claim(
  connector_sync_job_id: "my-connector-sync-job-id",
  body: {
    "worker_hostname": "some-machine"
  }
)
```

