Start device authorization flow (CLI login step 1)
Returns a short-lived device code and a user code. The CLI opens the verification URL with the user code pre-filled and polls /device/token until the user authorizes in their browser.
POST
/api/v1/device/code
Returns a short-lived device code and a user code. The CLI opens the verification URL with the user code pre-filled and polls /device/token until the user authorizes in their browser.
Request Body
application/jsonclient_name
string
scope
string
Enum:
writeResponses
200
Device + user code issued
application/jsondevice_code
string
REQUIRED
user_code
string
REQUIRED
verification_uri
string
REQUIRED
verification_uri_complete
string
REQUIRED
expires_in
number
REQUIRED
interval
number
REQUIRED
429
Rate limited
curl -X POST 'https://littledemo.com/api/v1/device/code' \ -H 'Authorization: Bearer YOUR_API_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "client_name": "string", "scope": "write"}'
const response = await fetch('https://littledemo.com/api/v1/device/code', { method: 'POST', headers: { "Authorization": "Bearer YOUR_API_TOKEN", "Content-Type": "application/json" }, body: JSON.stringify({ "client_name": "string", "scope": "write" })});const data = await response.json();console.log(data);
import requestsheaders = { 'Authorization': 'Bearer YOUR_API_TOKEN'}response = requests.post('https://littledemo.com/api/v1/device/code', headers=headers, json={ "client_name": "string", "scope": "write"})print(response.json())
200
Response
{ "device_code": "<string>", "user_code": "<string>", "verification_uri": "<string>", "verification_uri_complete": "<string>", "expires_in": 123, "interval": 123}
API Playground
Try this endpoint
POST
/api/v1/device/code