API Reference

Profile

Update account settings — token balance, plan, and other profile fields — authenticated by your Reliant API Key. This is the endpoint the Stripe webhook calls when a token pack purchase is confirmed.


PATCH/api/profile

Updates one or more allowed fields on your profile. Only fields in the whitelist below are accepted — any other field in the body is silently ignored.

Authentication

Pass your Reliant API Key in the X-Reliant-Key header. The request is scoped to the account that owns that key.

http
PATCH /api/profile X-Reliant-Key: rel_your_api_key Content-Type: application/json

Allowed fields

FieldTypeDescription
planstringSets the account plan directly. Accepted values: free, starter, enterprise.
tokens_balanceintegerSets the token balance to an exact value. Use tokens_increment instead when adding to the current balance.
tokens_incrementintegerAdds the given amount to the current token balance. Accepts negative values to subtract. The result is floored at 0.

Examples

Credit tokens after a purchase

The Stripe webhook calls this automatically when a token pack is confirmed. You can also call it manually:

json — body
{ "tokens_increment": 100000 }

Update plan and credit tokens in one call

json — body
{ "plan": "starter", "tokens_increment": 50000 }

Reset token balance

json — body
{ "tokens_balance": 0 }

Response

Returns the updated profile fields on success.

json — 200 OK
{ "success": true, "profile": { "id": "usr_...", "plan": "starter", "tokens_balance": 150000 } }

Token balance behavior

Balance valueEffect on the assistant
nullNo token limit enforced. Default for all accounts that never purchased a token pack.
> 0Each assistant request debits the actual Anthropic tokens consumed (input + output across all turns).
0Requests are blocked with 402 Payment Required until more tokens are credited.

Error responses

StatusErrorCause
400No valid fields providedBody contains no recognized field.
400tokens must be a positive integertokens_increment is zero, non-integer, or missing.
401Missing X-Reliant-Key headerHeader not sent.
401Invalid API keyNo account found for the provided key.