Skip to content

Mercury: Create multiple journal entries

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

← Books operations · Get started

Operation mercury.bulkcreatebooksjournalentries

Provider route: POST /books/journal-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"]["bulkCreateBooksJournalEntries"]>[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.bulkCreateBooksJournalEntries(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.bulk_create_books_journal_entries(arguments)
result = await call.wait()
return result.body_json()
FieldTypePresenceDescription and constraints
$objectRootAdditional keys: not allowed
queryModelOptionalExpand Retrieve a journal entry — request body — query
bodyarrayOptional
body[]ModelEach itemExpand Create multiple journal entries — request body — body item

Referenced models: Create multiple journal entries — request body — body item, 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 Create multiple journal entries — response body

Referenced models: Create multiple journal entries — response body

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

Create multiple journal entries — response body
FieldTypePresenceDescription and constraints
$objectRootResponse for a bulk journal entry creation request.
journalEntriesarrayRequired within parentThe created journal entries
journalEntries[]ModelEach itemExpand List journal entries — response body — journal Entries item

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

Create multiple journal entries — request body — body item
FieldTypePresenceDescription and constraints
$objectRootRequest to create a single journal entry.
Additional keys: not allowed
datetimeJSONRequired within parent
datetime (allOf 1)stringAll variants applyFormat: yyyy-mm-ddThh:MM:ssZ
datetime (allOf 2)JSONAll variants applyThe date and time of the journal entry
descriptionstringRequired within parentDescription of the journal entry
Format: size < 513
lineEntriesarrayRequired within parentThe line entries that compose this journal entry
lineEntries[]ModelEach itemExpand Create multiple journal entries — request body — body item line Entries item

Referenced models: Create multiple journal entries — request body — body item line 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

Create multiple journal entries — request body — body item line Entries item
FieldTypePresenceDescription and constraints
$objectRootA line entry within a journal entry creation request.
Additional keys: not allowed
amountJSONRequired within parent
amount (allOf 1)numberAll variants applyA dollar amount
Format: double
amount (allOf 2)JSONAll variants applyThe amount for this line entry
debitCreditJSONRequired within parent
debitCredit (allOf 1)stringAll variants applyOne of: debit, credit
debitCredit (allOf 2)JSONAll variants applyWhether this line entry is a debit or credit
descriptionstringRequired within parentDescription of the line entry
Format: size < 4001
ledgerIdstringRequired within parentThe ledger this line entry is posted to
Format: base58 (max length 22)
tagIdsJSONOptional
tagIds (anyOf 1)arrayAlternativeOptional tags to associate with this line entry
tagIds (anyOf 1)[]stringEach itemunique id for a tag; emitted as base-58, but a base-16 UUID is also accepted
Format: base58 (max length 22)
tagIds (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)

SDK function policy ID: mercury.bulkcreatebooksjournalentries. Catalog operation: mercury:bulkCreateBooksJournalEntries. 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.