Skip to content

Recent ledger entries

GET
/entitlements/admin/orgs/{orgId}/ledger
curl --request GET \
--url 'https://api.sloose.com/entitlements/admin/orgs/org_9f3c/ledger?limit=100' \
--header 'Authorization: Bearer <token>'

Backoffice route: a staff session, or ADMIN_TOKEN; never a customer’s session. Straight from the Durable Object — the authority, not the D1 mirror. Newest first, a page at a time: limit and cursor, answering nextCursor; each entry’s seq is its place in the order.

orgId
required

The organisation id.

string
Example
org_9f3c

The organisation id.

limit

How many to return, at most 1,000; 100 when absent. Anything but a whole number above zero — 0, negative, a fraction, not a number — is the default, never an error.

string
Example
100

How many to return, at most 1,000; 100 when absent. Anything but a whole number above zero — 0, negative, a fraction, not a number — is the default, never an error.

cursor

The nextCursor of the page before this one; absent for the first page. Opaque: it names a place in the list’s seq order, and a malformed one is 400 INVALID_CURSOR.

string

The nextCursor of the page before this one; absent for the first page. Opaque: it names a place in the list’s seq order, and a malformed one is 400 INVALID_CURSOR.

A page of ledger entries, newest first, with the current balance.

Media typeapplication/json
object
entries
required
Array<object>
object
seq
required
number
key
additional properties
nextCursor
required

Pass as cursor for the next page; null when this was the last.

string | null
balance
required

AI credits. Included credits reset each period; purchased ones do not.

object
included
required
number
purchased
required
number
reserved
required
number
available
required

Included + purchased − reserved

number
periodStart
required
string
periodEnd
required
string
Examplegenerated
{
"entries": [
{
"seq": 1
}
],
"nextCursor": "example",
"balance": {
"included": 1,
"purchased": 1,
"reserved": 1,
"available": 1,
"periodStart": "example",
"periodEnd": "example"
}
}

cursor is malformed (code: INVALID_CURSOR).

Media typeapplication/json

The error envelope every non-2xx answer uses.

object
error
required

Human-readable explanation.

string
code

Machine-readable reason. Absent on a few legacy 400s.

string
key
additional properties
Examplegenerated
{
"error": "example",
"code": "example"
}

A bearer that is neither the token nor a live session (code: AUTH_REQUIRED).

Media typeapplication/json

The error envelope every non-2xx answer uses.

object
error
required

Human-readable explanation.

string
code

Machine-readable reason. Absent on a few legacy 400s.

string
key
additional properties
Examplegenerated
{
"error": "example",
"code": "example"
}

A customer’s session, an API token, or no bearer at all — not staff, and not the ADMIN_TOKEN (code: ADMIN_REQUIRED).

Media typeapplication/json

The error envelope every non-2xx answer uses.

object
error
required

Human-readable explanation.

string
code

Machine-readable reason. Absent on a few legacy 400s.

string
key
additional properties
Examplegenerated
{
"error": "example",
"code": "example"
}

The restore switch is on (code: MAINTENANCE): every route but /health and /robots.txt is refused before anything is read, except the operator’s own POST /staff/people/{id}/delete with the ADMIN_TOKEN. Sloose is down for maintenance. Please try again in a few minutes.

Media typeapplication/json
object
error
required
string
code
required
string
Allowed value: MAINTENANCE
Example
{
"code": "MAINTENANCE"
}
Retry-After
integer

Seconds until asking again is worth it (300 while the switch is on).

Report a problem with this page

sloose.com