Create a sub-user
See Platform API for the request origin and admin authentication.
Send POST /api/v1/org/users to the platform website origin, not the model gateway's /v1 Base URL. Set PLATFORM_ORIGIN to the current deployment's website origin and ORG_ADMIN_KEY to its organization admin key.
curl "$PLATFORM_ORIGIN/api/v1/org/users" \
-H "Authorization: Bearer $ORG_ADMIN_KEY" \
-H "Content-Type: application/json" \
-d '{"name":"Customer A","external_id":"uid_10001","key_name":"My product","key_budget":100,"rate_limit_rpm":60,"max_concurrency":5,"metadata":{"source":"my-product"}}'
| Field | Required | Meaning |
|---|---|---|
name | Yes | 1–120 characters after trimming; case-insensitively unique within the organization, including archived names |
external_id | No | 1–160 characters, unique within the organization; use your product's stable customer ID |
key_name | No | Key label; at most 120 characters are stored |
key_budget | No | Cumulative key spending cap in the organization's currency; omitted or null means no separate cap, not an initial balance |
rate_limit_rpm / rate_limit_tpm | No | Positive integer request/token limits per minute; omitted or null means no separate cap |
max_concurrency | No | Positive integer concurrency cap; omitted or null means no separate cap |
metadata | No | JSON object for your business metadata |
HTTP 201 returns the following shape (additional user/key metadata omitted; the URL uses the current deployment's origin and default locale):
{
"user": {"id":"<org_user_uuid>","org_id":"<org_uuid>","name":"Customer A","external_id":"uid_10001","balance":"0.000000","status":"active"},
"api_key": {"id":"<key_uuid>","secret":"sk-io-<secret>","key_prefix":"sk-io-••••ABCD"},
"statement": {"id":"<access_link_uuid>","token":"<access_link_uuid>","type":"usage","url":"<PLATFORM_ORIGIN>/en/statement/<access_link_uuid>","expires_at":"2026-11-24T09:30:00.000Z"}
}
The user, invocation key, and an initial 30-minute usage statement UUID link are created atomically. Users take effect immediately with a zero balance; issue standalone recharge, recharge-history, or statement links via POST /api/v1/org/access-links. Payment channels follow the account currency. The creation API does not set an initial balance or override the organization's model allowlist for an individual user.
Errors have the shape {"error":"CODE"}: HTTP 401 UNAUTHORIZED for an invalid admin key, 400 INVALID_INPUT for invalid fields, and 409 CONFLICT for duplicate names or external IDs within the organization. Creation has no idempotency-key support. If its outcome is uncertain, first query GET /api/v1/org/users?external_id=uid_10001 before retrying. Keep admin and invocation credentials and creation responses on your trusted backend; distribute only the statement link to the customer.