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

# Rotate API Key

> Generates a new API key for the app. The old key is **immediately revoked** — this action is irreversible.



## OpenAPI

````yaml POST /apps/{appId}/keys/rotate
openapi: 3.1.0
info:
  title: Vela API
  description: Event ingestion, schema management, and notification rules for Vela.
  version: 1.0.0
  contact:
    name: Vela Support
    email: support@vela.dev
servers:
  - url: https://api.vela.dev/v1
    description: Production
  - url: http://localhost:3000/v1
    description: Local development
security:
  - clientSecret: []
paths:
  /apps/{appId}/keys/rotate:
    post:
      tags:
        - Apps
      summary: Rotate API Key
      description: >-
        Generates a new API key for the app. The old key is **immediately
        revoked** — this action is irreversible.
      operationId: rotate-api-key
      parameters:
        - $ref: '#/components/parameters/AppId'
      responses:
        '200':
          description: New API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AppWithApiKey'
              example:
                app:
                  id: 3f2a1b4c-5d6e-7f8a-9b0c-1d2e3f4a5b6c
                  accountId: acc-uuid
                  name: Order Service
                  slug: order-service
                  apiKeyPrefix: vela_live_xyz
                  createdAt: '2024-06-01T12:00:00.000Z'
                  updatedAt: '2024-06-01T14:00:00.000Z'
                apiKey: vela_live_newkeyxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
        '404':
          $ref: '#/components/responses/NotFound'
      security:
        - clientSecret: []
components:
  parameters:
    AppId:
      name: appId
      in: path
      required: true
      description: App UUID or slug
      schema:
        type: string
      example: order-service
  schemas:
    AppWithApiKey:
      type: object
      properties:
        app:
          $ref: '#/components/schemas/App'
        apiKey:
          type: string
          description: Full API key (only returned on creation or rotation)
    App:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: App identifier
        accountId:
          type: string
          format: uuid
          description: Associated account
        name:
          type: string
          description: App display name
        slug:
          type: string
          description: URL-friendly identifier
        apiKeyPrefix:
          type: string
          description: Prefix of the current API key
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    Error:
      type: object
      properties:
        statusCode:
          type: integer
        error:
          type: string
        message:
          type: string
  responses:
    NotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            statusCode: 404
            error: Not Found
            message: Resource not found
  securitySchemes:
    clientSecret:
      type: http
      scheme: bearer
      description: 'Client secret for management API access. Format: `vela_cs_...`'

````