LoguDocs
Open Logu

Agents · createDeviceCode

Start connecting an agent (device code)

POST /v1/device/code

No credentials: how a client without an API key gets one (logu login). client_name suggests the agent's name and client_kind (claude-code, codex, cli) lets the app suggest an existing agent of that kind; test: true asks for a test API key (lg_test_…, logu login --test). Returns a secret device_code for the client and a short user_code for the human, who opens verification_uri_complete (the app's /connect page), checks the code and approves it in a workspace. Then poll POST /v1/device/token. Codes expire in 10 minutes. Field names follow RFC 8628. Rate-limited per IP address.

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

Request body#

Content type application/json (required).

FieldTypeRequiredNotes
client_namestringoptional1–64 chars
client_kind"claude-code" | "codex" | "cli"optional
testbooleanoptional
{
  "client_name": "Claude Code on kevins-mac",
  "client_kind": "claude-code"
}

Example#

curl -s -X POST "https://api.logu.dev/v1/device/code" \
  -H "Content-Type: application/json" \
  -d '{"client_name":"Claude Code on kevins-mac","client_kind":"claude-code"}'

Responses#

200

The device code, the user code and where the human approves it.

{
  "device_code": "GmRhmhcxhwAzkoEqiMEg_DnyEysNkuNhszIySk9eS",
  "user_code": "WDJB-MJHT",
  "verification_uri": "https://logu.dev/connect",
  "verification_uri_complete": "https://logu.dev/connect?code=WDJB-MJHT",
  "expires_in": 600,
  "interval": 5
}
Response fields
FieldTypeRequiredNotes
device_codestringrequired
user_codestringrequired
verification_uristringrequired
verification_uri_completestringrequired
expires_inintegerrequired
intervalintegerrequired

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).
429rate_limitedThis API key sent too many requests, or a human did too much too fast: sign-in attempts, workspaces created in a day, or a global daily cap on new accounts was reached.
500internal_errorSomething went wrong on Logu's side.