curl -X POST "https://api.danubeai.com/v1/auth/device/code" \
-H "Content-Type: application/json" \
-d '{"client_name": "Claude Code"}'
{
"device_code": "dc_a1b2c3d4e5f6...",
"user_code": "ABCD-1234",
"verification_url": "https://danubeai.com/device",
"expires_in": 600,
"interval": 5
}
Device Auth
Create Device Code
Start the device authorization flow
POST
/
v1
/
auth
/
device
/
code
curl -X POST "https://api.danubeai.com/v1/auth/device/code" \
-H "Content-Type: application/json" \
-d '{"client_name": "Claude Code"}'
{
"device_code": "dc_a1b2c3d4e5f6...",
"user_code": "ABCD-1234",
"verification_url": "https://danubeai.com/device",
"expires_in": 600,
"interval": 5
}
Overview
Initiates the device authorization flow for CLI tools and AI agents that cannot open a browser directly. Returns a user code that must be entered at the verification URL to authorize the device. Flow:- Agent calls this endpoint to get a
device_codeanduser_code - User opens
verification_urlin their browser and enters theuser_code - Agent polls Poll Device Token with the
device_code - Once authorized, the poll returns an API key
Body Parameters
string
default:"Unknown Client"
Name of the client requesting authorization (shown to user during approval)
string
An organization id or slug. The minted key then belongs to that organization and acts for it without a
danube-org-id header; the user who authorizes the code must be a member, or the authorization is refused with 403. 404 when no organization matches. This is what danube login --org sends.Response
string
Opaque code for the agent to use when polling for the token
string
Human-readable code in
XXXX-XXXX format for the user to enterstring
URL where the user should enter the code
integer
Seconds until the device code expires (600 = 10 minutes)
integer
Minimum seconds between poll requests (5)
string
The organization the key will belong to, when the request named one; otherwise
nullstring
That organization’s display name, for showing the user what they are authorizing
Example
curl -X POST "https://api.danubeai.com/v1/auth/device/code" \
-H "Content-Type: application/json" \
-d '{"client_name": "Claude Code"}'
{
"device_code": "dc_a1b2c3d4e5f6...",
"user_code": "ABCD-1234",
"verification_url": "https://danubeai.com/device",
"expires_in": 600,
"interval": 5
}
Device Auth Flow
Agent User Danube
| | |
|-- POST /auth/device/code --->| |
|<-- device_code, user_code ---| |
| | |
| "Enter ABCD-1234 at URL" | |
|----------------------------->| |
| |-- Opens verification_url ->|
| |-- Enters user_code ------->|
| |<-- "Authorized!" ----------|
| | |
|-- POST /auth/device/token -->| |
|<-- api_key ------------------| |
