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

# Purge API Key

> Permanently deletes the key; this cannot be undone and the key stops
authenticating at once. Requires `api-key:purge`.




## OpenAPI

````yaml DELETE /permission/api-key/{document_id}/purge
openapi: 3.0.1
info:
  title: API Key API
  description: |
    Credentials for machines and external systems (ADR 0105).

    A key has a `kind`:

    - `secret` — created through this API. The key reads
      `hzk_<env>_<prefix>_<secret>` (`env` is `live` on production and
      `test` elsewhere). Horizon stores only the `prefix` and the sha256 of
      the secret, and returns the plaintext key **once**, from create and
      rotate. Send it in the `x-api-key` header.
    - `jwt` — the MaihueGO machine path: a Bearer JWT minted at machine
      provisioning whose payload carries the key id. It keeps working until
      the key is revoked, deactivated, deleted or expired.

    A revoked (`revoked_at`), expired (`expiration_date`), inactive or
    deleted key answers `401`. Each `secret` key spends a sliding window of
    `rate_limit_per_minute` requests (600 when null); past it the API answers
    `429` with `Retry-After` and `X-RateLimit-Limit|Remaining|Reset`.
    Revocation and rotation reach every instance within 60 seconds.

    The management endpoints below require the matching `api-key:*` or
    `api-key-notification-gateway:*` permission. `secret_hash` is never
    returned, filtered or sorted on.
  version: '2026-10-21'
servers:
  - description: Production
    url: https://api.bbrands.io/api/v3
  - description: Certification
    url: https://certification.api.bbrands.io/api/v3
  - description: Development
    url: https://development.api.bbrands.io/api/v3
security:
  - bearerAuth: []
  - apiKeyAuth: []
tags:
  - name: API Key
    description: Keys, their secret lifecycle and revocation.
  - name: API Key Notification Gateway
    description: Notification gateways a key may send for.
paths:
  /permission/api-key/{document_id}/purge:
    delete:
      tags:
        - API Key
      summary: Purge API key
      description: |
        Permanently deletes the key; this cannot be undone and the key stops
        authenticating at once. Requires `api-key:purge`.
      operationId: apiKeyPurge
      parameters:
        - $ref: '#/components/parameters/DocumentId'
      responses:
        '200':
          description: ApiKey record purged
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                  message:
                    type: string
                  meta:
                    $ref: '#/components/schemas/Meta'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
components:
  parameters:
    DocumentId:
      name: document_id
      in: path
      required: true
      description: API key identifier.
      schema:
        type: string
        format: uuid
  schemas:
    Meta:
      type: object
      properties:
        correlation:
          type: string
          description: Request correlation id; quote it when reporting an issue.
        status:
          type: integer
        timestamp:
          type: string
          format: date-time
        version:
          type: string
          nullable: true
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              description: Machine-readable error code.
            errors:
              type: array
              items: {}
            message:
              type: string
        meta:
          $ref: '#/components/schemas/Meta'
  responses:
    Unauthorized:
      description: Missing, invalid, revoked or expired credentials
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Forbidden:
      description: The caller lacks the required permission
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    NotFound:
      description: Record not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    TooManyRequests:
      description: Rate limit exceeded
      headers:
        Retry-After:
          $ref: '#/components/headers/RetryAfter'
        X-RateLimit-Limit:
          $ref: '#/components/headers/RateLimitLimit'
        X-RateLimit-Remaining:
          $ref: '#/components/headers/RateLimitRemaining'
        X-RateLimit-Reset:
          $ref: '#/components/headers/RateLimitReset'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  headers:
    RetryAfter:
      description: Seconds until the key's window frees a request.
      schema:
        type: integer
    RateLimitLimit:
      description: Requests per minute allowed for the key.
      schema:
        type: integer
    RateLimitRemaining:
      description: Requests left in the current window.
      schema:
        type: integer
    RateLimitReset:
      description: Unix seconds when the window frees a request.
      schema:
        type: integer
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: A `secret` API key, `hzk_<env>_<prefix>_<secret>`.

````

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