---
title: "Poll CLI browser login"
method: POST
path: "/cli/login/poll"
tags: ["CLI"]
---

# Poll CLI browser login

`POST /cli/login/poll`

Polls a CLI login session until the browser approval either succeeds,
is denied, expires, or is polled too quickly. The OAuth token set is
created only after approval and is returned exactly once.

## Headers

- `Idempotency-Key` string

## Request body

- object
  - `device_code` string, required

## Response `200`

CLI login approved and OAuth token set created

- object
  - `success` true, required
  - `data` object, required
    - `api_key` string, required — Legacy alias for access_token. New CLI builds should persist access_token and refresh_token.
    - `key_id` string, uuid, required — Legacy alias for oauth_grant_id
    - `key_prefix` string, required — Legacy display prefix derived from access_token
    - `access_token` string, required — OAuth access token for CLI API authentication
    - `refresh_token` string, required — OAuth refresh token used by the CLI to renew access
    - `token_type` 'Bearer', required
    - `expires_in` integer, required — Seconds until access_token expires
    - `auth_method` 'oauth', required
    - `oauth_grant_id` string, uuid, required
    - `oauth_client_id` string, required
    - `org_id` string, uuid, required
    - `org_name` string, nullable, required

## Other responses

- `400` — Invalid request parameters
- `403` — Authenticated caller lacks permission for the operation

---

[API](https://skmtc.dev/primitive/apis/primitive-api.md) · [All operations](https://skmtc.dev/primitive/apis/primitive-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/primitive/primitive-api/revisions/c2299d28022c/schema)
