For AI agents: this page is also available as Markdown at https://docs.refabric.com/api-reference/platform/tasks/read-your-metrics.md, and the index of every page is https://docs.refabric.com/llms.txt.
Platform API › Tasks
Read your metrics
Your jobs and calls in [start, end), one row per group — the whole account: job counts and outcomes, queue and run time percentiles, credits charged and the calls your API keys made.
https://api.refabric.com/v1/account/metricsimport os
import requests
url = "https://api.refabric.com/v1/account/metrics"
headers = {"Authorization": f"Key {os.environ['REFABRIC_API_KEY']}"}
response = requests.get(url, headers=headers)
print(response.json()){
"as_of": "2026-10-01T00:00:00Z",
"start": "2026-09-01T00:00:00Z",
"end": "2026-10-01T00:00:00Z",
"group_by": "day",
"items": []
}Modes
group_by=day·task·key·error— one row per UTC day, task, API key, or public error code (the jobs that ended with it and the calls answered with it).
Authentication. A key with account:read: the figures are your account's.
Key features
- A window of 90 days at most.
- Call counts cover the API-key calls of the last 30 days.
Common use cases
- Chart your traffic and spend per day.
- Find the error code your integration hits most.
See also
GET /v1/account/usageGET /v1/account/requestsGET /v1/errors
Authorization
Authorization: Key $REFABRIC_API_KEYScope: account:read
Parameters
Query parameters
- stringoptionalDefault:
dayOne row per UTC
day, pertask(the public name), perkey, or pererror(a public error code: the jobs that ended with it and the calls answered with it).Values
day— One row per UTC day.task— One row per task.key— One row per API key.error— One row per public error code.
- stringoptionalnullable
Inclusive, ISO-8601 (
2026-09-01T00:00:00Z; no zone means UTC). Default: 30 days beforeend. The window is at most 90 days.format: date-time
- stringoptionalnullable
Exclusive, ISO-8601 (no zone means UTC). Default: now.
format: date-time
Header parameters
- stringoptional
The contract version you wrote against (a date). Absent: the current version.
format: date
- stringoptional
Your own id for this request; we answer it back under X-Client-Request-ID.
max length 128
Response
200 — Done: the answer is in the body.
- stringrequired
The moment these figures were read (UTC, ISO-8601).
Example:
2026-10-01T00:00:00Z - stringrequired
The window's first instant, inclusive (UTC).
Example:
2026-09-01T00:00:00Z - stringrequired
The window's end, exclusive (UTC); without
endsent,as_of.Example:
2026-10-01T00:00:00Z - stringrequired
How the rows are grouped, as asked.
Values
day— One row per UTC day.task— One row per task.key— One row per API key.error— One row per public error code.
Example:
day - array<object>required
One row per group, ordered by the group.
- integerrequired
Jobs submitted in the group.
Example:
12 - integerrequired
Jobs that finished with a result.
Example:
10 - integerrequired
Jobs that ended with an error.
Example:
1 - integerrequired
Jobs that were cancelled.
Example:
1 - objectrequired
Queue time: from the moment a job was accepted to the moment it started running.
Example:
{"p50":900,"p95":4100}- integerrequirednullable
The median.
Example:
900 - integerrequirednullable
The 95th percentile.
Example:
4100
- objectrequired
Run time: from the moment a job started running to the moment it ended.
Example:
{"p50":21000,"p95":48000}- integerrequirednullable
The median.
Example:
900 - integerrequirednullable
The 95th percentile.
Example:
4100
- integerrequired
Credits charged for the group's jobs.
Example:
110 - objectrequired
The calls your API keys made in the group (API-key calls only).
Example:
{"client_errors":3,"rate_limited":1,"requests":40,"server_errors":0}- integerrequired
Calls made with your API keys.
Example:
40 - integerrequired
Calls answered with a 4xx status.
Example:
3 - integerrequired
Calls answered with a 5xx status.
Example:
0 - integerrequired
Calls answered 429 (over the rate limit).
Example:
1
- stringoptionalnullable
The UTC day (
group_by=day).Example:
2026-09-30 - stringoptionalnullable
The task's public name (
group_by=task).Example:
image.generate - stringoptionalnullable
The API key (
group_by=key);nullfor work started in the Refabric app.Example:
key_8f3a - stringoptionalnullable
A public error code (
group_by=error), asGET /v1/errorslists it.Example:
invalid_option
- 400 — The request cannot be read as it was sent (a header, the URL or the body's form).
- 401 — No valid API key was sent.
- 403 — Your key or your plan does not allow this.
- 422 — A field is missing or has a value this operation cannot use.
- 429 — Too many requests: wait for the number of seconds in the Retry-After header.
- 500 — Something went wrong on our side; retry, and quote the request id if it keeps happening.