Skip to main content
POST
/
v1
/
agent
/
{id}
/
balance
Update Token Balance
curl --request POST \
  --url https://api.app.shinzo.ai/v1/agent/{id}/balance \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "amount": 123,
  "type": "<string>"
}
'

Authentication

Requires JWT token or Platform API key via Authorization: Bearer <token> header.
id
string
required
Agent UUID
amount
number
required
Number of output tokens to add (increment) or set as the new balance (set)
type
string
required
Update type: increment (adds to current balance) or set (replaces balance)

Example Request

Increment Balance

curl -X POST https://api.app.shinzo.ai/v1/agent/a1b2c3d4-e5f6-7890-abcd-ef1234567890/balance \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 500000,
    "type": "increment"
  }'

Set Balance

curl -X POST https://api.app.shinzo.ai/v1/agent/a1b2c3d4-e5f6-7890-abcd-ef1234567890/balance \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 1000000,
    "type": "set"
  }'

Example Response

{
  "message": "Agent balance updated successfully",
  "new_balance": 1500000,
  "previous_balance": 1000000
}
Token balance controls how many output tokens the agent can generate. At Sonnet 4.5 pricing (~15permilliontokens),abalanceof1,000,000tokens15 per million tokens), a balance of 1,000,000 tokens ≈ 15 of usage.

Status Codes

CodeDescription
200Balance updated successfully
400Invalid amount or type
401Unauthorized - invalid or missing authentication
404Agent not found