API keys
9 endpoints at https://api.kosa8.com, sent with Authorization: Bearer $KOSA8_API_KEY. Generated from the API's own OpenAPI description, which a test holds to the router.
List keys (never secrets)#
GET
Responses/v1/api-keysscope keys:manage200401403
curl -s -X GET https://api.kosa8.com/v1/api-keys \ -H "Authorization: Bearer $KOSA8_API_KEY"
Create a key; the secret is shown once#
POST
JSON body/v1/api-keysscope keys:managenamerequiredstring—
scopesarray of string—
expires_in_sintegerMin 300. Max 31536000.
201400401403
curl -s -X POST https://api.kosa8.com/v1/api-keys \ -H "Authorization: Bearer $KOSA8_API_KEY" \ -H 'Content-Type: application/json' -d @body.json
Revoke a key now#
DELETE
Parameters/v1/api-keys/{id}scope keys:manageidrequiredpath · stringId
200401403404
curl -s -X DELETE https://api.kosa8.com/v1/api-keys/$SBX \ -H "Authorization: Bearer $KOSA8_API_KEY"
New key with the same name and scopes; the old one lives grace_s more#
POST
Parameters/v1/api-keys/{id}/rotatescope keys:manageidrequiredpath · stringId
grace_sintegerMin 0. Max 86400.
201401403404
curl -s -X POST https://api.kosa8.com/v1/api-keys/$SBX/rotate \ -H "Authorization: Bearer $KOSA8_API_KEY" \ -H 'Content-Type: application/json' -d @body.json
List capability tokens (never secrets): every one in the org with keys:manage, else the ones this key or person made#
GET
Parameters/v1/tokensany keyallquery · "1"Also the last day's revoked and expired ones
200401403
curl -s -X GET https://api.kosa8.com/v1/tokens \ -H "Authorization: Bearer $KOSA8_API_KEY"
Make a short-lived capability token (at most 24 h) limited to some scopes and, optionally, some sandboxes; the secret is shown once#
POST
/v1/tokensany keyA token holds only scopes its maker holds, from sandboxes:read, sandboxes:write and functions:invoke. With sandbox_ids it reaches only those sandboxes; with labels only sandboxes carrying every label, and a sandbox it creates gets them. A limited token answers 403 token_restricted on every other route. It stops when the key that made it is revoked, when its member leaves, and while the org is frozen. A token cannot make tokens.
JSON bodyscopesrequiredarray of "sandboxes:read" | "sandboxes:write" | "functions:invoke"—
sandbox_idsarray of stringSandboxes (sbx_…) of this org it may reach
labelsobjectLabels every sandbox it reaches must carry; it may create sandboxes, which get them
ttl_sintegerLifetime in seconds; default 3600 Min 60. Max 86400.
namestringMax length 64.
201400401403404429
curl -s -X POST https://api.kosa8.com/v1/tokens \ -H "Authorization: Bearer $KOSA8_API_KEY" \ -H 'Content-Type: application/json' -d @body.json
Revoke a capability token; it stops at once#
DELETE
Parameters/v1/tokens/{id}any keyidrequiredpath · stringId
200401403404
curl -s -X DELETE https://api.kosa8.com/v1/tokens/$SBX \ -H "Authorization: Bearer $KOSA8_API_KEY"
Apps connected through OAuth (Claude, ChatGPT, Codex, …): the org's with keys:manage, else your own#
GET
Responses/v1/oauth/grantsany key200401403
curl -s -X GET https://api.kosa8.com/v1/oauth/grants \ -H "Authorization: Bearer $KOSA8_API_KEY"
Disconnect an app: its access and refresh tokens stop at once#
DELETE
Parameters/v1/oauth/grants/{id}any keyidrequiredpath · stringId
200401403404
curl -s -X DELETE https://api.kosa8.com/v1/oauth/grants/$SBX \ -H "Authorization: Bearer $KOSA8_API_KEY"