Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.
ReferenceBeta

Balances

Reference for the workspace balance: the one balance in USD, the statement entries that moved it, and the myBalance and myBalanceEntries queries.

The prepaid balance the caller's workspace holds, the statement of postings that moved it, and the queries that read them.

Queries

myBalance

The caller's own workspace's balance. Opened at zero if nothing has opened it yet.

myBalance: BillingBalance!

Output types:

BillingBalance

The prepaid balance a workspace holds. A workspace holds exactly one, in USD.

amount is signed: negative means the workspace owes. It is a running total kept in step with the workspace's posting journal, and the journal — the balance's statement entries — stays the source of truth for how the total was reached.

Implements: Node

Field
Type
Description

id

ID!

A globally unique identifier. This ID is opaque and should not be parsed by clients.

workspaceId

ID!

The workspace this balance belongs to.

amount

The current total, signed. Negative means the workspace owes.

createdAt

When the balance was opened: on the workspace's creation, its first read, or its first posting, whichever came first.

updatedAt

When the balance last moved.


myBalanceEntries

The movements of the caller's own workspace's balance, newest first, as a statement.

balanceAfter is a property of the journal, not of this ordering: an entry carries the same running total whichever direction you read in. Reversing the direction reverses the order lines arrive in and nothing else.

myBalanceEntries(
    filter: BillingBalanceEntryFilter
    first: Int
    after: String
    last: Int
    before: String
    orderBy: BillingBalanceEntryOrder = { field: CREATED_AT, direction: DESC }
  ): BillingBalanceEntryConnection!

Arguments

Name
Type
Description

filter

BillingBalanceEntryFilter

Filtering options for the returned entries.

first

Int

The first n elements from the paginated list.

after

String

The elements that come after the specified cursor.

last

Int

The last n elements from the paginated list.

before

String

The elements that come before the specified cursor.

orderBy

BillingBalanceEntryOrder

The ordering options for the returned entries.

Input types:

BillingBalanceEntryFilter

Filtering options for balance entries.

Narrowing a statement to a period does not restart its running totals: balanceAfter still accumulates over the whole journal, so the first line of a period carries the balance carried into that period rather than the period's own subtotal.

Only time is filterable, and that is a constraint rather than an oversight — a statement window has to stay a contiguous run of the journal for its running totals to mean anything. Dropping, say, every charge and keeping the corrections would leave each surviving line with a total that no sequence of shown lines adds up to.

Field
Type
Description

createdAtFrom

Keep only entries posted at or after this instant.

createdAtTo

Keep only entries posted at or before this instant.

BillingBalanceEntryOrder

Ordering options for balance entries.

Field
Type
Description

field

The field to order by.

direction

The direction to order.

Output types:

BillingBalanceEntryConnection

A page of balance entries.

Implements: Connection

Field
Type
Description

edges

A list of edges.

nodes

A list of nodes in the connection (without edge metadata).

pageInfo

Information about the current page.

total

The total count of items matching the filter.


Objects

BillingBalance

The prepaid balance a workspace holds. A workspace holds exactly one, in USD.

amount is signed: negative means the workspace owes. It is a running total kept in step with the workspace's posting journal, and the journal — the balance's statement entries — stays the source of truth for how the total was reached.

Implements: Node

Field
Type
Description

id

ID!

A globally unique identifier. This ID is opaque and should not be parsed by clients.

workspaceId

ID!

The workspace this balance belongs to.

amount

The current total, signed. Negative means the workspace owes.

createdAt

When the balance was opened: on the workspace's creation, its first read, or its first posting, whichever came first.

updatedAt

When the balance last moved.


BillingBalanceEntry

One movement of a workspace's balance, as a line on a statement.

Not stored as such: an entry is a posting together with the document that justifies it, and balanceAfter is derived at read time rather than stored against the posting. A payment whose valueDate falls before existing entries therefore shifts every line after it, the way a statement should, instead of leaving a stale snapshot behind.

An entry is identified but not addressable — there is no node(id:) lookup for one, because a line only means anything within the statement that produced it.

Field
Type
Description

id

ID!

The identifier of the posting behind this entry.

createdAt

When the posting happened.

type

What moved the balance.

amount

Signed from the workspace's side: positive credits the balance, negative debits it.

balanceAfter

The balance total immediately after this entry. Independent of the ordering you requested.

description

String

What the justifying document has to say for itself: a correction's reason, an invoice's number, a payment's note. Null whenever that document has nothing to say, which is routine for a TOP_UP -- the line is labelled by its type, so there is nothing the accountant has to type. Not a ready-to-display label. The label belongs to type and needs translating; this is the operator's or the document's own words and does not.

authoredBy

ID!

The actor on whose authority the posting was made — the staff member behind a correction, the accountant who entered a top-up, or the service account behind a charge. Never absent: every posting is attributable. An id, not a name: billing does not hold actors, so rendering a person needs a second lookup.


Inputs

BillingBalanceEntryFilter

Filtering options for balance entries.

Narrowing a statement to a period does not restart its running totals: balanceAfter still accumulates over the whole journal, so the first line of a period carries the balance carried into that period rather than the period's own subtotal.

Only time is filterable, and that is a constraint rather than an oversight — a statement window has to stay a contiguous run of the journal for its running totals to mean anything. Dropping, say, every charge and keeping the corrections would leave each surviving line with a total that no sequence of shown lines adds up to.

Field
Type
Description

createdAtFrom

Keep only entries posted at or after this instant.

createdAtTo

Keep only entries posted at or before this instant.


BillingBalanceEntryOrder

Ordering options for balance entries.

Field
Type
Description

field

The field to order by.

direction

The direction to order.


Enums

BillingBalanceEntryType

What moved a balance.

Value
Description

INVOICE

A charge issued against the balance.

CORRECTION

A staff-authored correction, in either direction.

TOP_UP

Money the customer sent, credited to the balance. Distinct from a correction on purpose: one is cash taken in, the other is revenue given away, and a statement that called both a correction would make the two impossible to tell apart.


BillingBalanceEntryOrderField

Fields available for ordering balance entries.

Value
Description

CREATED_AT

Order by the time the posting happened.


Pagination types

BillingBalanceEntryConnection

A page of balance entries.

Implements: Connection

Field
Type
Description

edges

A list of edges.

nodes

A list of nodes in the connection (without edge metadata).

pageInfo

Information about the current page.

total

The total count of items matching the filter.


BillingBalanceEntryEdge

An edge in the BillingBalanceEntry connection.

Implements: Edge

Field
Type
Description

node

The balance entry at the end of the edge.

cursor

String!

A cursor for use in pagination.


See also

Last updated

Was this helpful?