Skip to content

Sign-in and account

Sign an app in, read the signed-in account, and sign out.

OperationRequest
Get accountGET /v1/account
The caller's access historyGET /v1/account/access
Start app loginPOST /v1/device/code
Sign out appPOST /v1/device/sign-out
Poll app loginPOST /v1/device/token

Get account

GET /v1/account · getAccount

Existing account and current workspace memberships. Accepts app sess_ sessions, oa_sk_ sign-in keys, and account-bound oak_ API keys. Credential prefixes alone do not prove authorization.

Sign-in: a bearer credential in the Authorization header.

appBearer: A live app sess_ session or oa_sk_ sign-in key. Account-bound oak_ keys are accepted only where the operation declares them and their scopes permit it. API cookies are ignored.

Response

200 — The authenticated account.

Type: AppAccountView

FieldTypeRequiredDescription
valways "openagents.accounts.v1"No
accountAppAccountYes
account.idstringYes
account.labelstringYes
account.emailstring or nullNo
account.avatar_urlstring or nullNo
account.adminbooleanNo
workspacesarray of AppWorkspaceYes
workspaces[].idstringYes
workspaces[].namestringYes
workspaces[].kindstringYes
workspaces[].rolestringYes
workspaces[].tenantstringYes
workspaces[].seatsinteger or nullNo
workspaces[].membersintegerNo

Errors

StatusMeaningBody
401

Missing, expired, invalid, or revoked credential.

AppAccountError
403

Credential cannot act for an account.

AppAccountError
404

The account no longer exists.

AppAccountError
503

Account storage is unavailable.

AppAccountError

Example

curl 'https://api.openagents.com/v1/account' \
  -H "Authorization: Bearer $OPENAGENTS_TOKEN"

In the Rust SDK

The caller's access history

GET /v1/account/access · get-v1-account-access

Actor, action, workspace, session digest, and detail for the caller's own events. Secrets are redacted by construction — they are never in the store to begin with.

Sign-in: a bearer credential in the Authorization header.

bearer: An issued key: oak_<id>.<secret>. Omitted entirely for anonymous access to shared doors, which a require_workspace_membership deployment refuses outright.

Response

200 — The operation completed.

Type: object

Errors

StatusMeaningBody
400, 401, 403, 404, 409, 503

A typed refusal — see the refusal_codes map in docs/agents/api-catalog.json and the code table in docs/decision-models/service/gateway.md.

TypedError

Example

curl 'https://api.openagents.com/v1/account/access' \
  -H "Authorization: Bearer $OPENAGENTS_TOKEN"

Start app login

POST /v1/device/code · startAppLogin

Start signing an app in. Show the person the returned code and address, then poll for the session.

Sign-in: none needed.

Request body

Content type: application/json

Type: AppDeviceRequest

FieldTypeRequiredDescription
appstringNo

Default: "Coder".

computerstringYes

Response

200 — The app's result. Tokens and codes are returned only here; do not cache.

Type: AppDeviceGrant

FieldTypeRequiredDescription
device_codestringYes
user_codestringYes
verification_uristring (uri)Yes
verification_uri_completestring (uri)Yes
expires_inalways 600Yes
intervalalways 5Yes

Errors

StatusMeaningBody
400

Invalid request, pending, slow_down, denied, expired, or already redeemed grant.

AppOAuthError
503

Sign-in is temporarily unavailable.

AppOAuthError

Example

curl -X POST 'https://api.openagents.com/v1/device/code' \
  -H 'Content-Type: application/json' \
  -d '{
  "computer": "string"
}'

In the Rust SDK

Sign out app

POST /v1/device/sign-out · signOutApp

Revoke this app session. Already expired/revoked sessions are signed out. A sign-in key is a session too; revoking it here is not a local forget operation.

Sign-in: a bearer credential in the Authorization header.

appBearer: A live app sess_ session or oa_sk_ sign-in key. Account-bound oak_ keys are accepted only where the operation declares them and their scopes permit it. API cookies are ignored.

Response

200 — The app's result. Tokens and codes are returned only here; do not cache.

Type: AppSignedOut

FieldTypeRequiredDescription
signed_outalways trueYes

Errors

StatusMeaningBody
400

Invalid request, pending, slow_down, denied, expired, or already redeemed grant.

AppOAuthError
401

Invalid app credential.

AppOAuthError
503

Sign-in is temporarily unavailable.

AppOAuthError

Example

curl -X POST 'https://api.openagents.com/v1/device/sign-out' \
  -H "Authorization: Bearer $OPENAGENTS_TOKEN"

In the Rust SDK

Poll app login

POST /v1/device/token · pollAppLogin

Poll for the session of a sign-in you started. Wait the returned interval between polls.

Sign-in: none needed.

Request body

Content type: application/json

Type: AppDevicePoll

FieldTypeRequiredDescription
device_codestringYes
grant_typealways "urn:ietf:params:oauth:grant-type:device_code"No

Response

200 — The app's result. Tokens and codes are returned only here; do not cache.

Type: AppSession

FieldTypeRequiredDescription
access_tokenstringYes
token_typealways "Bearer"Yes
expires_inintegerYes
accountAppAccountYes
account.idstringYes
account.labelstringYes
account.emailstring or nullNo
account.avatar_urlstring or nullNo
account.adminbooleanNo

Errors

StatusMeaningBody
400

Invalid request, pending, slow_down, denied, expired, or already redeemed grant.

AppOAuthError
503

Sign-in is temporarily unavailable.

AppOAuthError

Example

curl -X POST 'https://api.openagents.com/v1/device/token' \
  -H 'Content-Type: application/json' \
  -d '{
  "device_code": "string"
}'

In the Rust SDK