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

# Poll for CLI access token (CLI login step 2)

CLI polls this endpoint after starting a device flow. Returns 400 with error=authorization_pending until the user authorizes in the browser, then returns the access token (single-use — the device code is deleted on retrieval).

` POST /api/v1/device/token `

Poll for CLI access token (CLI login step 2)

CLI polls this endpoint after starting a device flow. Returns 400 with error=authorization_pending until the user authorizes in the browser, then returns the access token (single-use — the device code is deleted on retrieval).

## Servers

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

## Request body (optional)

Content type: ` application/json `

- ` value `: type ` object `

  - Required fields: ` device_code `

  - ` device_code `: type ` string `

    - minLength: ` 1 `

    - maxLength: ` 200 `

## Responses

### ` 200 ` — Access token

Content type: ` application/json `

- ` value `: type ` object `

  - Required fields: ` access_token `, ` token_type `

  - ` access_token `: type ` string `

  - ` token_type `: type ` string `

    - enum: ` ["bearer"] `

### ` 400 ` — authorization_pending | expired_token | access_denied

Content type: ` application/json `

- ` value `: type ` object `

  - Required fields: ` error `

  - ` error `: type ` string `

### ` 429 ` — slow_down (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/token' \
  -H 'Authorization: Bearer YOUR_API_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
  "device_code": "string"
}'
```

### JavaScript

```javascript
const response = await fetch('https://littledemo.com/api/v1/device/token', {
  method: 'POST',
  headers: {
      "Authorization": "Bearer YOUR_API_TOKEN",
      "Content-Type": "application/json"
  },
  body: JSON.stringify({
    "device_code": "string"
  })
});

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/token', headers=headers, json={
  "device_code": "string"
})
print(response.json())
```