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

# Rotate API Key



## OpenAPI

````yaml /openapi/v3.yaml post /api-keys/{apiKey}/rotate
openapi: 3.0.0
info:
  title: Qanapi API v3
  version: 3.0.0
  description: Qanapi API version 3
servers:
  - url: https://{subdomain}.qanapi.cloud/api/v3
    description: The Qanapi API server
    variables:
      subdomain:
        default: ''
        description: Customer-specific subdomain.
security:
  - ApiKey: []
paths:
  /api-keys/{apiKey}/rotate:
    post:
      summary: Rotate API Key
      operationId: rotateApiKey
      parameters:
        - name: apiKey
          in: path
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: API Key rotated
          content:
            application/json:
              schema:
                type: object
                properties:
                  key:
                    $ref: '#/components/schemas/ApiKeyString'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                apiKeyRevoked:
                  value:
                    message: API key is revoked
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/ForbiddenAndUnauthorized'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                message: API key not found
components:
  schemas:
    ApiKeyString:
      type: string
      pattern: ^qapi_.*
      example: qapi_1234567890abcdef1234567890abcdef
    Error:
      type: object
      required:
        - message
      properties:
        message:
          type: string
          example: An error occurred.
  responses:
    Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            message: Unauthorized.
    ForbiddenAndUnauthorized:
      description: Forbidden
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            forbidden:
              summary: Forbidden
              value:
                message: User does not have the right permissions.
            unauthorized:
              summary: Unauthorized
              value:
                message: Unauthorized.
  securitySchemes:
    ApiKey:
      type: apiKey
      in: header
      name: X-Qanapi-Authorization

````