---
title: "Exchange a CLI authorization code for an API key"
method: POST
path: "/v1/cli/auth/token"
tags: ["CLI Auth"]
---

# Exchange a CLI authorization code for an API key

`POST /v1/cli/auth/token`

Completes the CLI browser-login flow: verifies the single-use authorization code and its PKCE code_verifier, then mints and returns the approved API key exactly once.

## Request body

- object
  - `code` string, required
  - `code_verifier` string, required

## Response `200`

The minted API key

- object
  - `data` object, required
    - `token` string, required
    - `name` string, required
    - `projectId` string, required

## Other responses

- `400` — Bad Request
- `500` — Internal Server Error

## Changes

- **2026-09-03** `e23709e30785` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/roarkhq/apis/roark-analytics-api/changes/v1/cli/auth/token/post.md)

---

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