apis

Create API namespace

Changed on

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

Your root key must have one of the following permissions:

  • api.*.create_api (to create APIs in any workspace)
post/v2/apis.createApi

Request

  • Base URL
    https://api.unkey.com
  • URL
    https://api.unkey.com/v2/apis.createApi
  • Auth
    HTTP bearer

Request body

namestring required

Human-readable name for this API within your workspace. Use descriptive names like 'Payment Service (prod)' or 'user-api-dev' to clearly identify purpose and environment.

Example request

{
  "name": "Payment Service (prod)"
}

Response

API namespace created successfully. The response contains the unique API ID for referencing this namespace in key operations.

Example response

{
  "meta": {
    "requestId": "req_123"
  },
  "data": {
    "apiId": "api_2cGKbMxRjIzhCxo1IdjH3a"
  }
}

Changes

    • info

      the request property's maxLength was increased from 255 to 256

    • info

      removed the pattern ^[a-zA-Z][a-zA-Z0-9._-]*$ from the request property

    • info

      the endpoint scheme security bearer was added to the API

    • info

      the endpoint scheme security rootKey was removed from the API