Exchange Web-Session JWT for CLI API Token
POST/auth/cli/exchange
Called by the frontend /auth/cli page after the user authorizes the CLI. Mints a new CLI-named API token (90-day TTL), records it in the audit log and returns {token, email}. Only a signed-in web session may call it (an API token is refused with 403). Rate-limited to 5 exchanges per 60 seconds per IP and 10 token creations per hour per user (shared with POST /users/me/api-tokens). DEPRECATED (old TUIs only): answers with a Deprecation header while the CLI_LEGACY_EXCHANGE flag is on, and 410 upgrade_required (nothing minted) when off.
Request
Responses
- 200
- 410
- 422
Successful Response
Legacy exchange turned off: upgrade the client
Validation Error