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

# Create API key



## OpenAPI

````yaml https://api.crosmos.dev/openapi.json post /api/v1/auth/keys
openapi: 3.1.0
info:
  title: Crosmos API
  version: 0.1.0
servers:
  - url: /
security: []
paths:
  /api/v1/auth/keys:
    post:
      tags:
        - auth
      summary: Create API key
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateApiKeyRequest'
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiKeyCreatedResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorBody'
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorBody'
      security:
        - bearerAuth: []
components:
  schemas:
    CreateApiKeyRequest:
      type: object
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 255
        expires_at:
          type: string
          format: date-time
        space_id:
          type: string
          format: uuid
      required:
        - name
    ApiKeyCreatedResponse:
      type: object
      properties:
        key_id:
          type: string
          format: uuid
        name:
          type: string
        key_prefix:
          type: string
        raw_key:
          type: string
        expires_at:
          type: string
          nullable: true
          format: date-time
        space_id:
          type: string
          nullable: true
          format: uuid
      required:
        - key_id
        - name
        - key_prefix
        - raw_key
        - expires_at
        - space_id
    ErrorBody:
      type: object
      properties:
        detail:
          type: string
      required:
        - detail
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: JWT access token or API key (csk_...)

````