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

# Create Key

> Create a least-privilege gateway key. The secret is returned exactly once.



## OpenAPI

````yaml /openapi.json post /v1/orgs/{orgId}/projects/{projectId}/ai-gateways/{gatewayId}/keys
openapi: 3.1.0
info:
  title: Korve API
  version: 0.1.0
  description: >-
    Typed control plane for deploying applications and explicitly provisioning
    their managed infrastructure.
servers:
  - url: https://api.korve.dev
security: []
paths:
  /v1/orgs/{orgId}/projects/{projectId}/ai-gateways/{gatewayId}/keys:
    post:
      tags:
        - aiGateways
      summary: Create Key
      description: >-
        Create a least-privilege gateway key. The secret is returned exactly
        once.
      operationId: aiGateways.createKey
      parameters:
        - name: orgId
          in: path
          required: true
          schema:
            type: string
          description: The organization's id (UUID) or slug — either form is accepted.
        - name: projectId
          in: path
          required: true
          schema:
            type: string
          description: The project's id (UUID) or slug — either form is accepted.
        - name: gatewayId
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        x-korve-max-bytes: 1048576
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  minLength: 1
                  maxLength: 100
              required:
                - name
              additionalProperties: false
      responses:
        '201':
          description: Key metadata and one-time secret.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    format: uuid
                  name:
                    type: string
                  keyPrefix:
                    type: string
                  secret:
                    type: string
                    pattern: ^kvgw_[A-Za-z0-9]+$
                required:
                  - id
                  - name
                  - keyPrefix
                  - secret
                additionalProperties: false
        '404':
          description: No such gateway.
      security:
        - apiKey: []
        - session: []
components:
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      bearerFormat: korve_api_key
    session:
      type: apiKey
      in: cookie
      name: korve.session_token

````