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

# Create API key

> Creates an org-scoped control-plane API key. The full secret (`so_…`) is returned once in `secret`. Use it as `Authorization: Bearer so_…` for programmatic access and the docs try-it console.



## OpenAPI

````yaml /openapi.json post /api/v1/api-keys
openapi: 3.1.0
info:
  title: SeaOtter API
  description: >-
    SeaOtter control plane API — managed Hermes Agent hosting. Authenticate with
    a Clerk session JWT (web) or an org-scoped API key (`Authorization: Bearer
    so_…` from POST /api/v1/api-keys). Public developer docs:
    https://docs.seaotter.dev
  version: 1.0.0
servers:
  - url: https://api.seaotter.dev
    description: Production
  - url: https://seaotter-api-bpenevambq-uc.a.run.app
    description: Production (Cloud Run URL)
  - url: http://localhost:8000
    description: Local development
security: []
tags:
  - name: agents
    description: Provision and operate Hermes agents
  - name: billing
    description: Stripe plans and subscriptions
  - name: users
    description: Current user and control-plane API keys
  - name: organizations
    description: Active organization context
  - name: audit
    description: Organization audit log (Enterprise)
  - name: health
    description: Liveness probes
paths:
  /api/v1/api-keys:
    post:
      tags:
        - users
      summary: Create API key
      description: >-
        Creates an org-scoped control-plane API key. The full secret (`so_…`) is
        returned once in `secret`. Use it as `Authorization: Bearer so_…` for
        programmatic access and the docs try-it console.
      operationId: create_key_api_v1_api_keys_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ApiKeyCreate'
        required: true
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiKeyOut'
        '401':
          description: Missing or invalid Bearer token (Clerk JWT or so_ API key)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorBody'
        '403':
          description: Authenticated but not permitted (role or plan gate)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorBody'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    ApiKeyCreate:
      properties:
        name:
          type: string
          maxLength: 120
          minLength: 1
          title: Name
          description: Label for this key
          examples:
            - ci-deploy
      type: object
      required:
        - name
      title: ApiKeyCreate
    ApiKeyOut:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        name:
          type: string
          title: Name
        key_prefix:
          type: string
          title: Key Prefix
          description: First characters of the secret for identification
        created_at:
          type: string
          format: date-time
          title: Created At
        secret:
          anyOf:
            - type: string
            - type: 'null'
          title: Secret
          description: Full secret — returned only once on create
          examples:
            - so_…
      type: object
      required:
        - id
        - name
        - key_prefix
        - created_at
      title: ApiKeyOut
    ErrorBody:
      properties:
        detail:
          anyOf:
            - type: string
            - items: {}
              type: array
          title: Detail
          description: Human-readable error, or validation error list
          examples:
            - Agent not found
      type: object
      required:
        - detail
      title: ErrorBody
      description: Standard FastAPI / SeaOtter error payload.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    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
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer
      bearerFormat: JWT or so_ API key
      description: >-
        Clerk session JWT for the web app, or a control-plane API key (`so_…`)
        from POST /api/v1/api-keys for programmatic / docs try-it use.

````