Platform Sub-Accounts
Builders create one sub-account per end user, give it keys and spend caps, and track usage and earnings.
Units
Create a Platform Key
POST /api/v1/platform/keys creates the builder key used for the other platform calls.
curl -X POST https://api.alterlab.io/api/v1/platform/keys -H "X-API-Key: $ALTERLAB_API_KEY"Create a Sub-Account
POST /api/v1/platform/sub-accounts requires external_user_id and accepts email, billing_mode and caps.
curl -X POST https://api.alterlab.io/api/v1/platform/sub-accounts -H "X-API-Key: $ALTERLAB_API_KEY" -H "Content-Type: application/json" -d '{"external_user_id": "user_123", "email": "user@example.com"}'List, Get, Suspend and Resume
GET /api/v1/platform/sub-accounts (limit, offset), GET /sub-accounts/{sub_id}, POST /suspend and POST /resume.
curl "https://api.alterlab.io/api/v1/platform/sub-accounts?limit=50" -H "X-API-Key: $ALTERLAB_API_KEY"Caps, Keys and Funding
PUT /sub-accounts/{sub_id}/caps sets budget_limit_microcents, request_limit and reset_period. POST /keys mints a key (name, caps). POST /fund adds amount_microcents and needs an idempotency_key so retries do not double-fund.
curl -X POST https://api.alterlab.io/api/v1/platform/sub-accounts/SUB_ID/fund -H "X-API-Key: $ALTERLAB_API_KEY" -H "Content-Type: application/json" -d '{"amount_microcents": 5000000, "idempotency_key": "fund-001"}'Usage, Earnings and Claim
GET /sub-accounts/{sub_id}/usage reports a sub-account's usage and GET /api/v1/platform/earnings reports builder earnings. POST /api/v1/platform/claim lets an end user claim an account with a token and password.
curl https://api.alterlab.io/api/v1/platform/earnings -H "X-API-Key: $ALTERLAB_API_KEY"