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

# Create an API key

> Mint a new named API key for the caller's account. Admin only. The full secret is returned in the `key` field of this response **exactly once** — copy it now, it is never retrievable again. Only the short `display_prefix` is shown by the list endpoint.



## OpenAPI

````yaml /openapi.json post /api-keys
openapi: 3.1.0
info:
  title: GetDialed Flows API
  version: 0.1.0
servers:
  - url: https://api.getdialed.ai/flows
    description: Production
security: []
paths:
  /api-keys:
    post:
      tags:
        - api-keys
      summary: Create an API key
      description: >-
        Mint a new named API key for the caller's account. Admin only. The full
        secret is returned in the `key` field of this response **exactly once**
        — copy it now, it is never retrievable again. Only the short
        `display_prefix` is shown by the list endpoint.
      operationId: create_api_key_api_keys_post
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ApiKeyCreateRequest'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiKeyCreateResponse'
        '401':
          description: Missing or invalid authentication
          content:
            application/json:
              example:
                detail: Authentication required
        '403':
          description: Caller is authenticated but not an admin
          content:
            application/json:
              example:
                detail: Admin role required
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '429':
          description: Rate limit exceeded — retry after the Retry-After header
          headers:
            Retry-After:
              description: Seconds to wait before retrying
              schema:
                type: integer
          content:
            application/json:
              example:
                detail: 'Rate limit exceeded: 100 per 1 minute'
      security:
        - APIKeyHeader: []
        - HTTPBearer: []
components:
  schemas:
    ApiKeyCreateRequest:
      properties:
        name:
          type: string
          title: Name
      type: object
      required:
        - name
      title: ApiKeyCreateRequest
      description: Request to mint a new named API key.
      example:
        name: CI pipeline
    ApiKeyCreateResponse:
      properties:
        id:
          type: string
          title: Id
        name:
          type: string
          title: Name
        key:
          type: string
          title: Key
        display_prefix:
          type: string
          title: Display Prefix
        status:
          type: string
          title: Status
        created_at:
          type: string
          format: date-time
          title: Created At
      type: object
      required:
        - id
        - name
        - key
        - display_prefix
        - status
        - created_at
      title: ApiKeyCreateResponse
      description: |-
        The one-time create response. ``key`` is the full secret — copy it now;
        it is never shown again.
      example:
        created_at: '2026-07-19T18:00:00Z'
        display_prefix: gdf_Xa9d
        id: ak_5f8d9c2b1a3e4f6079d8c1b2
        key: gdf_Xa9dLpQ2rT7vB0cE4hJ6kM8nP1sU3wZ5yA7bD9fG2iK
        name: CI pipeline
        status: active
    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:
    APIKeyHeader:
      type: apiKey
      in: header
      name: X-API-Key
    HTTPBearer:
      type: http
      scheme: bearer
      bearerFormat: JWT

````