> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pilotstatus.com.br/llms.txt
> Use this file to discover all available pages before exploring further.

# Revoke a named workspace key

> Revokes one NAMED workspace key; it stops working on the next request. Owner or Admin (`apikeys:rotate`). Revoking a key that is already revoked also answers `200` with its original `revokedAt`. The primary key cannot be revoked (`409 PRIMARY_KEY_NOT_REVOCABLE`) — rotate it with `POST /v1/api-keys/regenerate`.

**Requires an account key** (`ps_account_`, created in Profile → API). Workspace keys, number keys and OAuth/MCP tokens get `403 ACCOUNT_KEY_REQUIRED`. Sent with `Cache-Control: no-store`.

> [!WARNING]
>
> **The key stops working on the next request**, for every integration that uses it.


## OpenAPI

````yaml openapi.json DELETE /v1/workspaces/{workspaceId}/api-keys/{keyId}
openapi: 3.1.0
info:
  title: Pilot Status API
  version: 1.0.0
  license:
    name: Pilot Status Terms of Service
    url: https://pilotstatus.com.br/terms
  description: >-
    Public REST API for Pilot Status. Authenticate with the `x-api-key: ps_...`
    header (or `x-api-key-id`). Base URL: https://pilotstatus.com.br
servers:
  - url: https://pilotstatus.com.br
security:
  - apiKey: []
  - apiKeyId: []
paths:
  /v1/workspaces/{workspaceId}/api-keys/{keyId}:
    delete:
      tags:
        - Workspace
      summary: Revoke a named workspace key
      description: >-
        Revokes one NAMED workspace key; it stops working on the next request.
        Owner or Admin (`apikeys:rotate`). Revoking a key that is already
        revoked also answers `200` with its original `revokedAt`. The primary
        key cannot be revoked (`409 PRIMARY_KEY_NOT_REVOCABLE`) — rotate it with
        `POST /v1/api-keys/regenerate`.


        **Requires an account key** (`ps_account_`, created in Profile → API).
        Workspace keys, number keys and OAuth/MCP tokens get `403
        ACCOUNT_KEY_REQUIRED`. Sent with `Cache-Control: no-store`.
      operationId: delete_workspaces_api_keys_keyid
      parameters:
        - name: workspaceId
          in: path
          required: true
          schema:
            type: string
          description: Workspace id, from `GET /v1/workspaces`.
          example: cmh2a9z8y0002ws8example1q
        - name: keyId
          in: path
          required: true
          schema:
            type: string
          description: Key id, from the key listing.
          example: cmh2ab7770004ak8example9m
      responses:
        '200':
          description: Revoked
          content:
            application/json:
              example:
                id: cmh2ab7770004ak8example9m
                revokedAt: '2026-10-28T12:00:00.000Z'
          headers:
            Cache-Control:
              schema:
                type: string
              example: no-store
        '401':
          description: Missing, invalid or revoked API key
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              example:
                error: Invalid API key
        '403':
          description: >-
            Not an account key (`ACCOUNT_KEY_REQUIRED`), not an active member of
            the workspace (`WORKSPACE_MEMBERSHIP_REQUIRED`), or a role below
            Admin (`PERMISSION_DENIED`)
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              example:
                error: >-
                  This endpoint requires an account API key (ps_account_…),
                  created in Profile → API. Workspace keys, number keys and
                  OAuth tokens cannot use it | Este endpoint exige uma API key
                  de conta (ps_account_…), criada em Perfil → API. Chaves de
                  workspace, de número e tokens OAuth não podem usá-lo
                code: ACCOUNT_KEY_REQUIRED
        '404':
          description: No workspace key with that id in that workspace
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              example:
                error: API key not found | API key não encontrada
                code: API_KEY_NOT_FOUND
        '409':
          description: The id is the primary key
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              example:
                error: >-
                  The primary workspace key cannot be revoked; rotate it with
                  POST /v1/api-keys/regenerate | A chave principal do workspace
                  não pode ser revogada; gere uma nova com POST
                  /v1/api-keys/regenerate
                code: PRIMARY_KEY_NOT_REVOCABLE
components:
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: x-api-key
      description: Your ps_ API key
    apiKeyId:
      type: apiKey
      in: header
      name: x-api-key-id
      description: API key id (alternative to x-api-key)

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.