---
title: "Revoke the current CLI OAuth session"
method: POST
path: "/cli/logout"
tags: ["CLI"]
---

# Revoke the current CLI OAuth session

`POST /cli/logout`

Revokes the OAuth grant used to authenticate the request. API-key
authenticated legacy logout requests succeed without deleting server API
keys so old local CLI state can be cleared safely.

## Headers

- `Idempotency-Key` string

## Request body

- object
  - `key_id` string, uuid — Optional id guard; when provided it must match the authenticated OAuth grant id or API key id

## Response `200`

CLI logout completed

- object
  - `success` true, required
  - `data` object, required
    - `revoked` boolean, required — True when an OAuth grant was revoked. False for API-key-authenticated legacy logout, which only clears local CLI state.
    - `key_id` string, uuid — API key id for API-key-authenticated legacy logout
    - `oauth_grant_id` string, uuid — OAuth grant id revoked by OAuth-authenticated logout

## Other responses

- `400` — Invalid request parameters
- `401` — Invalid or missing API key
- `403` — Authenticated caller lacks permission for the operation
- `404` — Resource not found

---

[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)
