Skip to content
API console (try a request with your own key)Get early access

List the workspace's credit history

GET
/v1/credits/history
#!/usr/bin/env bash
set -euo pipefail
API=https://api.speccapture.com
AUTH="Authorization: Bearer $SPECCAPTURE_API_KEY"
page=$(curl -sS --fail-with-body "$API/v1/credits/history?limit=20" \
-H "$AUTH") || { echo "$page" >&2; exit 1; }
jq -r '.data[] as $entry | "\($entry.occurredAt) \($entry.type) of \($entry.credits) credits: \($entry.availableChange) available, \($entry.heldChange) held"' <<<"$page"
if [[ "$(jq -r '.nextCursor' <<<"$page")" != null ]]; then
jq -r '"Older entries: send cursor=\(.nextCursor)"' <<<"$page"
fi

Every change to the workspace’s credits, newest first: each grant (grantKind trial, plan, pack or addedBySpecCapture, with when it expires and what of it remains), each job’s reservation, each sheet’s spend, each refund, and each expiry of credits left unspent. Each entry says how many credits it moved and what it did to the credits available and held (availableChange, heldChange), so the whole history adds up to GET /v1/account’s credits; a job’s entries name the job, its file and the sheet. Page with limit and cursor (the previous page’s nextCursor), narrow with createdAfter and createdBefore (when an entry happened) and type.

limit
integer format: int32

How many items the page holds: 1 to 200, 50 when left out.

cursor
string

The previous page’s nextCursor, exactly as it came: the list continues just after that page’s last item, so items made or removed meanwhile never shift a page. Leave it out for the first page.

createdAfter
string format: date-time

Only items that happened strictly after this date and time (ISO 8601, such as 2026-10-14T09:30:00Z; without an offset it is UTC).

createdBefore
string format: date-time

Only items that happened strictly before this date and time (ISO 8601, such as 2026-10-14T09:30:00Z; without an offset it is UTC).

type

What an entry of the credit history is.

  • grant: Credits given to the workspace: grantKind says which kind.
  • reservation: A job’s credits reserved when it was accepted, 4 a sheet: from available to held.
  • spend: One sheet read: its share of the job’s hold spent. Or a test of a template’s own fields on a drawing already read, past the day’s free tests: one credit spent straight from what is available, with no job.
  • refund: A sheet that could not be read, or a whole job that could not be split: back from held to available.
  • expiry: A grant’s expiry passed with credits unspent: those credits stopped counting.
  • takenBack: Credits taken back because the payment that bought them - a plan’s month or a pack - was refunded or lost to a dispute; never more than were still unspent. grantKind says which kind of grant.
string
Allowed values: grant reservation spend refund expiry takenBack

Only entries of this type.

OK

Media typeapplication/json

A page of the workspace’s credit history, newest first: GET /v1/credits/history.

object
data
required

The page’s entries.

Array<object>

One entry of the workspace’s credit history: GET /v1/credits/history. Every change to the balance is one entry, so the history adds up to it: the sum of every availableChange is the credits available now, of every heldChange the credits held, and of every spend’s credits the credits spent.

object
entryId
required

The ledger entry. An expiry carries its grant’s, so an entry is told apart by its id and type together.

integer format: int64
type
required

What happened.

string
Allowed values: grant reservation spend refund expiry takenBack
credits
required

How many credits it moved, always more than 0.

integer format: int32
availableChange
required

What it did to the credits available: + for a grant or a refund, - for a reservation, an expiry, credits taken back or a test’s spend, 0 for a sheet’s spend.

integer format: int32
heldChange
required

What it did to the credits held: + for a reservation, - for a sheet’s spend or a refund, 0 otherwise.

integer format: int32
occurredAt
required

When it happened; an expiry’s is its grant’s expiresAt.

string format: date-time
grantKind
required
One of:
null
expiresAt
required

When a grant’s unspent credits stop counting, on the grant and on its expiry; null when they never do, and on every other entry.

null | string format: date-time
remaining
required

On a grant: what of it is still unspent and counting - 0 once it is all used, or expired. Null on every other entry.

null | integer format: int32
jobId
required

The extraction a reservation, spend or refund is for; null on grants, expiries and a test’s spend.

null | string format: uuid
fileName
required

That extraction’s file name; null once it was deleted.

null | string
sheetNumber
required

The sheet a spend, or a sheet’s refund, is for, from 1; null for a whole job, and once the job’s sheets are gone.

null | integer format: int32
hasMore
required

Whether more entries follow this page.

boolean
nextCursor
required

Send as cursor for the page after this one; null when there is none.

null | string

Examples

Examplehistory

A job's reservation and spends, after a month's grant

{
"data": [
{
"entryId": 88213,
"type": "spend",
"credits": 4,
"availableChange": 0,
"heldChange": -4,
"occurredAt": "2026-10-14T09:31:22+00:00",
"grantKind": null,
"expiresAt": null,
"remaining": null,
"jobId": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
"fileName": "bracket.pdf",
"sheetNumber": 2
},
{
"entryId": 88212,
"type": "spend",
"credits": 4,
"availableChange": 0,
"heldChange": -4,
"occurredAt": "2026-10-14T09:31:05+00:00",
"grantKind": null,
"expiresAt": null,
"remaining": null,
"jobId": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
"fileName": "bracket.pdf",
"sheetNumber": 1
},
{
"entryId": 88211,
"type": "reservation",
"credits": 8,
"availableChange": -8,
"heldChange": 8,
"occurredAt": "2026-10-14T09:30:12+00:00",
"grantKind": null,
"expiresAt": null,
"remaining": null,
"jobId": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
"fileName": "bracket.pdf",
"sheetNumber": null
},
{
"entryId": 87950,
"type": "grant",
"credits": 2000,
"availableChange": 2000,
"heldChange": 0,
"occurredAt": "2026-10-03T00:04:11+00:00",
"grantKind": "plan",
"expiresAt": "2026-11-03T00:00:00+00:00",
"remaining": 1832,
"jobId": null,
"fileName": null,
"sheetNumber": null
}
],
"hasMore": true,
"nextCursor": "MXxjcmVkaXQtaGlzdG9yeXw2MzkyNjU4MjY1MTAwMDAwMDB8ODc5NTA"
}

Bad Request: a problem with a stable code. See Errors for every code and what to do about it.

Media typeapplication/problem+json

Every error: a problem with a stable code. https://speccapture.com/docs/api/errors lists every code.

object
type
required

A link to the code’s entry in the docs.

string
title
required

What went wrong, in a few words for a person: the same for every problem with this code.

string
status
required

The HTTP status of the answer.

integer format: int32
detail

What went wrong with this request and what to do about it, in a sentence or two for a person. Present on nearly every problem.

string
instance
required

The path of the request that was refused.

string
code
required

What went wrong, as a stable code to branch on: a published code never changes meaning.

string
traceId
required

This request’s trace: quote it when asking for help.

string

Examples

Exampleinvalid_request

The request is not valid.

{
"type": "https://speccapture.com/docs/api/errors#invalid_request",
"title": "The request is not valid.",
"status": 400,
"detail": "cursor is not one this list gave: send a page's nextCursor exactly as it came, to the list it came from, or leave cursor out for the first page.",
"instance": "/v1/credits/history",
"code": "invalid_request",
"traceId": "00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01"
}