---
title: "Start CLI device login"
method: POST
path: "/v2/cli.startDeviceLogin"
tags: ["cli"]
---

# Start CLI device login

`POST /v2/cli.startDeviceLogin`

## Request

- Base URL: `https://api.unkey.com`
- URL: `https://api.unkey.com/v2/cli.startDeviceLogin`
- Auth: none required

Starts a device login for `unkey login`.
The response includes the user code and the dashboard URL where the user confirms it and chooses permissions.
No authentication is required. Requests are rate limited per IP address.

## Request body

- V2CliStartDeviceLoginRequestBody
  - `deviceName` string: Hostname or other label shown on the authorize page.

## Response `200`

Device login started.

- V2CliStartDeviceLoginResponseBody
  - `meta` Meta, required: Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
    - `requestId` string, required: A unique id for this request. Always include this ID when contacting support about a specific API request. This identifier allows Unkey's support team to trace the exact request through logs and diagnostic systems to provide faster assistance.
  - `data` V2CliStartDeviceLoginResponseData, required
    - `loginId` string, required: Secret credential used to poll for approval. Do not display it.
    - `userCode` string, required: Code the user confirms in the browser.
    - `verificationUrl` string, required: Dashboard page with the code filled in.
    - `expiresIn` integer, required: Seconds until the login expires.
    - `interval` integer, required: Seconds to wait between polls.

## Other responses

- `400`: Invalid input.
- `429`: Too many requests from this IP address.
- `500`: Internal server error, including when CLI login is not configured on this API.

## Changes

- **2026-10-28** `5949ec68734a`: 2 breaking, 1 info
  - removed the required property `data/verificationUri` from the response with the `200` status
  - removed the required property `data/verificationUriComplete` from the response with the `200` status
  - added the required property `data/verificationUrl` to the response with the `200` status
- **2026-10-26** `9829df3465a0`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/unkeyed/apis/unkey-api/changes/v2/cli.startDeviceLogin/post.md)

---

[API](https://skmtc.dev/unkeyed/apis/unkey-api.md) - [All operations](https://skmtc.dev/unkeyed/apis/unkey-api/llms.txt) - [OpenAPI document](https://skmtc.dev/unkeyed/apis/unkey-api/revisions/6fbaa27f19e0?raw)
