curl \
-X PATCH 'MEILISEARCH_URL/keys/6062abda-a5aa-4414-ac91-ecd7944c0f8d' \
-H 'Authorization: Bearer MASTER_KEY' \
-H 'Content-Type: application/json' \
--data-binary '{
"name": "Products/Reviews API key",
"description": "Manage documents: Products/Reviews API key"
}'{
"uid": "01b4bc42-eb33-4041-b481-254d00cce834",
"key": "d0552b41536279a0ad88bd595327b96f01176a60c2243e906c52ac02375f9bc4",
"name": "An API Key",
"description": null,
"actions": [
"documents.add"
],
"indexes": [
"movies"
],
"expiresAt": "2022-11-12T10:00:00Z",
"createdAt": "2021-11-12T10:00:00Z",
"updatedAt": "2021-11-12T10:00:00Z"
}{
"message": "The Authorization header is missing. It must use the bearer authorization method.",
"code": "missing_authorization_header",
"type": "auth",
"link": "https://docs.meilisearch.com/errors#missing_authorization_header"
}{
"message": "The API key was not found.",
"code": "api_key_not_found",
"type": "invalid_request",
"link": "https://docs.meilisearch.com/errors#api_key_not_found"
}Update API key
Update the name and description of an API key.
Updates are partial: only the fields you send are changed, and any fields not present in the payload remain unchanged.
Note: Only name and description can be updated. The fields actions, indexes,
expiresAt, and uid cannot be modified after key creation.
curl \
-X PATCH 'MEILISEARCH_URL/keys/6062abda-a5aa-4414-ac91-ecd7944c0f8d' \
-H 'Authorization: Bearer MASTER_KEY' \
-H 'Content-Type: application/json' \
--data-binary '{
"name": "Products/Reviews API key",
"description": "Manage documents: Products/Reviews API key"
}'{
"uid": "01b4bc42-eb33-4041-b481-254d00cce834",
"key": "d0552b41536279a0ad88bd595327b96f01176a60c2243e906c52ac02375f9bc4",
"name": "An API Key",
"description": null,
"actions": [
"documents.add"
],
"indexes": [
"movies"
],
"expiresAt": "2022-11-12T10:00:00Z",
"createdAt": "2021-11-12T10:00:00Z",
"updatedAt": "2021-11-12T10:00:00Z"
}{
"message": "The Authorization header is missing. It must use the bearer authorization method.",
"code": "missing_authorization_header",
"type": "auth",
"link": "https://docs.meilisearch.com/errors#missing_authorization_header"
}{
"message": "The API key was not found.",
"code": "api_key_not_found",
"type": "invalid_request",
"link": "https://docs.meilisearch.com/errors#api_key_not_found"
}Authorizations
An API key is a token that you provide when making API calls. Read more about how to secure your project.
Include the API key to the Authorization header, for instance:
-H 'Authorization: Bearer 6436fc5237b0d6e0d64253fbaac21d135012ecf1'
If you use a SDK, ensure you instantiate the client with the API key, for instance with JS SDK:
const client = new MeiliSearch({
host: 'MEILISEARCH_URL',
apiKey: '6436fc5237b0d6e0d64253fbaac21d135012ecf1'
});
Body
Request body for updating an existing API key. Only the name and description can be modified - other properties like actions, indexes, and expiration are immutable after creation.
Response
The key has been updated.
Represents an API key used for authenticating requests to Meilisearch. Each key has specific permissions defined by its actions and can be scoped to particular indexes. Keys provide fine-grained access control for your Meilisearch instance.
The list of actions (permissions) this key is allowed to perform.
Examples include documents.add, search, indexes.create,
settings.update, etc. Use * to grant all permissions.
*, search, documents.*, documents.add, documents.get, documents.delete, indexes.*, indexes.create, indexes.get, indexes.update, indexes.delete, indexes.swap, tasks.*, tasks.cancel, tasks.delete, tasks.get, settings.*, settings.get, settings.update, stats.*, stats.get, metrics.*, metrics.get, dumps.*, dumps.create, snapshots.*, snapshots.create, version, keys.create, keys.get, keys.update, keys.delete, experimental.get, experimental.update, export, network.get, network.update, chatCompletions, chats.*, chats.get, chats.delete, chatsSettings.*, chatsSettings.get, chatsSettings.update, *.get, webhooks.get, webhooks.update, webhooks.delete, webhooks.create, webhooks.*, indexes.compact, fields.post, tasks.compact, dynamicSearchRules.get, dynamicSearchRules.create, dynamicSearchRules.update, dynamicSearchRules.delete, dynamicSearchRules.*