Skip to content
POST /tenant

Explicitly create a tenant in the environment. Use this when you want to attach metadata (tier, region, billing plan) to a customer before they connect their first account.

If you skip this step and just connect an account (via POST /link-token then a successful connection, or a direct POST /integrated-account) with a new tenant_id, Truto auto-creates the tenant row when the integrated account is created (as long as the id can be carried in a URL path segment). Creating the link token alone does not materialize the tenant. The auto-created tenant has name = id and metadata = {}.

id must be unique within the environment — creating the same id twice returns 409 Conflict. Use POST /tenant/bulk for idempotent batch inserts.

Request Body

environment_idstring · uuid

Which environment to create the tenant in. Required for session auth; ignored for API tokens (inferred from the token).

Example: 8a2b104d-74a6-47f2-b93e-c6b611e82391
idstring

Your identifier for the tenant. Free-form up to 255 characters — /, spaces and non-ASCII are all fine. Control characters, leading or trailing whitespace, and the dot segments . and .. are rejected. Immutable — cannot be changed later.

Example: acme-corp
metadataRecord<string, any>

Free-form JSON object. Stored and returned verbatim.

Example: {"tier":"gold","region":"wnam"}
namestring

Display name. Defaults to id when omitted.

Example: Acme Corp

Response Body

created_atstring · date-time

The date and time when the tenant was created.

Example: 2026-07-02T09:14:03.117Z
environment_idstring · uuid

The environment this tenant belongs to.

Example: 8a2b104d-74a6-47f2-b93e-c6b611e82391
idstring

The tenant identifier — caller-chosen and immutable once created. Unique within its environment, so the same value can exist independently in each environment (for example development, staging and production). Free-form up to 255 characters: whatever you already use to identify a customer, including /, spaces and non-ASCII. The only values rejected are the ones no URL path segment can carry — control characters, leading or trailing whitespace, and the dot segments . and ...

Example: acme-corp
metadataRecord<string, any>

Free-form JSON object stored verbatim. Truto does not interpret this field — use it for tier, region, billing plan, or any other customer attribute your app cares about.

Example: {"tier":"gold","region":"wnam"}
namestring

Display name shown in the dashboard. Defaults to the tenant id on create if not supplied; can be edited later via PATCH /tenant/{id}.

Example: Acme Corp
updated_atstring · date-time

The date and time when the tenant was last updated.

Example: 2026-07-02T09:14:03.117Z

Errors

StatusDescription
400Invalid tenant id, missing environment_id on session auth, or invalid body.
409A tenant with this id already exists in the environment.
curl -X POST 'https://api.truto.one/tenant' \
  -H 'Authorization: Bearer <your_api_token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "id": "acme-corp",
  "name": "Acme Corp",
  "metadata": {
    "tier": "gold",
    "region": "wnam"
  },
  "environment_id": "8a2b104d-74a6-47f2-b93e-c6b611e82391"
}'
const body = {
  "id": "acme-corp",
  "name": "Acme Corp",
  "metadata": {
    "tier": "gold",
    "region": "wnam"
  },
  "environment_id": "8a2b104d-74a6-47f2-b93e-c6b611e82391"
};

const response = await fetch('https://api.truto.one/tenant', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer <your_api_token>',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify(body),
});

const data = await response.json();
console.log(data);
import requests

url = "https://api.truto.one/tenant"
headers = {
    "Authorization": "Bearer <your_api_token>",
    "Content-Type": "application/json",
}
params = {
}
payload = {
    "id": "acme-corp",
    "name": "Acme Corp",
    "metadata": {
        "tier": "gold",
        "region": "wnam"
    },
    "environment_id": "8a2b104d-74a6-47f2-b93e-c6b611e82391"
}

response = requests.post(url, headers=headers, params=params, json=payload)
print(response.json())