Creates an API key that works on this project only. The full key is in the response and is not shown again.
HTTP
POST /projects/{projectId}/api-keysAccess: Session token only. API keys get 403 with insufficient_scope.
Role: Project manager (organisation owners and admins are managers of every project).
Path parameters #
| Parameter | Description |
|---|---|
projectId | The id of the project. |
Request body #
JSON.
| Field | Type | Required | Description |
|---|---|---|---|
name | string | yes | A name to recognise the key by. At most 80 characters. |
scopes | list of string | yes | At least one of translations:read, translations:write, keys:write and projects:read. |
expiresInDays | integer | no | Days until the key expires, 1 to 3650. Without it the key does not expire, unless the organisation limits the lifetime of API keys: then it is required and at most that limit. |
JSON
{ "name": "CI", "scopes": ["projects:read", "keys:write", "translations:read"] }Response 201 #
The key is created.
JSON
{
"token": "ct_live_3f9a...7f3a",
"keys": [ ... ]
}Response fields #
| Field | Type | Description |
|---|---|---|
token | string | The full key. Store it now. |
keys | list of object | All keys of the project, as in List project keys. |
Errors #
| Status | error | When |
|---|---|---|
| 401 | unauthenticated | The token is missing or not valid. |
| 404 | not_found | The project does not exist in your organisation, you have no access to it, or projectId is not a UUID. |
| 403 | forbidden | You are a member of the project, but not a manager. |
| 422 | invalid_request | name is empty, scopes is empty or holds an unknown scope, or expiresInDays is not between 1 and 3650 or is exceeds_policy (the organisation limits the lifetime of API keys, see settings.security.apiKeyMaxDays). |
| 429 | rate_limited | Too many requests, see Rate limiting. |
See Errors for the error format.