Skip to main content
Create an API namespace for organizing keys by environment, service, or product. Use this to separate production from development keys, isolate different services, or manage multiple products. Each API gets a unique identifier and dedicated infrastructure for secure key operations. Important: API names must be unique within your workspace and cannot be changed after creation. Required permissions:
  • api.*.create_api (to create APIs in any workspace)
See the API reference for the full HTTP endpoint documentation.

Usage

unkey api apis create-api [flags]

Flags

--name
string
required
Unique identifier for this API namespace within your workspace. Use descriptive names like payment-service-prod or user-api-dev to clearly identify purpose and environment. Must be 3-255 characters, start with a letter, and contain only letters, numbers, dots, hyphens, and underscores.

Global Flags

FlagTypeDescription
--root-keystringOverride root key ($UNKEY_ROOT_KEY)
--api-urlstringOverride API base URL (default: https://api.unkey.com)
--configstringPath to config file (default: ~/.unkey/config.toml)
--outputstringOutput format — use json for raw JSON

Examples

unkey api apis create-api --name=payment-service-prod

Output

Default output shows the request ID with latency, followed by the created API:
req_2c9a0jf23l4k567 (took 45ms)

{
  "id": "api_1234abcd",
  "name": "payment-service-prod"
}
With --output=json, the full response envelope is returned:
{
  "meta": {
    "requestId": "req_2c9a0jf23l4k567"
  },
  "data": {
    "id": "api_1234abcd",
    "name": "payment-service-prod"
  }
}
Last modified on March 26, 2026