---
title: "Create API key"
method: POST
path: "/api-keys"
tags: ["API Keys"]
---

# Create API key

`POST /api-keys`

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

## Request body

- ApiKeyCreateRequest
  - `name` string, nullable — Friendly name for this key (e.g. "Production", "Staging").
  - `allowed_domains` string[], required — List of allowed origins/domains. Requests from other domains are rejected with 403.
  - `routing_strategy` 'economy' | 'performance', required — economy — most competitive prices; performance — fastest routes.

## Response `201`

API key created (secret returned once)

- ApiKeyCreatedResponse
  - `id` integer, required
  - `customer_id` integer, required
  - `allowed_domains` string[], required
  - `api_key` string, required — The secret API key. Save this — it is returned only once.
  - `created_at` string, date-time, required
  - `updated_at` string, date-time, required
  - `name` string, nullable, required
  - `routing_strategy` 'economy' | 'performance', required
  - `active` boolean, required
  - `bypass_credit_check` boolean, required

## Other responses

- `400` — Bad request (invalid domains, routing strategy, or missing fields)
- `401` — Unauthorized
- `500` — Internal server error

---

[API](https://skmtc.net/routemesh/apis/routemesh-api.md) · [All operations](https://skmtc.net/routemesh/apis/routemesh-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/routemesh/routemesh-api/revisions/6590c9d7229d/schema)
