Skip to Content
CosmicAC Logo
API referenceApp node API

API key routes

Create, list and revoke API keys.

/v1/api-keys

GET
/v1/api-keys

Requires team capability apikeys.read. Acts on the team in the X-Team-Id header. If omitted, the caller's only team membership is used.

Authorization

ttrToken
headerttr-token<token>

Session token issued by sign-in. Sent as the ttr-token header.

Query Parameters

limit?integer
Range1 <= value <= 100
offset?integer
Range0 <= value
status?string
Value in"active""revoked""all"
sort?string

Header Parameters

x-team-id?string

Team to act on. Required only when the caller belongs to more than one team.

Response Body

Default Response

Example Request
curl -X GET 'https://your-app-node-url/v1/api-keys' \  -H 'ttr-token: <session-token>'
Example Response200
Empty

/v1/api-keys

POST
/v1/api-keys

Requires team capability apikeys.write. Acts on the team in the X-Team-Id header. If omitted, the caller's only team membership is used.

Authorization

ttrToken
headerttr-token<token>

Session token issued by sign-in. Sent as the ttr-token header.

Header Parameters

x-team-id?string

Team to act on. Required only when the caller belongs to more than one team.

Request Body

application/json
  1. body
name*string
Lengthlength <= 255
expiry_at?integer

Response Body

Default Response

Example Request
curl -X POST 'https://your-app-node-url/v1/api-keys' \  -H 'ttr-token: <session-token>' \  -H 'Content-Type: application/json' \  -d '{  "name": "string"}'
Example Response200
Empty

/v1/api-keys/usage

GET
/v1/api-keys/usage

Requires team capability apikeys.read. Acts on the team in the X-Team-Id header. If omitted, the caller's only team membership is used.

Authorization

ttrToken
headerttr-token<token>

Session token issued by sign-in. Sent as the ttr-token header.

Query Parameters

api_key_id?string
ts_start?integer
ts_end?integer
granularity?string
Value in"hour""day""week""month"

Header Parameters

x-team-id?string

Team to act on. Required only when the caller belongs to more than one team.

Response Body

Default Response

Example Request
curl -X GET 'https://your-app-node-url/v1/api-keys/usage' \  -H 'ttr-token: <session-token>'
Example Response200
Empty

/v1/api-keys/{id}

GET
/v1/api-keys/{id}

Requires team capability apikeys.read. Acts on the team in the X-Team-Id header. If omitted, the caller's only team membership is used.

Authorization

ttrToken
headerttr-token<token>

Session token issued by sign-in. Sent as the ttr-token header.

Path Parameters

id*string

Header Parameters

x-team-id?string

Team to act on. Required only when the caller belongs to more than one team.

Response Body

Default Response

Example Request
curl -X GET 'https://your-app-node-url/v1/api-keys/string' \  -H 'ttr-token: <session-token>'
Example Response200
Empty

/v1/api-keys/{id}

PATCH
/v1/api-keys/{id}

Requires team capability apikeys.write. Acts on the team in the X-Team-Id header. If omitted, the caller's only team membership is used.

Authorization

ttrToken
headerttr-token<token>

Session token issued by sign-in. Sent as the ttr-token header.

Path Parameters

id*string

Header Parameters

x-team-id?string

Team to act on. Required only when the caller belongs to more than one team.

Request Body

application/json
  1. body
name*string
Lengthlength <= 255

Response Body

Default Response

Example Request
curl -X PATCH 'https://your-app-node-url/v1/api-keys/string' \  -H 'ttr-token: <session-token>' \  -H 'Content-Type: application/json' \  -d '{  "name": "string"}'
Example Response200
Empty

/v1/api-keys/{id}

DELETE
/v1/api-keys/{id}

Requires team capability apikeys.write. Acts on the team in the X-Team-Id header. If omitted, the caller's only team membership is used.

Authorization

ttrToken
headerttr-token<token>

Session token issued by sign-in. Sent as the ttr-token header.

Path Parameters

id*string

Header Parameters

x-team-id?string

Team to act on. Required only when the caller belongs to more than one team.

Response Body

Default Response

Example Request
curl -X DELETE 'https://your-app-node-url/v1/api-keys/string' \  -H 'ttr-token: <session-token>'
Example Response200
Empty
POST
/v1/admin/api-keys/backfill-team

Requires platform admin.

Authorization

ttrToken
headerttr-token<token>

Session token issued by sign-in. Sent as the ttr-token header.

Request Body

application/json
  1. body
teamId?string
Length1 <= length
dryRun?boolean
keyIds?array<>
Items1 <= items <= 500

Response Body

Default Response

Example Request
curl -X POST 'https://your-app-node-url/v1/admin/api-keys/backfill-team' \  -H 'ttr-token: <session-token>' \  -H 'Content-Type: application/json' \  -d '{}'
Example Response200
Empty