Platform API: integration and authentication

The Platform API lets other products manage organization sub-users, issue short-lived standalone page links, and retrieve balances, usage records, and recharge history. Its /api/v1 prefix lives on the platform website origin. Model inference uses a separate gateway /v1 Base URL.

Integration sequence

  1. Create an organization in the console and keep its sk-org-… admin key on your backend.
  2. Configure the organization's allowed models and multipliers.
  3. Create a sub-user with your product's stable external_id; save the returned user ID and invocation key (sk-io-…).
  4. Call POST /api/v1/org/access-links with the organization admin key to issue a 30-minute UUID link for recharging, viewing recharge history, or viewing usage statements.
  5. Hand the generated URL directly to the end user—no login required and no raw API key exposed in the URL.

Request origin

PLATFORM_ORIGIN in examples means the current deployment's website origin, without /v1 or /api/v1. Do not substitute the model gateway domain. Each site uses its own deployment origin and account currency. Amounts are never converted or combined across currencies.

curl "$PLATFORM_ORIGIN/api/v1/org/users?external_id=uid_10001" \
  -H "Authorization: Bearer $ORG_ADMIN_KEY"

Credentials and permissions

CredentialPurposeAccepted by standalone user pages
Organization admin key sk-org-…Manage users, model policies, usage, earnings, and issue scoped UUID linksNo
Sub-user API key sk-io-…Call allowed models; passed in the request body when issuing a UUID linkNo
Scoped page UUID (30-min TTL)Strictly 1-to-1 access to one standalone page (usage, recharges, or recharge)Yes
Project keys, personal keys, session cookiesTheir respective product permissions; no organization sub-user identityNo

API authentication uses Authorization: Bearer <credential> and requires no browser session. Keep admin credentials away from end users.

Model access

All sub-users share the organization's model allowlist. Unconfigured or removed models are absent from /v1/models; direct calls return HTTP 403 MODEL_NOT_ALLOWED (a model without an available mapping may return 404 first). An empty organization allowlist permits no models. Key rules may only narrow these permissions.

Endpoint index

Sub-users call the model gateway with their own API key. Generation requests with a zero sub-user balance return 402 ORG_USER_INSUFFICIENT_BALANCE; the organization creator's personal wallet is not used. Requests and earnings appear in organization reporting, outside personal request logs. Sub-user balances and personal wallets are separate.

Method and pathAuthenticationPurpose
GET /api/v1/orgOrganization admin keyRetrieve the organization
PATCH /api/v1/orgOrganization admin keyUpdate its name/default multiplier
GET /api/v1/org/modelsOrganization admin keyRetrieve model policies
PUT /api/v1/org/modelsOrganization admin keySet allowed models and multipliers
POST /api/v1/org/usersOrganization admin keyCreate a sub-user
GET /api/v1/org/usersOrganization admin keyList sub-users
GET /api/v1/org/users/{userId}Organization admin keyRetrieve a user and key metadata
PATCH /api/v1/org/users/{userId}Organization admin keyUpdate name, external ID or metadata
POST /api/v1/org/users/{userId}/recharge-orderOrganization admin keyCreate a recharge order
GET /api/v1/org/usageOrganization admin keyRetrieve organization usage
GET /api/v1/org/earningsOrganization admin keyRetrieve organization earnings
POST /api/v1/org/access-linksOrganization admin keyIssue a 30-minute scoped UUID page link
GET /api/v1/me/statementusage UUIDRead balance and usage charges
GET /api/v1/me/rechargesrecharges UUIDRead balance and credited recharge history
GET /api/v1/me/recharge-portalrecharge UUIDRead balance and currency for the recharge page
POST /api/v1/me/recharge-portalrecharge UUIDCreate a recharge order from the standalone page
GET /api/v1/me/recharge-portal/{orderId}recharge UUIDPoll order status on the standalone recharge page

Errors and retries

Errors have the shape {"error":"CODE"}. Common statuses are 400 (invalid input), 401 (invalid or expired credential), 404 (resource absent or outside this organization), and 409 (duplicate organization-scoped name or external ID).

User creation has no idempotency-key support. If a response is uncertain, query by the stable external_id before retrying. Credential, balance, recharge, and statement responses are not cached.