Credit Balance

GET/gateway/v1/me/credits

Returns the remaining credit balance of the workspace that owns the API key. Requires an API key. Free: costs 0 credits and is not recorded in usage history, but counts toward the rate limit.

Usage

Returns the remaining credits of the workspace (Personal or Team) that owns the API key. This is the same balance that Data API and Chat API calls draw from.

curl "https://api.asksurf.ai/gateway/v1/me/credits" \
  -H "Authorization: Bearer $SURF_API_KEY"
{
  "data": { "credit_balance": 12840 },
  "meta": { "credits_used": 0, "cached": false }
}
  • API key required. Requests without an API key, including anonymous free-tier requests, get 401 UNAUTHORIZED.
  • Free. The call costs 0 credits (meta.credits_used is always 0) and is not recorded in usage history.
  • Rate limited. The call counts toward your per-key rate limit like any other request.
Credit Balance
const options = {method: 'GET'};

fetch('https://api.asksurf.ai/gateway/v1/me/credits', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
OK
{
  "$schema": "https://example.com/schemas/DataObjectResponseMeCreditsData.json",
  "data": {
    "credit_balance": 123
  },
  "meta": {
    "cached": true,
    "credits_used": 123,
    "empty_reason": "<string>"
  }
}