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

# Create API key

> Creates a new API key for the authenticated customer. The secret key value is returned once — store it securely.



## OpenAPI

````yaml /api-reference/openapi.json post /api-keys
openapi: 3.0.0
info:
  title: RouteMesh API
  version: 1.0.0
  description: >-
    HTTP API for routing JSON-RPC requests across providers, managing API keys,
    and viewing usage.
  license:
    name: Proprietary
    url: https://routeme.sh
servers:
  - url: https://lb.routeme.sh
    description: Primary API endpoint
  - url: https://lb2.routeme.sh
    description: AWS DNS load balancer (backup)
security: []
tags:
  - name: RPC
    description: Forward JSON-RPC requests to the router.
  - name: Chains
    description: Discover supported chains.
  - name: API Keys
    description: Manage your API keys for self-service access.
  - name: Usage
    description: View your usage and billing data.
  - name: Health
    description: Service health checks.
paths:
  /api-keys:
    post:
      tags:
        - API Keys
      summary: Create API key
      description: >-
        Creates a new API key for the authenticated customer. The secret key
        value is returned once — store it securely.
      operationId: createApiKey
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ApiKeyCreateRequest'
      responses:
        '201':
          description: API key created (secret returned once)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiKeyCreatedResponse'
        '400':
          description: Bad request (invalid domains, routing strategy, or missing fields)
        '401':
          description: Unauthorized
        '500':
          description: Internal server error
      security:
        - MgmtKeyAuth: []
components:
  schemas:
    ApiKeyCreateRequest:
      type: object
      properties:
        name:
          type: string
          description: Friendly name for this key (e.g. "Production", "Staging").
          nullable: true
        allowed_domains:
          type: array
          items:
            type: string
          description: >-
            List of allowed origins/domains. Requests from other domains are
            rejected with 403.
          minItems: 1
        routing_strategy:
          type: string
          enum:
            - economy
            - performance
          description: economy — most competitive prices; performance — fastest routes.
      required:
        - allowed_domains
        - routing_strategy
      additionalProperties: false
    ApiKeyCreatedResponse:
      type: object
      properties:
        id:
          type: integer
        customer_id:
          type: integer
        allowed_domains:
          type: array
          items:
            type: string
        api_key:
          type: string
          description: The secret API key. Save this — it is returned only once.
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
        name:
          type: string
          nullable: true
        routing_strategy:
          type: string
          enum:
            - economy
            - performance
        active:
          type: boolean
        bypass_credit_check:
          type: boolean
      required:
        - id
        - customer_id
        - allowed_domains
        - api_key
        - created_at
        - updated_at
        - name
        - routing_strategy
        - active
        - bypass_credit_check
      additionalProperties: false
  securitySchemes:
    MgmtKeyAuth:
      type: apiKey
      in: header
      name: X-Mgmt-Key
      description: >-
        Management API key from the RouteMesh dashboard. Required for customer
        API endpoints (/api-keys, /usage). Each request also carries the
        customer's RPC API key in the URL path for the RPC endpoint.

````