---
type: api
title: Create or update a connector
description: **All methods and paths for this operation:**
url: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch/v8/operation/operation-connector-put
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch/v8/operation/operation-connector-put
products:
  - Elasticsearch
---

# Create or update a connector


Availability: 8.12+

## Paths

- `PUT` `/_connector/{connector_id}`
- `PUT` `/_connector`

- [Api key auth](/elastic/docs-builder/docs/4371/api/doc/elasticsearch/v8/authentication#apikeyauth)
- [Basic auth](/elastic/docs-builder/docs/4371/api/doc/elasticsearch/v8/authentication#basicauth)
- [Bearer auth](/elastic/docs-builder/docs/4371/api/doc/elasticsearch/v8/authentication#bearerauth)

#### Path Parameters

- `connector_id` (string Id) — optional, leave it out to use `/_connector`
  The unique identifier of the connector to be created or updated. ID is auto-generated if not provided.

## Request Body

`application/json`

- `description` (string) — optional
- `index_name` (string IndexName) — optional
- `is_native` (boolean) — optional
- `language` (string) — optional
- `name` (string) — optional
- `service_type` (string) — optional

## Response

`application/json`

- `result` (enum Result)
  Values: `created`, `updated`, `deleted`, `not_found`, `noop`
- `id` (string Id)
## Code Examples

#### Console

```console
PUT _connector/my-connector
{
  "index_name": "search-google-drive",
  "name": "My Connector",
  "service_type": "google_drive"
}
```

#### JavaScript

```javascript
const response = await client.connector.put({
  connector_id: "my-connector",
  index_name: "search-google-drive",
  name: "My Connector",
  service_type: "google_drive",
});
```

#### Python

```python
resp = client.connector.put(
    connector_id="my-connector",
    index_name="search-google-drive",
    name="My Connector",
    service_type="google_drive",
)
```

#### curl

```curl
curl -X PUT "$ELASTICSEARCH_URL/_connector/my-connector" \
  -H "Authorization: ApiKey $ELASTIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "index_name": "search-google-drive",
    "name": "My Connector",
    "service_type": "google_drive"
  }'
```

#### Java

```java
client.connector().put(p -> p
    .connectorId("my-connector")
    .indexName("search-google-drive")
    .name("My Connector")
    .serviceType("google_drive")
);
```

#### PHP

```php
$resp = $client->connector()->put([
    "connector_id" => "my-connector",
    "body" => [
        "index_name" => "search-google-drive",
        "name" => "My Connector",
        "service_type" => "google_drive",
    ],
]);
```

#### Ruby

```ruby
response = client.connector.put(
  connector_id: "my-connector",
  body: {
    "index_name": "search-google-drive",
    "name": "My Connector",
    "service_type": "google_drive"
  }
)
```

## Response Examples

#### Connector put response example1

```json
{
  "result": "created",
  "id": "my-connector"
}
```

