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

# Create a new API key

> Create a new named API key for the authenticated user. The full token is returned only in this response - it cannot be retrieved again.




## OpenAPI

````yaml https://app.herondata.io/swagger post /api/credentials/keys
openapi: 3.0.0
info:
  contact:
    email: support@herondata.io
    name: Support
  title: Heron Data API
  version: '2021-07-19'
servers:
  - description: Production
    url: https://app.herondata.io
security:
  - ApiKeyAuth:
      - key_XXX
externalDocs:
  description: Read Tutorial
  url: https://docs.herondata.io/
paths:
  /api/credentials/keys:
    post:
      tags:
        - Credentials
      summary: Create a new API key
      description: >
        Create a new named API key for the authenticated user. The full token is
        returned only in this response - it cannot be retrieved again.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateKeySchema'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiKeyCreatedSchema'
          description: API key created. The full token is only returned in this response.
        '400':
          description: Invalid request
components:
  schemas:
    CreateKeySchema:
      properties:
        name:
          description: A descriptive name for the key
          maxLength: 128
          minLength: 1
          type: string
      required:
        - name
      type: object
    ApiKeyCreatedSchema:
      properties:
        created:
          format: date-time
          readOnly: true
          type: string
        heron_id:
          readOnly: true
          type: string
        is_active:
          readOnly: true
          type: boolean
        name:
          readOnly: true
          type: string
        token:
          description: Full token - shown only once
          readOnly: true
          type: string
        token_prefix:
          readOnly: true
          type: string
      type: object
  securitySchemes:
    ApiKeyAuth:
      in: header
      name: x-api-key
      type: apiKey

````