Get usage
/v1/usageRunning time and list-price cost of your sandboxes, by sandbox, key, day and hour. apiKeyId narrows it to one key or several.
- import { Agental } from "agental-sdk";
- const agental = new Agental();
- const usage = await agental.usage();
- {
- "since": string,
- "until": string,
- "seconds": integer,
- "listCostMicros": integer,
- "stopped": {
- "seconds": integer,
- "listCostMicros": integer,
- },
- "snapshots": {
- "kept": integer,
- "free": integer,
- "chargedSeconds": integer,
- "listCostMicros": integer,
- },
- "mail": {
- "received": integer,
- "sent": integer,
- "costMicros": integer,
- "sandboxes": object[],
- },
- "sandboxes": [{
- "sandboxId": string,
- "name": string | null,
- "size": string,
- "running": boolean,
- "seconds": integer,
- "listCostMicros": integer,
- … 2 more
- }],
- "keys": [{
- "apiKeyId": string | null,
- "name": string | null,
- "sandboxes": integer,
- "seconds": integer,
- "listCostMicros": integer,
- }],
- … 6 more
- }
Running time of the caller's sandboxes and what it comes to at the list price: the total, each sandbox, each API key that made them, each day and each hour.
Query
sincestring | Count running time from this moment. An ISO 8601 date and time. e.g. "2026-10-01T00:00:00Z" |
untilstring | Count running time up to this moment. Now when omitted, and never later than now. |
apiKeyIdstring | Only the sandboxes these API keys made: one key id, or several separated by commas, at most 100, with console for those made in the console and runs-on for those GitHub Actions jobs ran on. The total, stopped, mail, sandboxes, days and hours are narrowed to them, and snapshots, which are the account's, is zero; keys stays the whole account's. e.g. "key_3f9a1c2b7d4e5f60,console" |
Headers
AuthorizationrequiredBearer key | An API key that may make this call. |
Returns
200 Running time of the caller's sandboxes and what it comes to at the list price: the total, each sandbox, each API key that made them, each day and each hour. Stopped time, snapshots past the free ones and mail are beside it, apart. Sandboxes deleted since are included. Without since, this month so far in UTC. With apiKeyId, only the sandboxes those keys made.
sinceuntilsecondsMore
A sandbox that is running is counted up to now.listCostMicrosMore
27000 is $0.027. Not a charge.stoppedsecondsMore
A sandbox deleted while its snapshots kept its machine counts as stopped until the last of them goes.listCostMicrosMore
Not a charge here: GET /v1/billing says what is.snapshotsMore
Zero with apiKeyId, as snapshots are the account's and not a key's.keptfreechargedSecondslistCostMicrosMore
Not a charge here: GET /v1/billing says what is.mailMore
It is counted by UTC day, so a window takes the whole of every day it touches. Deleting a message, or a sandbox, takes nothing away from it. The total, and a line for each sandbox that had any. With apiKeyId, only those keys' sandboxes' mail.receivedsentcostMicrosMore
It is paid from what the plan includes, as machine time is.sandboxessandboxIdnamereceivedsentcostMicrosMore
It is paid from what the plan includes, as machine time is.sandboxessandboxIdnamesizerunningsecondsMore
A sandbox that is running is counted up to now.listCostMicrosMore
27000 is $0.027. Not a charge.stoppedSecondsstoppedListCostMicroskeysMore
Always the whole account's, whatever apiKeyId says.apiKeyIdMore
Null is the console.nameMore
Null for the console, and for a key deleted since.sandboxessecondsMore
A sandbox that is running is counted up to now.listCostMicrosMore
27000 is $0.027. Not a charge.membersMore
Always the whole organization's, whatever apiKeyId says. GET /v1/organizations/{id}/members names them.userIdMore
Null for sandboxes made by whoever runs the service.sandboxessecondsMore
A sandbox that is running is counted up to now.listCostMicrosMore
27000 is $0.027. Not a charge.daysMore
Added up, the days come to the totals.daysecondsMore
A sandbox that is running is counted up to now.listCostMicrosMore
27000 is $0.027. Not a charge.stoppedsecondsMore
A sandbox deleted while its snapshots kept its machine counts as stopped until the last of them goes.listCostMicrosMore
Not a charge here: GET /v1/billing says what is.snapshotsMore
Zero with apiKeyId.chargedSecondslistCostMicrosmailreceivedsentcostMicrosMore
It is paid from what the plan includes, as machine time is.hoursMore
Hours nothing ran in are left out.hoursandboxessecondsMore
A sandbox that is running is counted up to now.listCostMicrosMore
27000 is $0.027. Not a charge.currencycostMore
Null: nothing is charged here.billingErrors and other answers
| 400 | since is not before until, or the two are more than 366 days apart. |
| 404 | Not found. |
Every error answers { "error": { "code", "message" } }; a key without the action a call needs answers 403 key_action_forbidden, naming it.