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

# Create an API key for an application

> Creates a new API key for the current application. The plaintext key is returned only once and must be stored securely.



## OpenAPI

````yaml https://app.stainless.com/api/spec/documented/avido/openapi.documented.yml post /v0/api-keys
openapi: 3.1.1
info:
  title: Avido API
  description: >-
    Avido's API for LLM usage events, tool calls, trace management, webhook
    validation, and more. See each endpoint's request/response schema for
    details.
  version: 0.1.0
  contact:
    name: Avido Support
    email: support@avidoai.com
    url: https://avidoai.com/support
servers:
  - url: https://api.avidoai.com
    description: Production API
security:
  - ApiKey: []
    ApplicationId: []
paths:
  /v0/api-keys:
    post:
      tags:
        - API Keys
      summary: Create an API key for an application
      description: >-
        Creates a new API key for the current application. The plaintext key is
        returned only once and must be stored securely.
      operationId: createApplicationApiKey
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateApiKeyRequest'
      responses:
        '201':
          description: Successfully created API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateApiKeyResponse'
              examples:
                success:
                  summary: API key created
                  value:
                    data:
                      id: 123e4567-e89b-12d3-a456-426614174000
                      key: avido_prod_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
                      name: Production API Key
        '400':
          description: bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Application not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '409':
          description: An API key with this name already exists
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: invalid input
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationErrorResponse'
        '500':
          description: internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    CreateApiKeyRequest:
      type: object
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 256
          description: Human-friendly name for the API key
          example: Production API Key
      required:
        - name
      additionalProperties: false
      title: CreateApiKeyRequest
      description: Request body for creating a new API key
    CreateApiKeyResponse:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/CreatedApiKeyOutput'
      required:
        - data
      additionalProperties: false
      title: CreateApiKeyResponse
      description: Successful response for creating an API key
    ErrorResponse:
      type: object
      properties:
        message:
          type: string
          description: A human-readable error message explaining the error.
          example: Resource not found
      required:
        - message
      additionalProperties: false
      title: ErrorResponse
      description: Standard error format for failed API operations.
    ValidationErrorResponse:
      type: object
      properties:
        message:
          type: string
          description: A human-readable error message indicating what went wrong.
          example: Invalid request data
        issues:
          type: array
          items:
            type: object
            properties:
              code:
                type: string
              message:
                type: string
              path:
                type: array
                items:
                  type: string
            required:
              - code
              - message
              - path
            additionalProperties: false
          description: Array of detailed validation error objects.
          example:
            - code: invalid_string
              message: Invalid UUID
              path:
                - id
      required:
        - message
        - issues
      additionalProperties: false
      title: ValidationErrorResponse
      description: Details about validation errors in incoming requests.
    CreatedApiKeyOutput:
      type: object
      properties:
        id:
          type: string
          format: uuid
          pattern: >-
            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
          description: Unique identifier of the created API key
          example: 123e4567-e89b-12d3-a456-426614174000
        key:
          type: string
          minLength: 1
          description: The plaintext API key. Shown only once — store it securely.
          example: avido_12345678abcdef...
        name:
          type: string
          minLength: 1
          description: Name of the API key
          example: Production API Key
      required:
        - id
        - key
        - name
      additionalProperties: false
      title: CreatedApiKey
      description: Newly created API key including the plaintext key (returned once)
  securitySchemes:
    ApiKey:
      type: apiKey
      in: header
      name: x-api-key
      description: Your unique Avido API key
    ApplicationId:
      type: apiKey
      in: header
      name: x-application-id
      description: Your unique Avido Application ID

````