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

# Poll for CLI device token

` POST /v1/device/token `

Poll for CLI device token

## Servers

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

## Request body (required)

Content type: ` application/json `

- ` value `: type ` object `

  - Required fields: ` poll_token `

  - ` poll_token `: type ` string `

    - pattern: ` "^[a-f0-9]{64}$" `

## Responses

### ` 200 ` — Pending or authorized state

Content type: ` application/json `

- ` value `: type ` unknown `

  - ` oneOf alternative 1 `: type ` object `

    - ` status `: type ` string `

      - enum: ` ["pending"] `

    - ` interval `: type ` integer `

    - ` expires_in `: type ` integer `

  - ` oneOf alternative 2 `: type ` object `

    - ` status `: type ` string `

      - enum: ` ["authorized"] `

    - ` api_key `: type ` string `

    - ` key_id `: type ` string `

    - ` user_id `: type ` string `

### ` 400 ` — Error response

Content type: ` application/json `

- ` value `: type ` object `

  - Required fields: ` error `

  - ` error `: type ` object `

    - Required fields: ` code `, ` message `

    - ` code `: type ` string `

    - ` message `: type ` string `

    - ` details `: type ` object `

    - ` retry_after `: type ` integer `

### ` 410 ` — Error response

Content type: ` application/json `

- ` value `: type ` object `

  - Required fields: ` error `

  - ` error `: type ` object `

    - Required fields: ` code `, ` message `

    - ` code `: type ` string `

    - ` message `: type ` string `

    - ` details `: type ` object `

    - ` retry_after `: type ` integer `

### ` 429 ` — Error response

Content type: ` application/json `

- ` value `: type ` object `

  - Required fields: ` error `

  - ` error `: type ` object `

    - Required fields: ` code `, ` message `

    - ` code `: type ` string `

    - ` message `: type ` string `

    - ` details `: type ` object `

    - ` retry_after `: type ` integer `

## Request examples

### cURL

```curl
curl -X POST 'https://screenframed.com/v1/device/token' \
  -H 'Authorization: Bearer YOUR_API_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
  "poll_token": "string"
}'
```

### JavaScript

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

const data = await response.json();
console.log(data);
```

### Python

```python
import requests

headers = {
    'Authorization': 'Bearer YOUR_API_TOKEN'
}

response = requests.post('https://screenframed.com/v1/device/token', headers=headers, json={
  "poll_token": "string"
})
print(response.json())
```