Skip to Content
APIEndpointsGet credit balance

Get credit balance

The workspace’s remaining credit allowance. Credits are consumed by paid actions such as content generation and technical site audits.

API calls do not consume credits. For API request volume see Usage. The two are kept separate deliberately so neither is mistaken for the other.

GET /v1/brands/{brand_id}/credits

Authorization

HeaderTypeRequired
AuthorizationBearer asky_sk_…required

Path parameters

ParameterTypeRequiredDescription
brand_iduuidrequiredFrom List brands

Query parameters

None.

Any parameter you pass returns 400 invalid_request naming the offending key, rather than being ignored silently.

Request

curl --request GET \ --url 'https://api.askylabs.com/v1/brands/242546de-4cee-4a7d-952e-f6aa60c63ef8/credits' \ --header 'Authorization: Bearer <api-key>'

Response

{ "data": { "brand_id": "242546de-4cee-4a7d-952e-f6aa60c63ef8", "has_data": true, "included_credits_remaining": 1840, "topup_credits_remaining": 500, "total_credits_remaining": 2340, "current_period_end": "2026-09-01T00:00:00.000Z" }, "request_id": "req_cd5f81b03e7a49d2b6c7" }

Response fields

FieldTypeDescription
data.brand_iduuidrequired
data.has_databooleanrequired. false when the workspace has no billing record. Every other field is then absent
data.included_credits_remainingnumberFrom the plan. Refills each billing period
data.topup_credits_remainingnumberPurchased packs. Drained only after the included pool
data.total_credits_remainingnumberThe two above, summed
data.current_period_endtimestamptz | nullWhen the included pool refills
request_idstringrequired. Also returned as the x-request-id header. Quote it when contacting support

Errors

StatusCodeWhen
400invalid_requestA parameter is unknown or malformed. The message names it
401invalid_tokenThe key is missing, malformed, or does not exist
401token_expiredThe key passed its expiry date
401token_revokedThe key was revoked
404not_foundThe brand does not exist, or this key is not allowed to reach it. The two are deliberately indistinguishable
429rate_limitedOver 300 requests per minute. See the Retry-After header

Notes

Credits belong to the workspace, not the brand. The brand in the path is how the request is authorized, not how the balance is scoped — two brands in one workspace return the same numbers.

Check has_data before reading any figure. When it is false the balance fields are absent rather than zero, because “no billing record” and “nothing left” are different states.

Last updated on