Account, keys and webhooks ›
Get api key usage
GET
/v1/api-keys/{id}/usageThe same for the sandboxes one key made.
RequestTypeScript
- import { Agental } from "agental-sdk";
- const agental = new Agental();
- const usage = await agental.apiKeys.usage("key_9b1c7e2f4a6d8053");
Answer200 OK · ApiKeyUsage
- {
- "apiKeyId": string,
- "createdAt": string,
- "ageMs": integer,
- "since": string | null,
- "until": string,
- "sandboxes": integer,
- "seconds": integer,
- "listCostMicros": integer,
- "currency": "usd",
- … 2 more
- }
Running time of the sandboxes this key made and what it comes to at the list price.
Path
idrequiredstring |
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. |
Headers
AuthorizationrequiredBearer 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
apiKeyIdstring
createdAtstring
ageMsinteger
sincestringnull
Start of the window.
More
Null means everything the key's sandboxes ever ran.untilstring
sandboxesinteger
Sandboxes this key made that ran in the window.
secondsinteger
Whole seconds run inside the window, counted by the meter.
More
A sandbox that is running is counted up to now.listCostMicrosinteger
What those seconds come to at the list price, in millionths of a US dollar.
More
27000 is $0.027. Not a charge.currencyusd
costnull
What was charged.
More
Null: nothing is charged here.billingnot_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.