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

# Create an API key



## OpenAPI

````yaml openapi.json POST /v1/keys
openapi: 3.1.0
info:
  title: Egma Platform API
  version: 1.0.0
  description: >-
    The customer-facing HTTP interface used by Egma's web app, CLI, and outside
    clients.
servers:
  - url: https://app.egma.ai
security: []
paths:
  /v1/keys:
    post:
      tags:
        - API keys
      summary: Create an API key
      operationId: createApiKey
      requestBody:
        required: false
        content:
          application/json:
            schema:
              oneOf:
                - type: object
                  properties:
                    name:
                      type: string
                    projectId:
                      anyOf:
                        - type: string
                          minLength: 1
                        - type: 'null'
                  additionalProperties: false
                - type: object
                  properties:
                    name:
                      type: string
                      minLength: 1
                    projectId:
                      type: string
                      minLength: 1
                    monitoringAgentId:
                      type: string
                      minLength: 1
                      description: >-
                        The living LiveKit agent this worker key serves. Egma
                        derives and reserves its key-name prefix on the server.
                  required:
                    - name
                    - projectId
                    - monitoringAgentId
                  additionalProperties: false
      responses:
        '201':
          description: The new API key and its one-time secret.
          headers:
            Cache-Control:
              description: Prevents storage of the one-time secret response.
              schema:
                type: string
                const: no-store
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    minLength: 1
                  name:
                    anyOf:
                      - type: string
                      - type: 'null'
                  scope:
                    type: string
                    enum:
                      - organization
                      - project
                  organizationId:
                    type: string
                    minLength: 1
                  projectId:
                    anyOf:
                      - type: string
                        minLength: 1
                      - type: 'null'
                  looksLike:
                    type: string
                  createdByUserId:
                    type: string
                    minLength: 1
                  createdAt:
                    type: string
                    format: date-time
                  lastUsedAt:
                    anyOf:
                      - type: string
                        format: date-time
                      - type: 'null'
                  revokedAt:
                    anyOf:
                      - type: string
                        format: date-time
                      - type: 'null'
                  secret:
                    type: string
                required:
                  - id
                  - name
                  - scope
                  - organizationId
                  - projectId
                  - looksLike
                  - createdByUserId
                  - createdAt
                  - lastUsedAt
                  - revokedAt
                  - secret
                additionalProperties: false
        '400':
          description: The request was refused.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Refusal'
        '401':
          description: The request was refused.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Refusal'
        '403':
          description: The request was refused.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Refusal'
        '409':
          description: The request was refused.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Refusal'
        '422':
          description: The request was refused.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Refusal'
        '429':
          description: The request rate limit was reached.
          headers:
            Retry-After:
              description: Seconds to wait before trying again.
              schema:
                type: integer
                minimum: 1
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Refusal'
      security:
        - bearerAuth: []
        - sessionCookie: []
components:
  schemas:
    Refusal:
      type: object
      properties:
        error:
          type: string
        message:
          type: string
        details:
          type: object
          additionalProperties: true
      required:
        - error
        - message
      additionalProperties: false
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: An Egma API key.
    sessionCookie:
      type: apiKey
      in: cookie
      name: egma.session_token
      description: >-
        The browser session cookie issued by Egma. HTTPS deployments add the
        standard __Secure- prefix.

````