Skip to content

Mercury: List line entries (general ledger activity) across ledgers

Mercury books.getBooksLineEntries: arguments, response, policy and SDK examples.

← Books operations · Get started

Operation mercury.getbookslineentries

Provider route: GET /books/line-entries. Alter supplies the connection’s credentials and routing.

Install @alter-ai/sdk @alter-ai/mercury with npm, or alter-sdk-mercury with pip. Supply your connected customer’s grant ID and the arguments described below.

import { App } from "@alter-ai/sdk";
import { MercuryIntegration } from "@alter-ai/mercury";
async function execute(input: Parameters<MercuryIntegration["books"]["getBooksLineEntries"]>[0]) {
const app = new App({ apiKey: process.env.ALTER_API_KEY! });
try {
const provider = new MercuryIntegration(app, { grantId: process.env.PROVIDER_GRANT_ID! });
const call = await provider.books.getBooksLineEntries(input);
const result = await call.wait();
return result.bodyJson();
} finally {
await app.close();
}
}
import os
from alter_sdk import App
from alter_sdk_mercury import MercuryIntegration
async def execute(arguments):
async with App(api_key=os.environ["ALTER_API_KEY"]) as app:
provider = MercuryIntegration(app, {"grant_id": os.environ["PROVIDER_GRANT_ID"]})
call = await provider.books.get_books_line_entries(arguments)
result = await call.wait()
return result.body_json()
FieldTypePresenceDescription and constraints
$objectRootAdditional keys: not allowed
queryobjectRequired within parentAdditional keys: not allowed
query.booksIdstringOptionalThe Books instance to act on. Must be the token organization’s own instance, which it defaults to.
Format: uuid
query.startDatestringRequired within parentOnly return line entries posted on or after this date (inclusive, YYYY-MM-DD).
Format: date
query.endDatestringRequired within parentOnly return line entries posted on or before this date (inclusive, YYYY-MM-DD). Must be on or after startDate.
Format: date
query.ledgerIdsarrayOptionalComma-separated list of at most 100 distinct ledger IDs. Only return line entries posted to one of these ledgers. Omit to return line entries from every ledger.
query.ledgerIds[]stringEach itemunique id for a ledger; emitted as base-58, but a base-16 UUID is also accepted
Format: base58 (max length 22)
query.opposingLedgerIdsarrayOptionalComma-separated list of at most 100 distinct ledger IDs. Only return line entries whose opposing ledgers (the other side of the journal entry) include one of these ledgers.
query.opposingLedgerIds[]stringEach itemunique id for a ledger; emitted as base-58, but a base-16 UUID is also accepted
Format: base58 (max length 22)
query.debitCreditstringOptionalOnly return debit (‘debit’) or credit (‘credit’) line entries.
One of: debit, credit
query.minAmountnumberOptionalOnly return line entries with an amount of at least this value.
Format: double
query.maxAmountnumberOptionalOnly return line entries with an amount of at most this value.
Format: double
query.sortarrayOptionalComma-separated list of sort keys, applied in order.
query.sort[]stringEach itemOne of: descriptionAsc, descriptionDesc, datetimeAsc, datetimeDesc, creditAsc, creditDesc, debitAsc, debitDesc, journalEntryIdAsc, journalEntryIdDesc, ledgerNameAsc, ledgerNameDesc, contraLedgerNameAsc, contraLedgerNameDesc, tagNameAsc, tagNameDesc
query.pageTokenstringOptionalThe nextPageToken or prevPageToken from a previous response, to fetch that page.
query.limitintegerOptionalThe maximum number of line entries to return per page, from 1 to 1000. Defaults to 50.
Default: 50
Maximum: 1000
Minimum: 1

Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.

FieldTypePresenceDescription and constraints
$ModelRootExpand List line entries (general ledger activity) across ledgers — response body

Referenced models: List line entries (general ledger activity) across ledgers — response body

List line entries (general ledger activity) across ledgers — response body
FieldTypePresenceDescription and constraints
$objectRootResponse containing a paginated list of line entries.
lineEntriesarrayRequired within parentThe line entries on this page
lineEntries[]ModelEach itemExpand List line entries (general ledger activity) across ledgers — response body — line Entries item
nextPageTokenJSONOptional
nextPageToken (anyOf 1)stringAlternativeToken to fetch the next page of results
nextPageToken (anyOf 2)nullAlternative
prevPageTokenJSONOptional
prevPageToken (anyOf 1)stringAlternativeToken to fetch the previous page of results
prevPageToken (anyOf 2)nullAlternative

