Update connector API key ID API
This functionality is in beta and is subject to change. The design and code is less mature than official GA features and is being provided as-is with no warranties. Beta features are not subject to the support SLA of official GA features.
Updates the api_key_id and/or api_key_secret_id field(s) of a connector, specifying:
- The ID of the API key used for authorization
- The ID of the Connector Secret where the API key is stored
The Connector Secret ID is only required for Elastic managed connectors. Self-managed connectors do not use this field. See the documentation for programmatically managed connector API keys for more details.
To get started with Connector APIs, check out our tutorial.
Request
PUT _connector/<connector_id>/_api_key_id
Prerequisites
- 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.
- The
connector_idparameter should reference an existing connector. - The
api_key_idparameter should reference an existing API key. - The
api_key_secret_idparameter should reference an existing Connector Secret containing an encoded API key value.
Path parameters
-
<connector_id> - (Required, string)
Request body
-
api_key_id - (Optional, string) ID of the API key that the connector will use to authorize access to required indices. Each connector can be associated with at most one API key.
-
api_key_secret_id - (Optional, string) ID of the Connector Secret that contains the encoded API key. This should be the same API key as
api_key_idreferences. This is only required for Elastic managed connectors.
Response codes
-
200 - Connector
api_key_idand/orapi_key_secret_idfield(s) successfully updated. -
400 - The
connector_idwas not provided or the request payload was malformed. -
404(Missing resources) - No connector matching
connector_idcould be found.
Examples
The following example updates the api_key_id and api_key_secret_id field(s) for the connector with ID my-connector:
resp = client.connector.update_api_key_id(
connector_id="my-connector",
api_key_id="my-api-key-id",
api_key_secret_id="my-connector-secret-id",
)
print(resp) response = client.connector.update_api_key_id(
connector_id: 'my-connector',
body: {
api_key_id: 'my-api-key-id',
api_key_secret_id: 'my-connector-secret-id'
}
)
puts response const response = await client.connector.updateApiKeyId({
connector_id: "my-connector",
api_key_id: "my-api-key-id",
api_key_secret_id: "my-connector-secret-id",
});
console.log(response); PUT _connector/my-connector/_api_key_id
{
"api_key_id": "my-api-key-id",
"api_key_secret_id": "my-connector-secret-id"
} {
"result": "updated"
}
© 2023-2025 Elasticsearch
As of September 2024, Elasticsearch is available under a choice of three licenses: the Server Side Public License (SSPL), the Elastic License, or the AGPLv3 (OSI approved).
Elasticsearch and the Elasticsearch logo are trademarks of Elasticsearch B.V., registered in the U.S. and in other countries.
https://www.elastic.co/guide/en/elasticsearch/reference/8.17/update-connector-api-key-id-api.html