---
title: "Poll for the session minted by an approved device code (no auth)"
method: POST
path: "/v1/cli-auth/token"
tags: ["Account"]
---

# Poll for the session minted by an approved device code (no auth)

`POST /v1/cli-auth/token`

## Request

- Base URL: `https://api.openrelay.inc`
- URL: `https://api.openrelay.inc/v1/cli-auth/token`
- Auth: none required

Polls a device login: pending until the user approves, then returns the CLI session credential exactly once; denied or expired codes say so.
RFC 8628-style polling: while the code is pending, answers 400 authorization_pending; faster than the returned interval, 429 slow_down; denied, 403 access_denied; expired or unknown, 410 expired_token. On the first poll after approval, mints and returns the one-time CLI session credential; every poll after that (the code was already collected) also answers expired_token, so the token is delivered to exactly one caller.

Requires no authentication.

## Request body

- object
  - `deviceCode` string, required

## Response `200`

Approved; here is the session

- object
  - `email` string, required
  - `expiresAt` string, date-time, required
  - `orgId` string, required
  - `orgName` string
  - `sessionId` string, required: This session's id: what orl auth logout revokes with DELETE /v1/me/cli-sessions/{id}.
  - `token` string, required: Bearer credential, prefix ocs_; shown once.
  - `tokenType` string, required: Always Bearer.
  - `userId` string, required

## Other responses

- `400`: Still waiting for the user to approve or deny
- `403`: The user denied the request
- `410`: Expired, unknown, or already collected
- `429`: Polling faster than the returned interval

## Changes

- **2026-10-26** `7fe59d94a9f5`: 4 info
  - added the optional property `requestId` to the response with the `400` status
  - added the optional property `requestId` to the response with the `403` status
  - added the optional property `requestId` to the response with the `410` status
  - added the optional property `requestId` to the response with the `429` status
- **2026-10-21** `dc9750cb25b5`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/openrelay/apis/openrelay-api/changes/v1/cli-auth/token/post.md)

---

[API](https://skmtc.dev/openrelay/apis/openrelay-api.md) - [All operations](https://skmtc.dev/openrelay/apis/openrelay-api/llms.txt) - [OpenAPI document](https://skmtc.dev/openrelay/apis/openrelay-api/revisions/7fe59d94a9f5?raw)
