---
title: "Exchange A CLI Login Code"
method: POST
path: "/cli/token"
tags: ["Identity"]
---

# Exchange A CLI Login Code

`POST /cli/token`

## Request

- Base URL: `https://zeronoise.ai/api/v1`
- URL: `https://zeronoise.ai/api/v1/cli/token`
- Auth: none required

Used by the official CLI after browser sign-in at /cli/authorize (OAuth 2.0
authorization code with PKCE for native apps, RFC 8252). Returns an ordinary,
revocable API credential. Codes are single use and expire after two minutes.
Errors use the OAuth token error format.

## Request body

- object
  - `grant_type` 'authorization_code', required
  - `client_id` 'zeronoise-cli', required
  - `code` string, required
  - `code_verifier` string, required
  - `redirect_uri` string, required

## Response `200`

New API credential. The secret is returned once and must not be logged.

- object
  - `access_token` string, required
  - `token_type` 'Bearer', required
  - `expires_in` integer: Seconds until the key expires. Omitted when the user chose no expiry.
  - `scope` string, required: Space-separated granted scopes
  - `credential` object, required
    - `name` string, required
    - `expires_at` string, date-time, nullable, required: Null when the key never expires.

## Other responses

- `400`: invalid_request, invalid_grant or unsupported_grant_type
- `401`: invalid_client

---

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