Skip to content

Top up in one click when you run low

POST
/orgs/{org}/billing/low-balance
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).

org
required

The org id the session was issued for. A token for one org can never read another.

string
Example
org_9f3c

The org id the session was issued for. A token for one org can never read another.

Media typeapplication/json
object
enabled
boolean | null
threshold

A whole number of credits, 0 to 1,000,000.

integer | null
<= 1000000
packKey

A pack on sale, or null for the first on sale.

string | null
key
additional properties
Examplegenerated
{
"enabled": true,
"threshold": 1,
"packKey": "example"
}

The settings as they now stand.

Media typeapplication/json
object
enabled
required

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.

boolean
threshold
required

Tell them when the credits the org holds fall below this.

number
thresholdMost
required

The most a threshold may be: what a page bounds its box by.

number
packKey
required

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.

string | 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.

Media typeapplication/json
object
error
required
string
key
additional properties
Examplegenerated
{
"error": "example"
}

No bearer, or one that is expired, revoked or no longer resolves to a member.

Media typeapplication/json

The error envelope every non-2xx answer uses.

object
error
required

Human-readable explanation.

string
code

Machine-readable reason. Absent on a few legacy 400s.

string
key
additional properties
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).

Media typeapplication/json

The error envelope every non-2xx answer uses.

object
error
required

Human-readable explanation.

string
code

Machine-readable reason. Absent on a few legacy 400s.

string
key
additional properties
Examplegenerated
{
"error": "example",
"code": "example"
}

Report a problem with this page