Change automatic top-up settings
const url = 'https://api.sloose.com/billing/autotopup';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"enabled":true,"threshold":1,"monthlyCapCents":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/billing/autotopup \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "enabled": true, "threshold": 1, "monthlyCapCents": 1, "packKey": "example" }'Saving always clears a pause: if top-up stopped because a charge failed or the cap was hit, changing the settings is how you say you have dealt with it.
Authorizations
Section titled “Authorizations”Request Body
Section titled “Request Body”object
Top up when available credits fall below this. Non-negative.
Never spend more than this per calendar month.
Which credit pack to buy. Must be a pack we sell.
Examplegenerated
{ "enabled": true, "threshold": 1, "monthlyCapCents": 1, "packKey": "example"}Responses
Section titled “Responses”Settings as they now stand.
object
Top up when the available balance falls below this.
Never spend more than this in a calendar month.
Why automatic top-up stopped — a failed charge, or the monthly cap. Saving settings clears it.
Examplegenerated
{ "enabled": true, "threshold": 1, "monthlyCapCents": 1, "packKey": "example", "spentCentsThisMonth": 1, "spentMonth": "example", "pausedReason": "example"}packKey is not a pack we sell.
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, or it was issued for a different org.
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"}