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

# Create a customer key

> Mint an API key for one of your end customers. Every request made with the key is billed to your organization and reported under this customer — in Analytics, in `GET /v1/customers/usage`, and in exports — with no per-request tagging. Pass `org_id` to mint a **sub key** for one of the customer's own organizations or sub-accounts; its usage is reported under both the customer and that organization. The plaintext `key` is returned once, in this response only.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/customers/{customerId}/keys
openapi: 3.0.3
info:
  title: AI Reserve Gateway API
  description: >-
    The AI Reserve API surface — OpenAI-compatible chat completions,
    Anthropic-compatible messages, Bedrock Converse, images, video, files,
    text-to-speech, realtime voice sessions, and provider-hidden GPU
    infrastructure — all behind one endpoint and one API key.
  version: 1.0.0
servers:
  - url: https://api.aireserve.com
security:
  - bearerAuth: []
tags:
  - name: Customers
    description: >-
      Per-end-customer usage, cost, and billable amounts for organizations that
      tag requests with their own customers.
  - name: GPU Infrastructure
    description: >-
      Provision and manage provider-hidden GPU instances. The recommended
      Instances API accepts workload requirements and an hourly price ceiling;
      AI Reserve handles provider placement internally. Every mutation is
      asynchronous and returns an operation to poll.
  - name: Customer keys
    description: >-
      Mint, list, and revoke API keys pinned to your own end customers (and
      their organizations), so spend splits per customer without per-request
      tagging.
paths:
  /v1/customers/{customerId}/keys:
    post:
      tags:
        - Customer keys
      summary: Create a customer key
      description: >-
        Mint an API key for one of your end customers. Every request made with
        the key is billed to your organization and reported under this customer
        — in Analytics, in `GET /v1/customers/usage`, and in exports — with no
        per-request tagging. Pass `org_id` to mint a **sub key** for one of the
        customer's own organizations or sub-accounts; its usage is reported
        under both the customer and that organization. The plaintext `key` is
        returned once, in this response only.
      operationId: createCustomerKey
      parameters:
        - name: customerId
          in: path
          required: true
          description: >-
            Your end-customer id, URL-encoded — the same opaque id you would
            otherwise send as `x-aireserve-customer` (1–128 printable
            characters).
          schema:
            type: string
            minLength: 1
            maxLength: 128
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateCustomerKeyRequest'
            example:
              name: Acme — EMEA production
              org_id: emea
      responses:
        '201':
          description: Key created. Store `key` now — it is never shown again.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreatedCustomerKey'
              example:
                id: 9c3f1a2b-4d5e-6f7a-8b9c-0d1e2f3a4b5c
                name: Acme — EMEA production
                customer_id: cust_8f3a2b
                org_id: emea
                key_prefix: aireserve_api_a1b
                key_suffix: f0e9d8
                status: active
                created_at: '2026-10-06T09:30:00.000Z'
                last_used_at: null
                revoked_at: null
                key: aireserve_api_a1b…f0e9d8
        '400':
          description: Malformed customer id, key id, or request body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomerKeyError'
        '401':
          description: Missing or invalid API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomerKeyError'
        '403':
          description: >-
            The key is valid but may not manage customers: customer keys, team
            keys, and personal keys are refused (use an organization-level key),
            or a screen (IP allowlist, country, suspension) rejected the
            request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomerKeyError'
        '409':
          description: Another active key of your organization already has this name.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomerKeyError'
        '429':
          description: Per-organization rate limit exceeded. Honor `Retry-After`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomerKeyError'
      security:
        - bearerAuth: []
components:
  schemas:
    CreateCustomerKeyRequest:
      type: object
      properties:
        name:
          description: >-
            Display name for the key. Defaults to the customer id (and org id
            for a sub key).
          type: string
          minLength: 1
          maxLength: 255
        org_id:
          description: >-
            The customer's organization / sub-account. When set the key is a sub
            key: usage is reported under the customer AND this organization.
          type: string
          minLength: 1
          maxLength: 128
      additionalProperties: false
    CreatedCustomerKey:
      type: object
      properties:
        id:
          type: string
          format: uuid
          pattern: >-
            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
          description: Key id — the `{keyId}` for DELETE.
        name:
          nullable: true
          type: string
        customer_id:
          type: string
          description: Your end-customer id, exactly as given in the path.
        org_id:
          nullable: true
          description: >-
            The customer's organization for a sub key; null for a customer-level
            key.
          type: string
        key_prefix:
          type: string
          description: First characters of the key, for telling keys apart in a list.
        key_suffix:
          type: string
          description: Last characters of the key.
        status:
          type: string
          enum:
            - active
            - paused
            - revoked
          description: >-
            `active` serves requests; `paused` was stopped by a spending
            guardrail or an admin and can be resumed in the portal; `revoked` is
            permanent.
        created_at:
          type: string
          format: date-time
          pattern: >-
            ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
        last_used_at:
          nullable: true
          type: string
          format: date-time
          pattern: >-
            ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
        revoked_at:
          nullable: true
          type: string
          format: date-time
          pattern: >-
            ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
        key:
          type: string
          description: >-
            The plaintext API key. Shown exactly once — store it now; only a
            hash is kept.
      required:
        - id
        - name
        - customer_id
        - org_id
        - key_prefix
        - key_suffix
        - status
        - created_at
        - last_used_at
        - revoked_at
        - key
      additionalProperties: false
    CustomerKeyError:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
            type:
              type: string
            param:
              nullable: true
              type: string
            code:
              type: string
          required:
            - message
            - type
            - param
            - code
          additionalProperties: false
      required:
        - error
      additionalProperties: false
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Your AI Reserve API key (aireserve_api_…) from the API Keys page in the
        portal (https://portal.aireserve.com/keys).

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.