APIBeginnersUpdated

Balance Query API

Query your account balance and plan usage with your API key — ideal for your own scripts or monitoring.

Endpoint & Authentication

GET https://api.icodeeasy.cc/v1/user/balance

The path without the /v1 prefix, https://api.icodeeasy.cc/user/balance, works as well.

Authenticate with your own API key using any one of these headers:

Authorization: Bearer <your API key>
X-Api-Key: <your API key>
x-goog-api-key: <your API key>

Response Fields

FieldTypeDescription
is_activebooleanWhether the account is enabled
balancenumberAvailable balance (yuan)
unitstringCurrency, always CNY
plan_typestringPlan type: balance for pay-as-you-go users, monthly_limit_* for monthly plan users
daily_limitnumberMonthly plan daily quota (yuan), 0 for non-plan users
daily_usednumberMonthly plan quota used today (yuan)
daily_remainingnumberMonthly plan quota remaining today (yuan)
plan_expires_atstring/nullPlan expiry time (ISO 8601), null without a monthly plan

Examples

curl:

curl https://api.icodeeasy.cc/v1/user/balance \
  -H "Authorization: Bearer <your API key>"

Example response:

{
  "is_active": true,
  "balance": 80.28,
  "unit": "CNY",
  "plan_type": "balance",
  "daily_limit": 0,
  "daily_used": 0,
  "daily_remaining": 0,
  "plan_expires_at": null
}

Python:

import requests

resp = requests.get(
    "https://api.icodeeasy.cc/v1/user/balance",
    headers={"Authorization": "Bearer <your API key>"},
    timeout=10,
)
resp.raise_for_status()
data = resp.json()
print(f"Balance: ¥{data['balance']:.2f} ({data['unit']})")

Notes

  • Balances are in Chinese yuan (CNY). Monthly plan users should mainly watch daily_remaining (daily quota); balance is the backup balance charged after the daily quota runs out.
  • This endpoint only queries balance. It always returns normally — even with a zero balance — and is never blocked by the balance check.
  • A 401 response means the API key is missing or invalid; is_active: false means the account has been disabled.
  • If api.icodeeasy.cc is slow, switch to a backup domain: https://jp.icodeeasy.cc or https://sg.icodeeasy.cc.