Skip to main content

create-api

Create an API namespace in Unkey using the CLI. Organize your keys by environment, service, or product with a single terminal command.
1 min read

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)
Note

See the API reference for the full HTTP endpoint documentation.

Usage#

Flags#

--namestringrequired#

Human-readable name for this API namespace within your workspace. Use a descriptive name like Payment Service (prod) or user-api-dev to identify its purpose and environment. Must be 3-256 characters.

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
--bodystringSend this JSON string as the request body. You cannot combine it with request-building flags.

Examples#

Output#

Default output shows the request ID, followed by the created API:

With --output=json, the full response envelope is returned: