Billing ›
Get billing
GET
/v1/billingWhere the account stands: its plan, the month's usage, what is left.
RequestTypeScript
- import { Agental } from "agental-sdk";
- const agental = new Agental();
- const billing = await agental.billing();
Answer200 OK · Billing
- {
- "provider": "stripe" | "not_configured",
- "testMode": boolean,
- "enforced": boolean,
- "needsPlan": boolean,
- "status": "none" | "trialing" | "active" | "past_due" | "paused" | "canceled",
- "plan": {
- "id": string,
- "dollarsPerMonth": integer,
- "includedMicros": integer,
- "runningUnits": integer,
- "freeBurstUnits": integer,
- "sandboxesAtOnce": integer,
- … 2 more
- },
- "period": {
- "start": string,
- "end": string,
- },
- "free": {
- "cardSaved": boolean,
- "paid": boolean,
- "unpaidUnits": integer,
- },
- "includedMicros": integer,
- … 15 more
- }
Where the caller's account stands: its plan, what it has used of the month, what is left of its top-ups, and whether it may run a sandbox.
Headers
AuthorizationrequiredBearer key | An API key that may make this call. |
Returns
200 Where the caller's account stands: its plan, what it has used of the month, what is left of its top-ups, and whether it may run a sandbox. Amounts are millionths of a US dollar.
Billing24 fields
providerstripenot_configured
Who sells here.
More
stripe: plans and top-ups are bought from agental, through Stripe. not_configured: nothing can be bought.testModeboolean
True while the payment provider is in its test mode: nothing is really charged.
enforcedboolean
Whether a plan is needed to run a sandbox.
More
False: plans are shown and sold, and nothing is held to them.needsPlanboolean
True while this account must save a card, or buy a plan, before it uses agental: plans are enforced here, and it is on the free plan with no card saved.
More
The console shows that choice before anything else while it is.statusnonetrialingactivepast_duepausedcanceled
The subscription to a plan bought by the month, as the payment provider names it.
More
none or canceled: the account is on the free plan.planobjectnull8 fields
The plan the account is on: one bought by the month while it is live, else the free plan.
More
Null where plans are not enforced on it and it has none bought.idstring
dollarsPerMonthinteger
includedMicrosinteger
runningUnitsinteger
Small sandboxes the plan runs at once.
More
A medium counts 2, a large 4, a tiny half. A create, fork or start past it is refused with 429 running_limit_reached.freeBurstUnitsinteger
Small sandboxes the plan starts at once for nothing, counted as runningUnits is.
More
Starting faster costs a burst fee: see burstFee, and GET /v1/burst for an account's own.sandboxesAtOnceinteger
The same as runningUnits: small sandboxes the plan runs at once.
More
Sent for clients that read it, and it will be removed.burstobject3 fields
Kept for clients that read it: the free burst in megabytes.
More
Nothing is refused for speed now; a start faster than the free burst costs a fee.tierinteger
The plan's place among the plans, 0 for the free plan.
perQuarterMbinteger
The plan's free burst, in megabytes: freeBurstUnits times 4096.
perHourMbinteger
The same as perQuarterMb.
sizesstring[]
periodobjectnull2 fields
The month the plan is in.
More
On the free plan, from where its use was last settled against its credits to the next month's start, in UTC.startstring
endstring
freeobjectnull3 fields
Set while the account is on the free plan.
cardSavedboolean
Whether the account has a card saved, which it must before it runs anything, and so has had its credit.
paidboolean
Whether it has paid for anything.
More
Until it has, it runs and starts at most unpaidUnits small sandboxes at once.unpaidUnitsinteger
includedMicrosinteger
usedMicrosinteger
What has been used this month at list price: running time, mail, stopped sandboxes and snapshots past the free ones.
discountobject3 fields
Retired: bigger top-ups get a bonus instead.
More
Always 0, 0 and null, sent for clients that read it.microsinteger
percentnumber
nextobjectnull2 fields
fromMicrosinteger
percentnumber
mailMicrosinteger
The part of usedMicros that is mail: 500 a message, received or sent, which is $0.50 a thousand.
stoppedMicrosinteger
The part of usedMicros that is stopped sandboxes, at 5% of their running price, or 10% while one keeps its memory.
snapshotMicrosinteger
The part of usedMicros that is snapshots past the free ones.
burstMicrosinteger
The part of usedMicros that is burst fees: what starts faster than the plan's free burst cost.
More
GET /v1/burst says where the account stands.carriedMicrosinteger
What an earlier month ran past its plan and its top-ups.
More
This month's credits pay it first, then the top-ups. On the free plan, what the account owes now: what it has run past its credits.topUpMicrosinteger
What is left of the credits bought on top of the plan, and of the free plan's credit.
More
It is used after the month's credits, and it does not expire.sandboxesAtOnceintegernull
The same as runningUnits: small sandboxes the plan runs at once.
More
Sent for clients that read it, and it will be removed.cancelAtPeriodEndboolean
canRunboolean
reasonbilling_requiredout_of_creditnullnull
autoReloadobjectnull1 field
The auto-reload: when the month's credits and the top-ups run out, the card saved at the last purchase is charged for a top-up of this many US dollars, with tax, and its credits are added at once, before any sandbox is stopped.
More
Null while it is off. Set with PUT /v1/billing/auto-reload.dollarsinteger
The top-up charged, in whole US dollars.
canAutoReloadboolean
Whether an auto-reload can be set: Stripe sells here, and the account has saved a card there, or bought a plan or a top-up.
lapseobjectnull3 fields
Set while the account has no card saved, or has used its credits, and still holds sandboxes or snapshots.
More
The account is emailed when it begins, 7 days before deletesAt and the day before; the account itself stays open. A top-up that pays what is owed, a card saved, a plan started, or deleting everything ends it. Null otherwise, and always where plans are not enforced.reasonno_planunpaidout_of_credit
no_plan: the account is on the free plan with no card saved.
More
out_of_credit: it is on the free plan and its credits are used. unpaid: it has a plan bought by the month and owes for what it used past the plan's credits and its top-ups, from a month that has closed.lapsedAtstring
When the account was first seen with no plan, or owing, while it held sandboxes or snapshots.
deletesAtstring
When its sandboxes and snapshots are deleted, with the mail they received, unless what is owed is paid, a card saved or a plan started first.