---
search:
  tags:
    - CliDeviceAuth
    - POST
seo:
  description: >-
    Begins the device authorization grant. Returns a user code and a
    verification URL that a… Reference for the POST /auth/cli/device endpoint in
    the varsafe API.
sidebar:
  label: Start device authorization
  badge: POST
title: Start device authorization
type: openapi-operation
---
Begins the device authorization grant. Returns a user code and a verification URL that a human opens in a browser to approve the credential, plus a device code to poll with. This is how a CLI or an unattended agent obtains a credential without a password.

`POST /auth/cli/device`

**Request body** (`application/json`, required)

Request body example:

```json
{
  "credentialProtection": "os_keychain",
  "installationId": "7a1bf939-4d70-4439-9ced-a3dbbce12bd7",
  "machineCredential": "grant",
  "host": {
    "hostname": "string",
    "os": "string"
  }
}
```

**Responses**

- `200` — Success.
- `400` — The request failed validation. \`field\` names the offending input.
- `404` — The resource does not exist, or is not visible to this credential.
- `429` — Rate limited. Retry after the interval named in the response.
- `500` — Unexpected server error. The body never carries internal detail.

Response example, 200:

```json
{
  "deviceCode": "string",
  "userCode": "string",
  "verificationUri": "http://example.com",
  "verificationUriComplete": "http://example.com",
  "expiresInSeconds": 1,
  "pollIntervalSeconds": 1
}
```
