API keys
10 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)#
/v1/api-keysscope keys:managecurl -s -X GET https://api.kosa8.com/v1/api-keys \ -H "Authorization: Bearer $KOSA8_API_KEY"
Create a key; the secret is shown once#
/v1/api-keysscope keys:managenamerequiredstringscopesarray of stringexpires_in_sintegercurl -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#
/v1/api-keys/{id}scope keys:manageidrequiredpath · stringcurl -s -X DELETE https://api.kosa8.com/v1/api-keys/$SBX \ -H "Authorization: Bearer $KOSA8_API_KEY"
Change a live key's name, scopes or end date in place; its secret stays the same#
/v1/api-keys/{id}scope keys:manageYou must hold every scope the key has and every scope you give it; only an owner changes the organization's own admin key or an owner's key. A key made for a member gets at most that member's role (400 beyond_role). expires_in_s counts from now; null removes the end date. The answer has the key and, as previous, what it was; recorded as key.update in the audit log.
Parametersidrequiredpath · stringnamestringscopesarray of stringexpires_in_sinteger | nullcurl -s -X PATCH https://api.kosa8.com/v1/api-keys/$SBX \ -H "Authorization: Bearer $KOSA8_API_KEY" \ -H 'Content-Type: application/json' -d @body.json
New key with the same name and scopes; the old one lives grace_s more#
/v1/api-keys/{id}/rotatescope keys:manageidrequiredpath · stringgrace_sintegercurl -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#
/v1/tokensany keyallquery · "1"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#
/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 stringlabelsobjectttl_sintegernamestringcurl -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#
/v1/tokens/{id}any keyidrequiredpath · stringcurl -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#
/v1/oauth/grantsany keycurl -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#
/v1/oauth/grants/{id}any keyidrequiredpath · stringcurl -s -X DELETE https://api.kosa8.com/v1/oauth/grants/$SBX \ -H "Authorization: Bearer $KOSA8_API_KEY"