---
type: api
title: Set a connector sync job error
description: Set the `error` field for a connector sync job and set its `status` to `error`.
url: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/elasticsearch/v9/operation/operation-connector-sync-job-error
resource: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/elasticsearch/v9/operation/operation-connector-sync-job-error
products:
  - Elasticsearch
---

# Set a connector sync job error

Availability: Experimental

## Paths

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

#### Path parameters

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

## Description

Set the `error` field for a connector sync job and set its `status` to `error`.

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/docs/deploy-manage/users-roles/cluster-or-deployment-auth/token-based-authentication-services)

## Request body

`application/json`

- `error` (string) — required
  The error for the connector sync job error field.

## Response

`application/json`

Type: `object`

## Code examples

#### Console

```console
PUT _connector/_sync_job/my-connector-sync-job/_error
{
    "error": "some-error"
}
```

#### JavaScript

```javascript
const response = await client.connector.syncJobError({
  connector_sync_job_id: "my-connector-sync-job",
  error: "some-error",
});
```

#### Python

```python
resp = client.connector.sync_job_error(
    connector_sync_job_id="my-connector-sync-job",
    error="some-error",
)
```

#### curl

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

#### Java

```java
client.connector().syncJobError(s -> s
    .connectorSyncJobId("my-connector-sync-job")
    .error("some-error")
);
```

#### PHP

```php
$resp = $client->connector()->syncJobError([
    "connector_sync_job_id" => "my-connector-sync-job",
    "body" => [
        "error" => "some-error",
    ],
]);
```

#### Ruby

```ruby
response = client.connector.sync_job_error(
  connector_sync_job_id: "my-connector-sync-job",
  body: {
    "error": "some-error"
  }
)
```

