Creates a new API key and returns it with the plaintext token. The token is only returned once — store it securely, as it cannot be retrieved again.
Kinds and required fields:
personal — created for the authenticated user. No additional fields required.team — scoped to a team (group). Requires group_id. A service account is automatically created with permissions derived from group membership.organization — organization-wide access. Requires owner or admin role. Optionally set role_id and on_call_role_id to control the service account’s permissions.Expiration: All keys require an expires_at date set in the future (maximum 5 years). Names must be unique within their kind and scope.
curl --request POST \
--url https://api.rootly.com/v1/api_keys \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/vnd.api+json' \
--data '
{
"data": {
"type": "api_keys",
"attributes": {
"name": "<string>",
"kind": "personal",
"expires_at": "2023-11-07T05:31:56Z",
"description": "<string>",
"group_id": "<string>",
"role_id": "<string>",
"on_call_role_id": "<string>"
}
}
}
'{
"data": {
"id": "<string>",
"type": "api_keys",
"attributes": {
"name": "<string>",
"kind": "personal",
"created_at": "<string>",
"updated_at": "<string>",
"token": "<string>",
"description": "<string>",
"role_id": "<string>",
"on_call_role_id": "<string>",
"expires_at": "<string>",
"last_used_at": "<string>",
"grace_period_ends_at": "<string>"
}
}
}Was this page helpful?
curl --request POST \
--url https://api.rootly.com/v1/api_keys \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/vnd.api+json' \
--data '
{
"data": {
"type": "api_keys",
"attributes": {
"name": "<string>",
"kind": "personal",
"expires_at": "2023-11-07T05:31:56Z",
"description": "<string>",
"group_id": "<string>",
"role_id": "<string>",
"on_call_role_id": "<string>"
}
}
}
'{
"data": {
"id": "<string>",
"type": "api_keys",
"attributes": {
"name": "<string>",
"kind": "personal",
"created_at": "<string>",
"updated_at": "<string>",
"token": "<string>",
"description": "<string>",
"role_id": "<string>",
"on_call_role_id": "<string>",
"expires_at": "<string>",
"last_used_at": "<string>",
"grace_period_ends_at": "<string>"
}
}
}