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

# Create API Key



## OpenAPI

````yaml POST /v1/api-keys
openapi: 3.1.0
info:
  title: Calseta
  description: SOC data platform for security agent consumption
  version: dev
servers: []
security: []
paths:
  /v1/api-keys:
    post:
      tags:
        - api-keys
      summary: Create Api Key
      operationId: create_api_key_v1_api_keys_post
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/APIKeyCreate'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DataResponse_APIKeyCreated_'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    APIKeyCreate:
      properties:
        name:
          type: string
          maxLength: 255
          minLength: 1
          title: Name
          description: Human-readable label
        scopes:
          items:
            type: string
          type: array
          minItems: 1
          title: Scopes
          description: Granted scopes
        key_type:
          type: string
          title: Key Type
          description: 'Key type: ''human'' or ''agent'''
          default: human
        expires_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Expires At
          description: Optional expiry (UTC ISO 8601)
        allowed_sources:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Allowed Sources
          description: Restrict ingestion to these source names (null = unrestricted)
      type: object
      required:
        - name
        - scopes
      title: APIKeyCreate
    DataResponse_APIKeyCreated_:
      properties:
        data:
          $ref: '#/components/schemas/APIKeyCreated'
        meta:
          additionalProperties: true
          type: object
          title: Meta
      type: object
      required:
        - data
      title: DataResponse[APIKeyCreated]
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    APIKeyCreated:
      properties:
        uuid:
          type: string
          format: uuid
          title: Uuid
        name:
          type: string
          title: Name
        key_prefix:
          type: string
          title: Key Prefix
        key:
          type: string
          title: Key
          description: Full API key — store securely, never shown again
        scopes:
          items:
            type: string
          type: array
          title: Scopes
        key_type:
          type: string
          title: Key Type
        is_active:
          type: boolean
          title: Is Active
        created_at:
          type: string
          format: date-time
          title: Created At
        expires_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Expires At
        allowed_sources:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Allowed Sources
      type: object
      required:
        - uuid
        - name
        - key_prefix
        - key
        - scopes
        - key_type
        - is_active
        - created_at
        - expires_at
        - allowed_sources
      title: APIKeyCreated
      description: >-
        Returned only by POST /v1/api-keys. Contains the full plain-text key
        (shown once).
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````