Sign-in
12 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.
Start a browser sign-in for the CLI, the desktop app or an AI agent with no CLI (device authorization, RFC 8628)#
/v1/auth/devicepublicNo key needed. How an AI agent with no CLI gets an API key, in three steps: (1) POST /v1/auth/device {"client": "agent", "name": "<optional, what you call yourself>"} answers {device_code, user_code, verification_uri, verification_uri_complete, interval, expires_in, token_url, agent_message}; keep device_code secret. (2) Give the person verification_uri_complete (or agent_message word for word): they open it, sign in or sign up free (Starter: $10 of usage, no card), see that an AI agent asked for access and which key it gets, and press Approve. (3) Poll POST /v1/auth/device/token {device_code} every interval seconds: 428 authorization_pending while waiting, 429 slow_down if too fast, 403 access_denied if denied, 410 expired_token after expires_in (600 s); 200 {api_key, org, email, plan, starter, message} once. Use the key as Authorization: Bearer <api_key>. The key is named "kosa8 AI agent: <name>", holds the approver's scopes without admin (an owner's: sandboxes:write, functions:deploy, keys:manage, audit:read), is bound to the approver, and can be revoked under API keys. Starts are limited per network (30 an hour).
clientrequired"cli" | "desktop" | "agent"namestringsource"cli_hint" | "cli_cloud"curl -s -X POST https://api.kosa8.com/v1/auth/device \ -H 'Content-Type: application/json' -d @body.json
The kosa8 CLI reports a Cloud hint shown or a --cloud handoff (anonymous; a key, if sent, adds the org). Allowed names and values only, body at most 512 bytes, rate-limited per network#
/v1/cli-eventspublicnamerequired"cloud_hint_shown" | "cloud_handoff" | "cloud_handoff_login"reason"gpu" | "too_big" | "parallel" | "no_local" | "share"cmd"run" | "sandbox_create"stage"started" | "completed" | "failed"signed_inbooleanosrequiredstringarchrequiredstringversionrequiredstringinstall_idrequiredstringcurl -s -X POST https://api.kosa8.com/v1/cli-events \ -H 'Content-Type: application/json' -d @body.json
Poll for the sign-in's API key: 428 authorization_pending, 429 slow_down, 403 access_denied, 410 expired_token; 200 once, then 410#
/v1/auth/device/tokenpublicdevice_coderequiredstringcurl -s -X POST https://api.kosa8.com/v1/auth/device/token \ -H 'Content-Type: application/json' -d @body.json
The sign-in a code belongs to (the /device page). Needs a person signed in to the dashboard, not an API key#
/v1/auth/device/pendingany keyuser_codequery · stringcurl -s -X GET https://api.kosa8.com/v1/auth/device/pending \ -H "Authorization: Bearer $KOSA8_API_KEY"
Approve: makes an API key named after the device for the approver. Dashboard session only#
/v1/auth/device/approvescope keys:manageuser_coderequiredstringcurl -s -X POST https://api.kosa8.com/v1/auth/device/approve \ -H "Authorization: Bearer $KOSA8_API_KEY" \ -H 'Content-Type: application/json' -d @body.json
Deny: the device's next poll gets 403 access_denied. Dashboard session only#
/v1/auth/device/denyany keyuser_coderequiredstringcurl -s -X POST https://api.kosa8.com/v1/auth/device/deny \ -H "Authorization: Bearer $KOSA8_API_KEY" \ -H 'Content-Type: application/json' -d @body.json
What the consent page shows for an OAuth authorization request (the query of /oauth/authorize). Dashboard session only#
/v1/oauth/authorizeany keyclient_idquery · stringredirect_uriquery · stringresponse_typequery · stringstatequery · stringcode_challengequery · stringcode_challenge_methodquery · stringscopequery · stringresourcequery · stringcurl -s -X GET https://api.kosa8.com/v1/oauth/authorize \ -H "Authorization: Bearer $KOSA8_API_KEY"
Approve: returns redirect_to, the client's redirect_uri with a 60-second, single-use code and the state. Dashboard session only#
/v1/oauth/authorize/approveany keyclient_idrequiredstringredirect_urirequiredstringresponse_typerequired"code"staterequiredstringcode_challengerequiredstringcode_challenge_methodrequired"S256"scopestringresourcestringscopesarray of stringcurl -s -X POST https://api.kosa8.com/v1/oauth/authorize/approve \ -H "Authorization: Bearer $KOSA8_API_KEY" \ -H 'Content-Type: application/json' -d @body.json
Deny: returns redirect_to with error=access_denied. Dashboard session only#
/v1/oauth/authorize/denyany keycurl -s -X POST https://api.kosa8.com/v1/oauth/authorize/deny \ -H "Authorization: Bearer $KOSA8_API_KEY" \ -H 'Content-Type: application/json' -d @body.json
Dynamic client registration (RFC 7591) for MCP clients. redirect_uris: https, http on localhost/127.0.0.1/[::1], or an app's own scheme; no fragments. Rate-limited per network#
/oauth/registerpublicredirect_urisrequiredarray of stringclient_namestringclient_uristringtoken_endpoint_auth_method"none" | "client_secret_post" | "client_secret_basic"grant_typesarray of "authorization_code" | "refresh_token"response_typesarray of "code"curl -s -X POST https://api.kosa8.com/oauth/register \ -H 'Content-Type: application/json' -d @body.json
OAuth 2.1 token endpoint (application/x-www-form-urlencoded): authorization_code with PKCE (code_verifier) and resource, or refresh_token. Access tokens last 1 h and work only at /mcp; refresh tokens last 30 days and rotate on every use (a reused one revokes the grant)#
/oauth/tokenpubliccurl -s -X POST https://api.kosa8.com/oauth/token
Token revocation (RFC 7009): a refresh token ends its grant, an access token only itself. 200 whether or not the token was known#
/oauth/revokepubliccurl -s -X POST https://api.kosa8.com/oauth/revoke