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

# Create API key



## OpenAPI

````yaml openapi/api-gateway.json POST /api-keys
openapi: 3.1.0
info:
  title: ax-api-gateway
  description: ''
  license:
    name: ''
  version: 15.24.0
servers:
  - url: https://gateway.architect.exchange/api
security: []
tags:
  - name: api-gateway
    description: API gateway
paths:
  /api-keys:
    post:
      tags:
        - api-gateway
      operationId: create_api_key
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateApiKeyRequest'
        required: true
      responses:
        '200':
          description: API key created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateApiKeyResponse'
        '401':
          description: Invalid credentials
      security:
        - session_token: []
components:
  schemas:
    CreateApiKeyRequest:
      type: object
      properties:
        account_ids:
          type:
            - array
            - 'null'
          items:
            type: string
          description: >-
            Accounts the key may act on. Each must be one the caller has access
            to.

            When omitted, the key covers every account the caller can access.
            When

            provided, the key is restricted to exactly those accounts.
        allowed_ips:
          type:
            - array
            - 'null'
          items:
            type: string
        permissions:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/ApiKeyPermissions'
              description: >-
                Permissions to grant the key, intersected per request with the
                caller's

                current permissions on the requested account (so a key can never

                out-rank its owner). When omitted, the key is granted full
                permissions

                and behaves as the user.
    CreateApiKeyResponse:
      type: object
      required:
        - api_key
        - api_secret
      properties:
        api_key:
          type: string
        api_secret:
          type: string
    ApiKeyPermissions:
      type: object
      description: >-
        Per-key permission flags, scoping what an API key may do on the accounts
        it

        targets. Mirrors the granular account permissions: the effective
        authority on

        a request is these flags intersected with the user's current permissions
        on

        the requested account, so a key can never out-rank its owner.
      required:
        - can_list
        - can_read
        - can_set_limits
        - can_reduce_or_close
        - can_trade
      properties:
        can_list:
          type: boolean
        can_read:
          type: boolean
        can_reduce_or_close:
          type: boolean
        can_set_limits:
          type: boolean
        can_trade:
          type: boolean
  securitySchemes:
    session_token:
      type: http
      scheme: bearer
      description: User session token

````