Docs
Account, keys and webhooks ›

Get api key usage

GET/v1/api-keys/{id}/usage

The same for the sandboxes one key made.

RequestTypeScript
  1. import { Agental } from "agental-sdk";
  2. const agental = new Agental();
  3. const usage = await agental.apiKeys.usage("key_9b1c7e2f4a6d8053");
Answer200 OK · ApiKeyUsage
  1. {
  2. "apiKeyId": string,
  3. "createdAt": string,
  4. "ageMs": integer,
  5. "since": string | null,
  6. "until": string,
  7. "sandboxes": integer,
  8. "seconds": integer,
  9. "listCostMicros": integer,
  10. "currency": "usd",
  11. … 2 more
  12. }

Running time of the sandboxes this key made and what it comes to at the list price.

Path

idrequired
string

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 the sandboxes this key made and what it comes to at the list price. Without since, everything they ever ran.

ApiKeyUsage11 fields
apiKeyId
string
createdAt
string
ageMs
integer
since
stringnull
Start of the window.
More Null means everything the key's sandboxes ever ran.
until
string
sandboxes
integer
Sandboxes this key made that ran in the window.
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.
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.