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

# Create API key

> Create a new API key. The full key is only returned once in the response.



## OpenAPI

````yaml /openapi.json post /keys/create
openapi: 3.1.0
info:
  title: OpenWhispr API
  version: 1.0.0
  description: Manage notes, folders, transcriptions, and usage programmatically.
servers:
  - url: https://api.openwhispr.com/api/v1
    description: Production
security:
  - bearerAuth: []
paths:
  /keys/create:
    post:
      tags:
        - Keys
      summary: Create API key
      description: >-
        Create a new API key. The full key is only returned once in the
        response.
      operationId: createApiKey
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/KeyCreateRequest'
      responses:
        '201':
          description: Created API key.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/ApiKey'
        '400':
          description: Validation error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Invalid or expired token.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - bearerAuth: []
        - sessionToken: []
components:
  schemas:
    KeyCreateRequest:
      type: object
      required:
        - name
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 100
        scopes:
          type: array
          items:
            type: string
            enum:
              - notes:read
              - notes:write
              - transcriptions:read
              - transcriptions:delete
              - usage:read
          default:
            - notes:read
        expires_in_days:
          type: integer
          minimum: 1
    ApiKey:
      type: object
      properties:
        id:
          type: string
          format: uuid
        key:
          type: string
          description: Full API key (only returned on creation)
        name:
          type: string
        key_prefix:
          type: string
        scopes:
          type: array
          items:
            type: string
        last_used_at:
          type: string
          format: date-time
          nullable: true
        expires_at:
          type: string
          format: date-time
          nullable: true
        created_at:
          type: string
          format: date-time
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
            message:
              type: string
          required:
            - code
            - message
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: API key starting with owk_live_
    sessionToken:
      type: http
      scheme: bearer
      description: Short-lived session token starting with owt_

````