POST/api/v1/projects/{project_id}/keys
create_api_key
Creates an API key of a project with the scopes it needs: read, write, send, keys.
- Call it
- to give an integration or another agent the least access it needs.
- Needs
- an admin key with
project_id, or a project key with scopekeys, which works in its own project (itsproject_idargument is ignored) and grants only scopes it holds and no later expiry than its own. - Returns
- the key with
key, the key string, shown this once and never again: hand it to its user now. The same asPOST /api/v1/projects/{project_id}/keys.
Arguments
- object
-
namestringrequiredWhat the key is for: 1 to 128 characters.
example
billing backend -
scopesarray of stringrequiredWhat the key may do: one or more of
read,write,send,keys, each once. A project key grants only scopes it holds itself.example
["read","write"] -
expires_atstring · date-time | nullWhen the key stops working, RFC 3339, later than now; null or left out: never. A project key that expires grants no later expiry.
example
2027-01-01T00:00:00Z -
project_idstring · uuid | nullThe project to create the key in. An admin key must pass it; a project key’s own project is used and this is ignored.
No other arguments are accepted.
Result
The result comes back as structuredContent, with the same JSON as a text block.
- object · all fields required
-
created_atstring · date-time -
expires_atstring · date-time | null -
idstring · uuid -
keystringThe key string to send as
Authorization: Bearer. It is not stored and no other call shows it: hand it to its user now. -
kindKeyKindThe kind of an API key.
adminEverything, projects and admin keys included.projectOne project, within its scopes. -
last_used_atstring · date-time | null -
namestring -
prefixstring -
project_idstring · uuid | null -
revoked_atstring · date-time | null -
scopesarray of KeyScope
Definitions
KeyKind
The kind of an API key.
string · enum
admin Everything, projects and admin keys included.
project One project, within its scopes.
KeyScope
A right of a project key. An admin key has all of them.
string · enum
- read
- write
- send
- keys
Errors
A failed call answers isError: true with a code from the same table as the HTTP API, and detail. How tools report errors
HTTP API
The same operation over HTTP: POST /api/v1/projects/{project_id}/keys