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

# Create API Key

> Creates a new API key for authenticating against the Big Peer HTTP API.



## OpenAPI

````yaml /ditto-server/operator/operator-api-spec.json post /namespace/{namespace}/bigPeer/{big_peer_name}/app/{app_name}/apiKey
openapi: 3.1.0
info:
  title: Operator Management API
  description: A RESTful API that allows users to manage Big Peer apps and API keys.
  license:
    name: Ditto Binary License
    identifier: Ditto Binary License
  version: 1.0.0
servers:
  - url: http://localhost:{port}
    description: Local server
    variables:
      port:
        default: '8080'
security: []
tags:
  - name: App
    description: Big Peer apps API endpoints
  - name: API Keys
    description: Big Peer HTTP API keys
  - name: Data Bridge
    description: Apps' data bridges (CDC)
paths:
  /namespace/{namespace}/bigPeer/{big_peer_name}/app/{app_name}/apiKey:
    post:
      tags:
        - API Keys
      summary: Create API Key
      description: Creates a new API key for authenticating against the Big Peer HTTP API.
      operationId: createApiKey
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ApiKey'
        required: true
      responses:
        '200':
          description: Plaintext API key.
          content:
            application/json:
              schema:
                type: string
        '400':
          description: bad request
          content:
            application/json:
              examples:
                BigPeerNameMismatch:
                  summary: big peer in app label doesn't match uri parameter
                InvalidApiKeyExpiryDate:
                  summary: attempt to create api key with past expiry date
        '404':
          description: app specified in URI params does not exist
          content:
            application/json:
              examples:
                AppNotFound:
                  summary: big peer app not found
components:
  schemas:
    ApiKey:
      type: object
      required:
        - name
        - expiresAt
        - permissions
      properties:
        description:
          type:
            - string
            - 'null'
          example: API key used for staging environment.
        expiresAt:
          type: string
          format: date-time
          example: '2100-04-13T12:00:00Z'
        name:
          type: string
          title: Dns1123Label
          description: >-
            RFC 1123 DNS labels used for most Kubernetes resource names.  Some
            resource types require their names to follow the DNS label standard
            as defined in [RFC 1123][rfc1123].
                         This means the name must:
                            * contain at most 63 characters * contain only lowercase alphanumeric characters or '-' * start with an alphanumeric character
                            * end with an alphanumeric character
                        [rfc1123]: https://tools.ietf.org/html/rfc1123
          maxLength: 63
          minLength: 1
          pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$
        permissions:
          type: object
          title: Permission
          description: Set of permissions granted to a particular API key or device token.
          required:
            - read
            - write
          properties:
            qlVersion:
              type: integer
              format: u-int8
              description: >-
                What query language version are the queries written in? If 1,
                use DQL. If 0, use legacy query builder. Other numbers are not
                valid. Defaults to 0.
              default: 0
              enum:
                - 0
                - 1
            read:
              $ref: a463f16b-1f7a-43eb-bb3e-cc0911290e58
              description: The set of read permissions granted
            remoteQuery:
              type: boolean
              description: >-
                Can this initiate remote queries? In addition to this, remote
                queries also require full read permission.
              default: false
            write:
              $ref: fbd7d4f3-4292-4bf9-91e0-82baa59559bb
              description: The set of write permissions granted

````