Top up in one click when you run low
const url = 'https://api.sloose.com/orgs/org_9f3c/billing/low-balance';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"enabled":true,"threshold":1,"packKey":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.sloose.com/orgs/org_9f3c/billing/low-balance \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "enabled": true, "threshold": 1, "packKey": "example" }'Whether, and when, the org’s owner and administrators are told its AI credits are running low: a credits_low notice on Usage & credits and in the banner, and its mail, once per shortfall, with the pack one click away. What is short is what the org holds — its included and purchased credits, whatever calls in flight have reserved. Nothing is charged by it: Stripe sells every pack, and a buyer who saved a card with an earlier pack is offered it again by the pack’s Checkout, so they pay with one press. The notice ends when a grant (a pack, a period’s credits, staff’s) or this setting leaves the org holding the threshold or more, or when this is turned off.
Session only: billing is a person’s to manage, never an org’s API token’s (D5).
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The org id the session was issued for. A token for one org can never read another.
Example
org_9f3cThe org id the session was issued for. A token for one org can never read another.
Request Bodyrequired
Section titled “Request Bodyrequired”object
A whole number of credits, 0 to 1,000,000.
A pack on sale, or null for the first on sale.
Examplegenerated
{ "enabled": true, "threshold": 1, "packKey": "example"}Responses
Section titled “Responses”The settings as they now stand.
object
Whether the owner and administrators are told — a credits_low notice and its mail — when the credits the org holds (included and purchased) fall below threshold. Nothing is ever charged by it: the notice links to the pack, whose Checkout offers again a card a buyer chose to save with an earlier pack.
Tell them when the credits the org holds fall below this.
The most a threshold may be: what a page bounds its box by.
The pack the notice offers; null is the smallest on sale — and so is a pack chosen before that is no longer on sale, which reads as null.
Examplegenerated
{ "enabled": true, "threshold": 1, "thresholdMost": 1, "packKey": "example"}A threshold that is not a whole number of credits from 0 to 1,000,000, or a pack not on sale.
object
Examplegenerated
{ "error": "example"}No bearer, or one that is expired, revoked or no longer resolves to a member.
The error envelope every non-2xx answer uses.
object
Human-readable explanation.
Machine-readable reason. Absent on a few legacy 400s.
Examplegenerated
{ "error": "example", "code": "example"}The bearer’s role is too low, it was issued for a different org, it is an API token (SESSION_REQUIRED), or it is a staff member’s view of the org (IMPERSONATION_REFUSED; a read-only view is refused before this, IMPERSONATION_READ_ONLY).
The error envelope every non-2xx answer uses.
object
Human-readable explanation.
Machine-readable reason. Absent on a few legacy 400s.
Examplegenerated
{ "error": "example", "code": "example"}