Token format
Common scopes
| Scope | Grants |
|---|---|
usage:read | Read usage counters for a specific customer |
invoices:read | Read invoices for a specific customer |
transfers:read | List transfers the customer is party to |
agents:read | List agents owned by the customer |
customer_id = cust_abc” — so one portal token cannot see another customer’s data.
Create a portal token
Your backend mints the token on demand, typically when a customer loads their dashboard:Use a portal token
From the browser (or anywhere):403 Forbidden. Calls after expires_at return 401.
Revoke a token
Typical integration pattern
pk_live_* to the browser. The portal token is scoped, expiring, and customer-bound.
Security practices
- Short TTLs. Default to 1 hour. Re-mint on page load if needed.
- One customer_reference per token. Never mint a token that spans customers.
- Read-only scopes by default. Write operations should flow through your backend.
- Log every portal_token mint for audit. Include the requesting customer’s identity.
