Skip to main content
GET
/
v1
/
credits
/
balance
Get credit balance
curl --request GET \
  --url https://api.magica.com/api/v1/credits/balance \
  --header 'Authorization: <authorization>'
{
  "availableBalance": 123,
  "formatted": "<string>",
  "hasActiveSubscription": true,
  "isOrganization": true
}
Returns the current credit balance for the authenticated user (or the user’s active organization, if applicable).
Pair this with POST /v1/workflows/estimate-credits or POST /v1/nodes/estimate-credits to confirm there’s enough balance before kicking off an expensive run.

Authorizations

Authorization
string
required
Bearer API key. Format: Bearer gx_your_api_key.

Response

availableBalance
number
Raw credit balance in microcredits. Divide by 1,000,000 to convert to credits. Use formatted if you just need a display string.
formatted
string
Human-readable balance, denominated in millions (e.g. "1.23M").
hasActiveSubscription
boolean
true when the user’s (or org’s) subscription is currently active.
isOrganization
boolean
true when the returned balance belongs to an organization the user is a member of, rather than the user’s personal account.

Request

curl https://api.magica.com/api/v1/credits/balance \
  -H "Authorization: Bearer $MAGICA_API_KEY"

Response example

{
  "availableBalance": 26170000,
  "formatted": "26.17M",
  "hasActiveSubscription": true,
  "isOrganization": false
}

Errors

StatusReason
401Missing or invalid API key
500Server error