For AI agents: this page is also available as Markdown at https://docs.refabric.com/api-reference/platform/tasks/read-your-usage.md, and the index of every page is https://docs.refabric.com/llms.txt.

Platform API › Tasks

Read your usage

Your spend in [start, end) — the whole account, every key and the app: one row per task, API key and credit type, with job counts and the credits charged.

GEThttps://api.refabric.com/v1/account/usage
import os
import requests

url = "https://api.refabric.com/v1/account/usage"

headers = {"Authorization": f"Key {os.environ['REFABRIC_API_KEY']}"}

response = requests.get(url, headers=headers)

print(response.json())
{
  "items": [],
  "next_cursor": "eyJsIjoiY2hhbmdlbG9nIn0",
  "has_more": false,
  "as_of": "2026-10-01T00:00:00Z",
  "start": "2026-09-01T00:00:00Z",
  "end": "2026-10-01T00:00:00Z"
}

Authentication. A key with account:read: the figures are your account's spend.

Key features

  • Pages of 50 rows by default, 200 at most.
  • A window of 90 days at most.

Common use cases

  • Bill your own customers per key.
  • See which task spends the most.

See also

  • GET /v1/account/metrics
  • GET /v1/account/balance

Authorization

Authorization: Key $REFABRIC_API_KEYScope: account:read

Parameters

Query parameters

  • integeroptionalDefault: 50

    Items per page: default 50, at most 200.

    1 to 200

  • stringoptionalnullable

    The previous page's next_cursor, copied back as it came, for the next page. Never build one.

  • stringoptionalnullable

    Inclusive, ISO-8601 (2026-09-01T00:00:00Z; no zone means UTC). Default: 30 days before end. The window is at most 90 days.

    format: date-time

  • stringoptionalnullable

    Exclusive, ISO-8601 (no zone means UTC). Default: now.

    format: date-time

  • stringoptionalnullable

    Only jobs started with this key of yours (key_…).

  • stringoptionalnullable

    Only jobs of this task (image.generate).

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.

  • array<object>required

    This page's items, in the listing's order.

  • booleanrequired

    Whether another page follows this one.

    Example: false

  • 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 end sent, as_of.

    Example: 2026-10-01T00:00:00Z

  • stringoptionalnullable

    Send it back as cursor for the next page. Absent on the last page. Opaque: never build or edit one.

    Example: eyJsIjoiY2hhbmdlbG9nIn0

  • 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.