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

# Create an API key

> The full API key is returned once and cannot be retrieved again.



## OpenAPI

````yaml /api/openapi.yaml post /api-keys
openapi: 3.1.0
info:
  title: Antigen API
  version: v1
  description: >-
    Use the Antigen API to manage targets, runs, vulnerabilities, evidence,
    reports, hooks, assets, and integrations.
servers:
  - url: https://api.antigen.sh/v1
    description: Production
security:
  - ApiKeyAuth: []
  - BearerAuth: []
  - SessionCookie: []
tags:
  - name: Authentication
  - name: API keys
  - name: Models
  - name: Agents
  - name: Targets
  - name: Runs
  - name: Vulnerabilities
  - name: Evidence
  - name: Reports
  - name: Hooks
  - name: Asset Map
  - name: Integrations
paths:
  /api-keys:
    post:
      tags:
        - API keys
      summary: Create an API key
      description: The full API key is returned once and cannot be retrieved again.
      operationId: createApiKey
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - name
              properties:
                name:
                  type: string
      responses:
        '201':
          description: API key created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreatedApiKey'
components:
  schemas:
    CreatedApiKey:
      allOf:
        - $ref: '#/components/schemas/ApiKey'
        - type: object
          required:
            - key
          properties:
            key:
              type: string
              description: Store this value now.
    ApiKey:
      type: object
      required:
        - id
        - name
        - prefix
        - created_at
        - last_used_at
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
        prefix:
          type: string
          description: First eight characters of the key.
        created_at:
          $ref: '#/components/schemas/Timestamp'
        last_used_at:
          type:
            - string
            - 'null'
          format: date-time
    Timestamp:
      type: string
      format: date-time
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: API key from the Antigen dashboard.
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: access token
      description: Better Auth access token.
    SessionCookie:
      type: apiKey
      in: cookie
      name: better-auth.session_token
      description: Better Auth browser session cookie.

````