LoguDocs
Open Logu

Agents · pollDeviceToken

Poll for the connected agent's API key

POST /v1/device/token

No credentials. While the human hasn't decided: 400 authorization_pending (poll again after interval seconds) or slow_down (polled too soon: add 5 seconds to the interval). 403 access_denied when the human cancelled; 400 expired_token when the code expired or its API key was already delivered. On approval: the new agent's API key, returned exactly once.

Who may call it
Anyone (no credentials)
Server
https://api.logu.dev

Request body#

Content type application/json (required).

FieldTypeRequiredNotes
device_codestringrequired1–200 chars
{
  "device_code": "GmRhmhcxhwAzkoEqiMEg_DnyEysNkuNhszIySk9eS"
}

Example#

curl -s -X POST "https://api.logu.dev/v1/device/token" \
  -H "Content-Type: application/json" \
  -d '{"device_code":"GmRhmhcxhwAzkoEqiMEg_DnyEysNkuNhszIySk9eS"}'

Responses#

200

The API key (lg_…), its agent and workspace. Shown this once.

{
  "api_key": "lg_8fK2xQp3R7vT9wY1zA4cD6eG8hJ0kL2m",
  "agent": {
    "id": "agt_01K7D8F2H4K6M8P0R2T4V6X8Z0",
    "name": "Claude Code on kevins-mac"
  },
  "workspace": {
    "id": "wsp_Xq3bY7tLmN2pR8sV",
    "name": "Ana"
  }
}
Response fields
FieldTypeRequiredNotes
api_keystringrequired
agentAgentRefrequired
agent.idstringrequired
agent.namestringrequired
workspaceobjectrequired
workspace.idstringrequired
workspace.namestringrequired

Errors#

Every error is {"error":{"code","message","hint","docUrl","requestId"}}: branch on code. See Errors.

StatusCodeMeaning
400bad_requestThe request is malformed or a field is invalid (see issues).
400unknown_fieldThe body has a field the endpoint doesn't know (often a typo or snake_case).
400authorization_pendingThe device code is waiting for a human to approve it in the app (POST /v1/device/token).
400slow_downThe device code was polled faster than its interval.
400expired_tokenThe device code expired (10 minutes) or was already used to get its API key.
403access_deniedThe human denied the device code in the app.
500internal_errorSomething went wrong on Logu's side.