> ## Documentation Index
> Fetch the complete documentation index at: https://docs.littledemo.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 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 `

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.

## Servers

- ` https://littledemo.com ` — Production

## Request body (optional)

Content type: ` application/json `

- ` value `: type ` object `

  - ` client_name `: type ` string `

    - minLength: ` 1 `

    - maxLength: ` 100 `

  - ` scope `: type ` string `

    - enum: ` ["write"] `

## Responses

### ` 200 ` — Device + user code issued

Content type: ` application/json `

- ` value `: type ` object `

  - Required fields: ` device_code `, ` user_code `, ` verification_uri `, ` verification_uri_complete `, ` expires_in `, ` interval `

  - ` device_code `: type ` string `

  - ` user_code `: type ` string `

  - ` verification_uri `: type ` string `

  - ` verification_uri_complete `: type ` string `

  - ` expires_in `: type ` number `

  - ` interval `: type ` number `

### ` 429 ` — Rate limited

Content type: ` application/json `

- ` value `: type ` object `

  - Required fields: ` error `

  - ` error `: type ` string `

## Request examples

### cURL

```curl
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"
}'
```

### JavaScript

```javascript
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);
```

### Python

```python
import requests

headers = {
    '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())
```