Skip to content

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.

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 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.retrieve_books_journal_entry(arguments)
result = await call.wait()
return result.body_json()
FieldTypePresenceDescription and constraints
$objectRootAdditional keys: not allowed
pathobjectRequired within parentAdditional keys: not allowed
path.journalEntryIdstringRequired within parentunique id for a journal entry; emitted as base-58, but a base-16 UUID is also accepted
Format: base58 (max length 22)
queryModelOptionalExpand Retrieve a journal entry — request body — query

Referenced models: Retrieve a journal entry — request body — query

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

FieldTypePresenceDescription and constraints
$ModelRootExpand Retrieve a journal entry — response body

Referenced models: Retrieve a journal entry — response body

25 more schemas are linked from the tables above, on the schema pages.

Retrieve a journal entry — response body
FieldTypePresenceDescription and constraints
$objectRootResponse containing a single journal entry.
journalEntryJSONRequired within parent
journalEntry (allOf 1)ModelAll variants applyExpand List journal entries — response body — journal Entries item
journalEntry (allOf 2)JSONAll variants applyThe requested journal entry

Referenced models: List journal entries — response body — journal Entries item

Retrieve a journal entry — request body — query
FieldTypePresenceDescription and constraints
$objectRootAdditional keys: not allowed
booksIdstringOptionalThe Books instance to act on. Must be the token organization's own instance, which it defaults to.
Format: uuid
expandstringOptionalComma-separated list of expandable paths.
One of: lineEntries, lineEntriesTransactions, lineEntriesLedger, lineEntriesOpposingLedgerIds, lineEntriesPaymentApplications, lineEntriesLinePaymentApplications, accrualSource, transfer, autocatResult
List journal entries — response body — journal Entries item
FieldTypePresenceDescription and constraints
$objectRoot
accrualSourceJSONOptional
accrualSource (anyOf 1)JSONAlternative
accrualSource (anyOf 1) (allOf 1)ModelAll variants applyExpand List journal entries — response body — journalEntries / item / accrualSource / type: invoice, bill, payroll type: invoice, bill, payroll
accrualSource (anyOf 1) (allOf 2)JSONAll variants applyThe accrual source for the journal entry, if applicable. Included in expanded responses.
accrualSource (anyOf 2)nullAlternative
autocatResultJSONOptional
autocatResult (anyOf 1)JSONAlternative
autocatResult (anyOf 1) (allOf 1)ModelAll variants applyExpand 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)JSONAll variants applyHow 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)nullAlternative
categorizationStatusJSONRequired within parent
categorizationStatus (allOf 1)stringAll variants applyKnown values: pending, delayed, completed, notAttempted
categorizationStatus (allOf 2)JSONAll variants applyThe 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.
creationDateJSONRequired within parent
creationDate (allOf 1)stringAll variants applyFormat: yyyy-mm-ddThh:MM:ssZ
creationDate (allOf 2)JSONAll variants applyThe date and time the journal entry was created
creationSourceJSONRequired within parent
creationSource (allOf 1)stringAll variants applyKnown values: manual, transaction, accrual, paymentApplication, legacy, scheduledAccrual
creationSource (allOf 2)JSONAll variants applyThe 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).
datetimeJSONRequired within parent
datetime (allOf 1)stringAll variants applyFormat: yyyy-mm-ddThh:MM:ssZ
datetime (allOf 2)JSONAll variants applyThe datetime the Journal Entry was created in UTC time
descriptionstringRequired within parentAn arbitrary string on the object, useful for displaying to the user.
Format: size < 513
idstringRequired within parentThe unique ID of the object.
Format: base58 (max length 22)
isOpeningBalancebooleanRequired within parentWhether the Journal Entry represents an opening balance.
lineEntriesJSONOptional
lineEntries (anyOf 1)arrayAlternativeList of Line Entries. Included in expanded responses.
lineEntries (anyOf 1)[]ModelEach itemExpand List journal entries — response body — journal Entries item line Entries array item
lineEntries (anyOf 2)nullAlternative
lineEntryIdsJSONOptional
lineEntryIds (anyOf 1)arrayAlternativeThe ids of the Line Entries detailing the Journal Entry's movement of value.
lineEntryIds (anyOf 1)[]stringEach itemunique 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)nullAlternative
reviewStatusJSONRequired within parent
reviewStatus (allOf 1)stringAll variants applyKnown values: unreviewed, reviewed
reviewStatus (allOf 2)JSONAll variants applyWhether the user has reviewed the journal entry. New journal entries default to `unreviewed`.
reviewStatusSetAtJSONOptional
reviewStatusSetAt (anyOf 1)JSONAlternative
reviewStatusSetAt (anyOf 1) (allOf 1)stringAll variants applyFormat: yyyy-mm-ddThh:MM:ssZ
reviewStatusSetAt (anyOf 1) (allOf 2)JSONAll variants applyWhen the review status was last set. Null if the journal entry has never been reviewed.
reviewStatusSetAt (anyOf 2)nullAlternative
transferJSONOptional
transfer (anyOf 1)JSONAlternative
transfer (anyOf 1) (allOf 1)ModelAll variants applyExpand List journal entries — response body — journal Entries item transfer from Entry, to Entry from Entry, to Entry
transfer (anyOf 1) (allOf 2)JSONAll variants applyThe 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)nullAlternative

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
FieldTypePresenceDescription and constraints
$objectRootThe 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.
confidenceJSONRequired within parent
confidence (anyOf 1)numberAlternativeThe autocat model's confidence in the assignment, 0.0 to 1.0.
Format: double
confidence (anyOf 2)stringAlternativePattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$
createdAtJSONRequired within parent
createdAt (allOf 1)stringAll variants applyFormat: yyyy-mm-ddThh:MM:ssZ
createdAt (allOf 2)JSONAll variants applyWhen the autocat result was recorded, in UTC.
idstringRequired within parentThe unique identifier of the autocat result.
ledgerIdstringRequired within parentThe category ledger autocat assigned to the transaction.
Format: base58 (max length 22)
methodJSONRequired within parent
method (allOf 1)stringAll variants applyKnown values: rule, transactionKindDefaults, similarity, embedding, llmClassifier, transfersBetweenAccounts
method (allOf 2)JSONAll variants applyHow the category was assigned (rule/transactionKindDefaults/similarity/embedding/llmClassifier/transfersBetweenAccounts).
ruleIdJSONOptional
ruleId (anyOf 1)stringAlternativeIf method is `rule`, the id of the rule that matched; otherwise null. An
opaque identifier supplied by the external categorizer.
ruleId (anyOf 2)nullAlternative
List journal entries — response body — journalEntries / item / accrualSource / type: invoice, bill, payroll type: invoice, bill, payroll files array item
FieldTypePresenceDescription and constraints
$objectRootA file associated with an accrual source
fileNamestringRequired within parentThe name of the file
Maximum length: 299
Minimum length: 1
idstringRequired within parentThe ID of the accrual source file
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.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.

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.