List a source account's transactions
Changed onReturns one page of a source account's transactions within a date range. Use it to find transactions to categorize. sourceAccountId, startDate, endDate, and reviewStatus are required, as in the web app's transaction list. Get sourceAccountId from GET /books/source-accounts (getBooksSourceAccounts). To see both review statuses, make one request for each. A transaction needs categorizing when its categorizationMethod is uncategorized. To categorize or recategorize transactions, use POST /books/transactions/categorize (categorizeBooksTransactions) with each transaction's journalEntryId. A positive amount posts on the source account's debitCredit side, and a negative one on the opposite side. For a Mercury bank account, positive is money in. For a Mercury credit card, positive is a charge. Pass enrich=true to add Mercury banking details, such as the note, counterparty, and attachments. Each response is one page, and Books decides the page size. To see every transaction in the range, pass nextPageToken back as pageToken with the same other parameters, and repeat until a response has no nextPageToken. To read one transaction by ID, use GET /books/transaction/{transactionId} (getBooksTransaction).
Request
- Base URLhttps://api.mercury.com/api/v1
- AuthHTTP bearer
- TypeScriptA function with typed inputs. Its response is checked against the schema.
Query parameters
unique id for a source account
The id of a source account from GET /books/source-accounts (getBooksSourceAccounts). It must belong to the Books instance.
The Books instance to act on. Must be the token organization's own instance, which it defaults to.
Only return transactions on or after this date (inclusive, YYYY-MM-DD, UTC).
Only return transactions on or before this date (inclusive, YYYY-MM-DD, UTC). Must be on or after startDate.
Only return 'reviewed' or 'unreviewed' transactions.
The nextPageToken (or prevPageToken) of a previous response, to fetch that page. Send the same sourceAccountId, startDate, endDate, and reviewStatus as that request. Omit for the first page.
Whether to add Mercury banking details, such as the note, counterparty, and attachments, to each transaction. Defaults to false.
Response
Example response
{
"transactions": [
{
"categorizationLines": [
{
"ledgerId": "7JRNsKwy2Lw66caxVU7WGC",
"lineEntryId": "7JRNsKwy2Lw66caxVU7WGC"
}
],
"datetime": "2016-07-22T00:00:00Z",
"journalEntryId": "7JRNsKwy2Lw66caxVU7WGC",
"ledgerId": "7JRNsKwy2Lw66caxVU7WGC",
"lineEntryId": "7JRNsKwy2Lw66caxVU7WGC",
"sourceAccountId": "7JRNsKwy2Lw66caxVU7WGC"
}
]
}Changes
- info
endpoint added
- info