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.
Call through Alter
Section titled “Call through Alter”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 osfrom alter_sdk import Appfrom 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()| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Additional keys: not allowed |
query | object | Required within parent | Additional keys: not allowed |
query.booksId | string | Optional | The Books instance to act on. Must be the token organization’s own instance, which it defaults to. Format: uuid |
query.startDate | string | Required within parent | Only return line entries posted on or after this date (inclusive, YYYY-MM-DD). Format: date |
query.endDate | string | Required within parent | Only return line entries posted on or before this date (inclusive, YYYY-MM-DD). Must be on or after startDate. Format: date |
query.ledgerIds | array | Optional | Comma-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[] | string | Each item | unique id for a ledger; emitted as base-58, but a base-16 UUID is also accepted Format: base58 (max length 22) |
query.opposingLedgerIds | array | Optional | Comma-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[] | string | Each item | unique id for a ledger; emitted as base-58, but a base-16 UUID is also accepted Format: base58 (max length 22) |
query.debitCredit | string | Optional | Only return debit (‘debit’) or credit (‘credit’) line entries. One of: debit, credit |
query.minAmount | number | Optional | Only return line entries with an amount of at least this value. Format: double |
query.maxAmount | number | Optional | Only return line entries with an amount of at most this value. Format: double |
query.sort | array | Optional | Comma-separated list of sort keys, applied in order. |
query.sort[] | string | Each item | One of: descriptionAsc, descriptionDesc, datetimeAsc, datetimeDesc, creditAsc, creditDesc, debitAsc, debitDesc, journalEntryIdAsc, journalEntryIdDesc, ledgerNameAsc, ledgerNameDesc, contraLedgerNameAsc, contraLedgerNameDesc, tagNameAsc, tagNameDesc |
query.pageToken | string | Optional | The nextPageToken or prevPageToken from a previous response, to fetch that page. |
query.limit | integer | Optional | The maximum number of line entries to return per page, from 1 to 1000. Defaults to 50. Default: 50 Maximum: 1000 Minimum: 1 |
Response
Section titled “Response”Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | Model | Root | Expand List line entries (general ledger activity) across ledgers — response body |
Referenced models: List line entries (general ledger activity) across ledgers — response body
Schemas
Section titled “Schemas”List line entries (general ledger activity) across ledgers — response body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Response containing a paginated list of line entries. |
lineEntries | array | Required within parent | The line entries on this page |
lineEntries[] | Model | Each item | Expand List line entries (general ledger activity) across ledgers — response body — line Entries item |
nextPageToken | JSON | Optional | |
nextPageToken (anyOf 1) | string | Alternative | Token to fetch the next page of results |
nextPageToken (anyOf 2) | null | Alternative | |
prevPageToken | JSON | Optional | |
prevPageToken (anyOf 1) | string | Alternative | Token to fetch the previous page of results |
prevPageToken (anyOf 2) | null | Alternative |
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
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | A single line of general ledger (GL) activity: one debit or credit posted to one ledger by a journal entry. |
amount | JSON | Required within parent | |
amount (allOf 1) | Model | All variants apply | Expand Create a product — response body — unit Price value |
amount (allOf 2) | JSON | All variants apply | The unsigned amount of the line entry, in dollars. |
datetime | JSON | Required within parent | |
datetime (allOf 1) | string | All variants apply | Format: yyyy-mm-ddThh:MM:ssZ |
datetime (allOf 2) | JSON | All variants apply | When the line entry was posted, in UTC. |
debitCredit | JSON | Required within parent | |
debitCredit (allOf 1) | string | All variants apply | Known values: debit, credit |
debitCredit (allOf 2) | JSON | All variants apply | Whether the amount is a debit or a credit to the ledger. |
description | JSON | Optional | |
description (anyOf 1) | string | Alternative | The line entry's own description, if any. Format: size < 4001 |
description (anyOf 2) | null | Alternative | |
id | string | Required within parent | The unique identifier for the line entry. Format: base58 (max length 22) |
journalEntryDescription | string | Required within parent | The description of the journal entry the line entry belongs to. Format: size < 513 |
journalEntryId | string | Required within parent | The identifier of the journal entry the line entry belongs to. Format: base58 (max length 22) |
ledgerId | string | Required within parent | The identifier of the ledger (general ledger account) the line entry is posted to. Format: base58 (max length 22) |
ledgerName | string | Required within parent | The display name of the ledger the line entry is posted to. |
opposingLedgerIds | array | Required within parent | The identifiers of the ledgers on the other side of the journal entry, i.e. its lines with the opposite debit or credit. |
opposingLedgerIds[] | string | Each item | unique id for a ledger; emitted as base-58, but a base-16 UUID is also accepted Format: base58 (max length 22) |
tags | array | Required within parent | The tags applied to the line entry. |
tags[] | Model | Each item | Expand 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
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | A tag used for categorizing transactions in Books. |
id | string | Required within parent | Unique identifier for the tag. Format: base58 (max length 22) |
name | string | Required within parent | Display name of the tag. |
tagGroupId | string | Required within parent | unique 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
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | JSON | Root | |
$ (anyOf 1) | number | Alternative | A dollar amount Format: double |
$ (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
Policy, approvals and errors
Section titled “Policy, approvals and errors”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.