Mercury: Retrieve a journal entry
Mercury books.retrieveBooksJournalEntry: arguments, response, policy and SDK examples.
← Books operations · Get started
Operation mercury.retrievebooksjournalentry
Provider route: GET /books/journal-entry/{journalEntryId}. 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"]["retrieveBooksJournalEntry"]>[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.retrieveBooksJournalEntry(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.retrieve_books_journal_entry(arguments) result = await call.wait() return result.body_json()| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Additional keys: not allowed |
path | object | Required within parent | Additional keys: not allowed |
path.journalEntryId | string | Required within parent | unique id for a journal entry; emitted as base-58, but a base-16 UUID is also accepted Format: base58 (max length 22) |
query | Model | Optional | Expand Retrieve a journal entry — request body — query |
Referenced models: Retrieve a journal entry — request body — query
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 Retrieve a journal entry — response body |
Referenced models: Retrieve a journal entry — response body
Schemas
Section titled “Schemas”25 more schemas are linked from the tables above, on the schema pages.
Retrieve a journal entry — response body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Response containing a single journal entry. |
journalEntry | JSON | Required within parent | |
journalEntry (allOf 1) | Model | All variants apply | Expand List journal entries — response body — journal Entries item |
journalEntry (allOf 2) | JSON | All variants apply | The requested journal entry |
Referenced models: List journal entries — response body — journal Entries item
Retrieve a journal entry — request body — query
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Additional keys: not allowed |
booksId | string | Optional | The Books instance to act on. Must be the token organization's own instance, which it defaults to. Format: uuid |
expand | string | Optional | Comma-separated list of expandable paths. One of: lineEntries, lineEntriesTransactions, lineEntriesLedger, lineEntriesOpposingLedgerIds, lineEntriesPaymentApplications, lineEntriesLinePaymentApplications, accrualSource, transfer, autocatResult |
List journal entries — response body — journal Entries item
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
accrualSource | JSON | Optional | |
accrualSource (anyOf 1) | JSON | Alternative | |
accrualSource (anyOf 1) (allOf 1) | Model | All variants apply | Expand List journal entries — response body — journalEntries / item / accrualSource / type: invoice, bill, payroll type: invoice, bill, payroll |
accrualSource (anyOf 1) (allOf 2) | JSON | All variants apply | The accrual source for the journal entry, if applicable. Included in expanded responses. |
accrualSource (anyOf 2) | null | Alternative | |
autocatResult | JSON | Optional | |
autocatResult (anyOf 1) | JSON | Alternative | |
autocatResult (anyOf 1) (allOf 1) | Model | All variants apply | Expand List journal entries — response body — journal Entries item autocat Result confidence, created At, id, ledger Id, method, rule Id confidence, created At, id, ledger Id, method, rule Id |
autocatResult (anyOf 1) (allOf 2) | JSON | All variants apply | How the transaction underlying this journal entry was auto-categorized (method, confidence, and rule), if any. Null for manual journal entries, entries not categorized by the autocat pipeline, and entries a user has since manually recategorized. Included in expanded responses. |
autocatResult (anyOf 2) | null | Alternative | |
categorizationStatus | JSON | Required within parent | |
categorizationStatus (allOf 1) | string | All variants apply | Known values: pending, delayed, completed, notAttempted |
categorizationStatus (allOf 2) | JSON | All variants apply | The categorization lifecycle status of the journal entry. - `pending`: Uncategorized JE posted at sync, auto-categorization not yet resolved. - `delayed`: Auto-categorization fell back to uncategorized; can still transition to `completed`. - `completed`: Categorization settled (a real category applied, an explicit uncategorized result, or a manually-created JE). - `notAttempted`: Auto-categorization is disabled for the instance, so the JE was booked uncategorized and settled at once; no result will ever arrive. |
creationDate | JSON | Required within parent | |
creationDate (allOf 1) | string | All variants apply | Format: yyyy-mm-ddThh:MM:ssZ |
creationDate (allOf 2) | JSON | All variants apply | The date and time the journal entry was created |
creationSource | JSON | Required within parent | |
creationSource (allOf 1) | string | All variants apply | Known values: manual, transaction, accrual, paymentApplication, legacy, scheduledAccrual |
creationSource (allOf 2) | JSON | All variants apply | The source that created a journal entry. - `manual`: Created manually by the user via the UI. - `transaction`: Created automatically from a transaction categorization (e.g., Plaid sync). - `accrual`: Created automatically as part of an accrual workflow. - `paymentApplication`: Created automatically as part of a payment application workflow. - `legacy`: Created automatically from the old AR/AP system (receivables/payables). |
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 | The datetime the Journal Entry was created in UTC time |
description | string | Required within parent | An arbitrary string on the object, useful for displaying to the user. Format: size < 513 |
id | string | Required within parent | The unique ID of the object. Format: base58 (max length 22) |
isOpeningBalance | boolean | Required within parent | Whether the Journal Entry represents an opening balance. |
lineEntries | JSON | Optional | |
lineEntries (anyOf 1) | array | Alternative | List of Line Entries. Included in expanded responses. |
lineEntries (anyOf 1)[] | Model | Each item | Expand List journal entries — response body — journal Entries item line Entries array item |
lineEntries (anyOf 2) | null | Alternative | |
lineEntryIds | JSON | Optional | |
lineEntryIds (anyOf 1) | array | Alternative | The ids of the Line Entries detailing the Journal Entry's movement of value. |
lineEntryIds (anyOf 1)[] | string | Each item | unique id for a line entry; emitted as base-58, but a base-16 UUID is also accepted Format: base58 (max length 22) |
lineEntryIds (anyOf 2) | null | Alternative | |
reviewStatus | JSON | Required within parent | |
reviewStatus (allOf 1) | string | All variants apply | Known values: unreviewed, reviewed |
reviewStatus (allOf 2) | JSON | All variants apply | Whether the user has reviewed the journal entry. New journal entries default to `unreviewed`. |
reviewStatusSetAt | JSON | Optional | |
reviewStatusSetAt (anyOf 1) | JSON | Alternative | |
reviewStatusSetAt (anyOf 1) (allOf 1) | string | All variants apply | Format: yyyy-mm-ddThh:MM:ssZ |
reviewStatusSetAt (anyOf 1) (allOf 2) | JSON | All variants apply | When the review status was last set. Null if the journal entry has never been reviewed. |
reviewStatusSetAt (anyOf 2) | null | Alternative | |
transfer | JSON | Optional | |
transfer (anyOf 1) | JSON | Alternative | |
transfer (anyOf 1) (allOf 1) | Model | All variants apply | Expand List journal entries — response body — journal Entries item transfer from Entry, to Entry from Entry, to Entry |
transfer (anyOf 1) (allOf 2) | JSON | All variants apply | The transfer linking this journal entry to the journal entry on the other side of a transfer between accounts (e.g. Stripe Payouts), if any. Included in expanded responses. |
transfer (anyOf 2) | null | Alternative |
Referenced models: List journal entries — response body — journalEntries / item / accrualSource / type: invoice, bill, payroll type: invoice, bill, payroll, List journal entries — response body — journal Entries item autocat Result confidence, created At, id, ledger Id, method, rule Id confidence, created At, id, ledger Id, method, rule Id, List journal entries — response body — journal Entries item line Entries array item, List journal entries — response body — journal Entries item transfer from Entry, to Entry from Entry, to Entry
List journal entries — response body — journal Entries item autocat Result confidence, created At, id, ledger Id, method, rule Id confidence, created At, id, ledger Id, method, rule Id
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | The auto-categorization decision recorded for the transaction underlying a journal entry: how its category ledger was assigned. Mirrors AutocatResult from teal-api:teal_api/transaction/schemas.py. |
confidence | JSON | Required within parent | |
confidence (anyOf 1) | number | Alternative | The autocat model's confidence in the assignment, 0.0 to 1.0. Format: double |
confidence (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
createdAt | JSON | Required within parent | |
createdAt (allOf 1) | string | All variants apply | Format: yyyy-mm-ddThh:MM:ssZ |
createdAt (allOf 2) | JSON | All variants apply | When the autocat result was recorded, in UTC. |
id | string | Required within parent | The unique identifier of the autocat result. |
ledgerId | string | Required within parent | The category ledger autocat assigned to the transaction. Format: base58 (max length 22) |
method | JSON | Required within parent | |
method (allOf 1) | string | All variants apply | Known values: rule, transactionKindDefaults, similarity, embedding, llmClassifier, transfersBetweenAccounts |
method (allOf 2) | JSON | All variants apply | How the category was assigned (rule/transactionKindDefaults/similarity/embedding/llmClassifier/transfersBetweenAccounts). |
ruleId | JSON | Optional | |
ruleId (anyOf 1) | string | Alternative | If method is `rule`, the id of the rule that matched; otherwise null. An opaque identifier supplied by the external categorizer. |
ruleId (anyOf 2) | null | Alternative |
List journal entries — response body — journalEntries / item / accrualSource / type: invoice, bill, payroll type: invoice, bill, payroll files array item
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | A file associated with an accrual source |
fileName | string | Required within parent | The name of the file Maximum length: 299 Minimum length: 1 |
id | string | Required within parent | The ID of the accrual source file 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.retrievebooksjournalentry. Catalog operation: mercury:retrieveBooksJournalEntry. 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.