LoadingSkip to main content

Account

Get account credits

Query the formal account credit wallet belonging to the API Key or OAuth token owner.

Endpoint

GET/api/v1/developer/credits

Authentication & scope

Authorization: Bearer <credential>; formal account API Key / OAuth only.

Scope: credits:read

API Keys and OAuth tokens read their owner's formal PerchanceAI account wallet. Multiple keys share the account balance. The three balance fields currently return the same account credit value; use the returned currency for its unit.

Request parameters

No request body or query parameters.

curl --request GET \
  --url 'https://api.perchanceai.art/api/v1/developer/credits' \
  --header 'X-App-Id: perchanceai' \
  --header 'X-Request-Id: docs-example' \
  --header 'Authorization: Bearer <formal_account_credential>'

Response HTTP 200

Illustrative response shape, not a live API response. Example numbers and USD do not imply fixed pricing or a cash balance. Null fields are omitted.

REST success responses contain success, code, message, request_id and data; the table describes data.

FieldTypeRequiredDescription
modestringYesformal for a formal account credential.
balance_credits / available_credits / remaining_creditsintegerYesAll three currently return the same account credit balance; the unit follows the returned currency.
currencystringYesAccount currency configuration; never infer a cash balance or fixed pricing from this field.
{
  "success": true,
  "code": "OK",
  "message": "OK",
  "request_id": "docs-example",
  "data": {
    "mode": "formal",
    "balance_credits": 120,
    "available_credits": 120,
    "remaining_credits": 120,
    "currency": "USD"
  }
}

Errors

  • 401 — DEVELOPER_TOKEN_REQUIRED
  • 401 — DEVELOPER_TOKEN_INVALID / DEVELOPER_TOKEN_EXPIRED / DEVELOPER_TOKEN_REVOKED
  • 403 — DEVELOPER_SCOPE_INSUFFICIENT

Missing bearer returns REQUIRED; invalid credentials, including historical anonymous tokens, return INVALID. Expired or revoked credentials use their corresponding codes.

{
  "success": false,
  "code": "DEVELOPER_TOKEN_REQUIRED",
  "message": "A developer bearer token is required.",
  "request_id": "docs-example"
}