Docs
Account, keys and webhooks ›

Get sandbox usage

GET/v1/sandboxes/{id}/usage

The same for one sandbox.

RequestTypeScript
  1. import { Agental } from "agental-sdk";
  2. const agental = new Agental();
  3. const sandbox = await agental.sandboxes.get("sbx_2a9a47e50daec64a");
  4. const usage = await sandbox.usage();
Answer200 OK · SandboxUsage
  1. {
  2. "sandboxId": string,
  3. "durationMs": integer,
  4. "since": string | null,
  5. "until": string,
  6. "seconds": integer,
  7. "listCostMicros": integer,
  8. "stopped": {
  9. "seconds": integer,
  10. "listCostMicros": integer,
  11. },
  12. "mail": {
  13. "received": integer,
  14. "sent": integer,
  15. "costMicros": integer,
  16. },
  17. "currency": "usd",
  18. … 2 more
  19. }

Running time of one sandbox and what it comes to at the list price, and its stopped time apart, at the stopped price.

Path

idrequired
string
e.g. "sbx_0123456789abcdef"

Query

since
string
Count running time from this moment. An ISO 8601 date and time. e.g. "2026-10-01T00:00:00Z"
until
string
Count running time up to this moment. Now when omitted, and never later than now.

Headers

Authorizationrequired
Bearer key
An API key that may make this call.

Returns

200 Running time of one sandbox and what it comes to at the list price, and its stopped time apart, at the stopped price. Without since, its whole life.

SandboxUsage11 fields
sandboxId
string
durationMs
integer
Every millisecond the sandbox has run in its life, whatever the window.
since
stringnull
Start of the window.
More Null means the sandbox's whole life.
until
string
seconds
integer
Whole seconds run inside the window, counted by the meter.
More A sandbox that is running is counted up to now.
listCostMicros
integer
What those seconds come to at the list price, in millionths of a US dollar.
More 27000 is $0.027. Not a charge.
stopped
object2 fields
Stopped time, apart from the running time in seconds and listCostMicros.
seconds
integer
Whole seconds stopped inside the window, with the disk kept.
More A sandbox deleted while its snapshots kept its machine counts as stopped until the last of them goes.
listCostMicros
integer
What those seconds come to at the stopped price, 5% of the running one, in millionths of a US dollar.
More Not a charge here: GET /v1/billing says what is.
mail
object3 fields
Mail in the window.
More 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.
received
integer
Messages taken for a sandbox.
sent
integer
Messages a sandbox sent.
costMicros
integer
What they come to at 500 a message, in millionths of a US dollar: $0.50 a thousand.
More It is paid from what the plan includes, as machine time is.
currency
usd
cost
null
What was charged.
More Null: nothing is charged here.
billing
not_configured

Errors and other answers

400 since is not before until.
404 Not found.

Every error answers { "error": { "code", "message" } }; a key without the action a call needs answers 403 key_action_forbidden, naming it.