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

# Get CLI device login

`POST /v2/cli.getDeviceLogin`

## Request

- Base URL: `https://api.unkey.com`
- URL: `https://api.unkey.com/v2/cli.getDeviceLogin`
- Auth: HTTP bearer

Returns the device label, requester details, and status for a user code.
Requires a dashboard session.

## Request body

- V2CliGetDeviceLoginRequestBody
  - `userCode` string, required: Code shown by `unkey login`.

## Response `200`

Device login found.

- V2CliGetDeviceLoginResponseBody
  - `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` V2CliGetDeviceLoginResponseData, required
    - `userCode` string, required
    - `deviceName` string: Label sent by the CLI. The requester chooses it, so do not trust it.
    - `requesterIp` string: IP address that started the login. Empty when the API could not determine it.
    - `requesterUserAgent` string: User agent of the client that started the login.
    - `workspaceId` string: Workspace selected at approval. Empty until the login is approved.
    - `status` string, required: pending, approved, consumed, denied, or expired.
    - `grantablePermissions` string[]: Permissions the signed-in member's role allows. The approval page starts with all of them selected.
    - `createdAt` integer, required: Unix millisecond time the login was started.
    - `expiresAt` integer, required: Unix millisecond expiry.

## Other responses

- `400`: Unknown or invalid code.
- `401`: Unauthorized
- `500`: Internal server error.

## Changes

- **2026-10-27** `e93fe478ac75`: 1 info
  - added the optional property `data/grantablePermissions` 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.getDeviceLogin/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)
