Skip to content

Create a tenant.

POST
/api/admin/tenants
Code sample: Shell / cURL
curl --request POST \
--url https://auth.example.com/api/admin/tenants \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "id": "acme", "name": "Acme Corp" }'

Create a tenant as a platform-level administrator. The server assigns lifecycle state, default status, and timestamps; callers provide only the tenant identifier and display metadata. This endpoint does not use X-Tenant-Id because the target tenant is being created.

Media type application/json

Tenant creation input. The server sets lifecycle_state, is_default, created_at, and updated_at; those fields must not be supplied by callers.

object
id
required

Stable tenant identifier. Must be a DNS-label-style lowercase value.

string
>= 1 characters <= 63 characters /^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/
tenant_code

Optional human-facing tenant code. Defaults to id when omitted.

string
>= 1 characters <= 63 characters /^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/
name
required
string
>= 1 characters <= 200 characters
description
string
<= 500 characters
key
additional properties
Examples

Create a tenant with the default tenant code.

{
"id": "acme",
"name": "Acme Corp"
}

Tenant mutation response. Timestamps and lifecycle fields are assigned by the server and are not accepted in the create request body.

Media type application/json

Tenant row returned by create, update, set-default, and other tenant mutation operations.

object
id
required
string
tenant_code
required
string
name
required
string
description
required
string | null
lifecycle_state
required
string
Allowed values: provisioning active suspended frozen migration_read_only deleting deleted restore_pending restore_validating
is_default
required
boolean
created_at
required

Unix timestamp in seconds.

integer format: int64
updated_at
required

Unix timestamp in seconds.

integer format: int64
provisioning

Present on tenant D1 pool create and provisioning retry responses.

object
mode
string
slot_id
string
smoke_test
string
Allowed values: passed
retry
string
Allowed values: succeeded
key
additional properties
key
additional properties
Examples

Tenant created in the shared control-plane database.

{
"id": "acme",
"tenant_code": "acme",
"name": "Acme Corp",
"description": "Production tenant for Acme Corp.",
"lifecycle_state": "active",
"is_default": false,
"created_at": 1770000000,
"updated_at": 1770000000
}