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

# Delete keys

> Revoke an API key by its prefix



## OpenAPI

````yaml /openapi.json delete /keys/{prefix}
openapi: 3.1.0
info:
  title: Keyflare API
  description: >-
    Open-source secrets manager built entirely on Cloudflare. One Worker. One D1
    database. Zero trust storage.
  version: 0.1.0
  contact:
    name: Keyflare
    url: https://github.com/keyflare/keyflare
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
servers:
  - url: '{baseUrl}'
    description: Your Keyflare deployment
    variables:
      baseUrl:
        default: https://keyflare.YOUR_ACCOUNT.workers.dev
        description: >-
          Base URL of your Keyflare Worker (e.g. https://secrets.example.com or
          https://keyflare.my-account.workers.dev)
security:
  - bearerAuth: []
tags:
  - name: Health
    description: Health check endpoints
  - name: Bootstrap
    description: Initial setup endpoints
  - name: Keys
    description: API key management
  - name: Projects
    description: Project management
  - name: Environments
    description: Environment management
  - name: Secrets
    description: Secret management
paths:
  /keys/{prefix}:
    delete:
      tags:
        - Keys
      description: Revoke an API key by its prefix
      operationId: deleteKeysByPrefix
      parameters:
        - schema:
            type: string
          in: path
          name: prefix
          required: true
      responses:
        '200':
          description: Key revoked successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  ok:
                    type: boolean
                    const: true
                  data:
                    type: object
                    properties:
                      revoked:
                        type: string
                    required:
                      - revoked
                required:
                  - ok
                  - data
        '400':
          description: Bad Request - Invalid request body or parameters
          content:
            application/json:
              schema:
                type: object
                properties:
                  ok:
                    type: boolean
                    const: false
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        enum:
                          - BAD_REQUEST
                          - UNAUTHORIZED
                          - FORBIDDEN
                          - NOT_FOUND
                          - CONFLICT
                          - INTERNAL_ERROR
                      message:
                        type: string
                    required:
                      - code
                      - message
                required:
                  - ok
                  - error
        '401':
          description: Unauthorized - Missing, invalid, or revoked API key
          content:
            application/json:
              schema:
                type: object
                properties:
                  ok:
                    type: boolean
                    const: false
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        enum:
                          - BAD_REQUEST
                          - UNAUTHORIZED
                          - FORBIDDEN
                          - NOT_FOUND
                          - CONFLICT
                          - INTERNAL_ERROR
                      message:
                        type: string
                    required:
                      - code
                      - message
                required:
                  - ok
                  - error
        '403':
          description: Forbidden - Key doesn't have required scope/permission
          content:
            application/json:
              schema:
                type: object
                properties:
                  ok:
                    type: boolean
                    const: false
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        enum:
                          - BAD_REQUEST
                          - UNAUTHORIZED
                          - FORBIDDEN
                          - NOT_FOUND
                          - CONFLICT
                          - INTERNAL_ERROR
                      message:
                        type: string
                    required:
                      - code
                      - message
                required:
                  - ok
                  - error
        '404':
          description: Not Found - Resource doesn't exist
          content:
            application/json:
              schema:
                type: object
                properties:
                  ok:
                    type: boolean
                    const: false
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        enum:
                          - BAD_REQUEST
                          - UNAUTHORIZED
                          - FORBIDDEN
                          - NOT_FOUND
                          - CONFLICT
                          - INTERNAL_ERROR
                      message:
                        type: string
                    required:
                      - code
                      - message
                required:
                  - ok
                  - error
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                type: object
                properties:
                  ok:
                    type: boolean
                    const: false
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        enum:
                          - BAD_REQUEST
                          - UNAUTHORIZED
                          - FORBIDDEN
                          - NOT_FOUND
                          - CONFLICT
                          - INTERNAL_ERROR
                      message:
                        type: string
                    required:
                      - code
                      - message
                required:
                  - ok
                  - error
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: API key authentication (kfl_user_* or kfl_sys_*)

````