Referenced models: List line entries (general ledger activity) across ledgers — response body — line Entries item

List line entries (general ledger activity) across ledgers — response body — line Entries item
FieldTypePresenceDescription and constraints
$objectRootA single line of general ledger (GL) activity: one debit or credit posted
to one ledger by a journal entry.
amountJSONRequired within parent
amount (allOf 1)ModelAll variants applyExpand Create a product — response body — unit Price value
amount (allOf 2)JSONAll variants applyThe unsigned amount of the line entry, in dollars.
datetimeJSONRequired within parent
datetime (allOf 1)stringAll variants applyFormat: yyyy-mm-ddThh:MM:ssZ
datetime (allOf 2)JSONAll variants applyWhen the line entry was posted, in UTC.
debitCreditJSONRequired within parent
debitCredit (allOf 1)stringAll variants applyKnown values: debit, credit
debitCredit (allOf 2)JSONAll variants applyWhether the amount is a debit or a credit to the ledger.
descriptionJSONOptional
description (anyOf 1)stringAlternativeThe line entry's own description, if any.
Format: size < 4001
description (anyOf 2)nullAlternative
idstringRequired within parentThe unique identifier for the line entry.
Format: base58 (max length 22)
journalEntryDescriptionstringRequired within parentThe description of the journal entry the line entry belongs to.
Format: size < 513
journalEntryIdstringRequired within parentThe identifier of the journal entry the line entry belongs to.
Format: base58 (max length 22)
ledgerIdstringRequired within parentThe identifier of the ledger (general ledger account) the line entry is posted to.
Format: base58 (max length 22)
ledgerNamestringRequired within parentThe display name of the ledger the line entry is posted to.
opposingLedgerIdsarrayRequired within parentThe identifiers of the ledgers on the other side of the journal entry, i.e. its lines with the opposite debit or credit.
opposingLedgerIds[]stringEach itemunique id for a ledger; emitted as base-58, but a base-16 UUID is also accepted
Format: base58 (max length 22)
tagsarrayRequired within parentThe tags applied to the line entry.
tags[]ModelEach itemExpand List line entries (general ledger activity) across ledgers — response body — line Entries item tags item

Referenced models: List line entries (general ledger activity) across ledgers — response body — line Entries item tags item, Create a product — response body — unit Price value

List line entries (general ledger activity) across ledgers — response body — line Entries item tags item
FieldTypePresenceDescription and constraints
$objectRootA tag used for categorizing transactions in Books.
idstringRequired within parentUnique identifier for the tag.
Format: base58 (max length 22)
namestringRequired within parentDisplay name of the tag.
tagGroupIdstringRequired within parentunique id for a tag group; emitted as base-58, but a base-16 UUID is also accepted
Format: base58 (max length 22)
Create a product — response body — unit Price value
FieldTypePresenceDescription and constraints
$JSONRoot
$ (anyOf 1)numberAlternativeA dollar amount
Format: double
$ (anyOf 2)stringAlternativePattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$

SDK function policy ID: mercury.getbookslineentries. Catalog operation: mercury:getBooksLineEntries. Rules can name either ID; function rules distinguish managed calls and conservatively cover raw calls sharing the route. Existing grant permissions and policy rules apply. wait() returns an immediate result or waits for a required approval; it never approves the request itself. Persist the approval ID to resume after a restart.

Provider errors retain their response; JSON decoding raises ProviderAPIError for provider failures. ManagedOperationError identifies contract/input/retention errors. See error handling and provider-specific behavior. Sensitive input may be refused before approval storage. A decoding error never resubmits a write.

Official provider source

Report an issue with this page

Necessary

Required for sign-in, security, authorization, and remembering your choices.

Always active

Analytics

Helps us understand how our website, product, and documentation are used.

Performance diagnostics

Uses performance tracing and privacy-masked session replay to diagnose problems.

Advertising

Shares visits and sign-ups with Meta, Reddit, and X so we can measure which of our ads work.

You can change these choices at any time from Cookie settings.