Create an API key
POST/v2/api_keys
Creates an API key. You can bind the key to one or more corpora. A personal key has the same permissions as its owner; any other key carries exactly the roles assigned to it with api_roles, corpus_roles, and agent_roles.
Callers with the corpus_administrator, administrator, or owner role create any API key. Callers holding only other roles must set api_key_role to personal. Only a user can create a personal API key; a request authenticated with a machine credential — an API key, app client, or service account — receives a 403 error.
For more information about the different types of API keys, see API Key Management.
Request
Responses
- 201
- 400
- 403
The response includes the assigned API key ID, name, secret key, enabled status, API key role, and API policy.
API key creation request was malformed.
The caller's roles do not allow creating this API key. Callers that hold none of the corpus_administrator, administrator, or owner roles may only create a personal key, and machine credentials — API keys, app clients, and service accounts — may not create personal keys at all.