Books

List a source account's transactions

Changed on

Returns 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).

get/books/transactions

Request

Query parameters

sourceAccountIdstring base58 (max length 22) required

unique id for a source account

Example:7JRNsKwy2Lw66caxVU7WGC

The id of a source account from GET /books/source-accounts (getBooksSourceAccounts). It must belong to the Books instance.

booksIdstring uuid

The Books instance to act on. Must be the token organization's own instance, which it defaults to.

startDatestring date required

Only return transactions on or after this date (inclusive, YYYY-MM-DD, UTC).

endDatestring date required

Only return transactions on or before this date (inclusive, YYYY-MM-DD, UTC). Must be on or after startDate.

reviewStatus'reviewed' | 'unreviewed' required

Only return 'reviewed' or 'unreviewed' transactions.

pageTokenstring

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.

enrichboolean

Whether to add Mercury banking details, such as the note, counterparty, and attachments, to each transaction. Defaults to false.

Response

nextPageTokenstring nullable

Present when more transactions match the request. Pass it back as pageToken, with the same other parameters, to fetch the next page, and keep doing so until a response has no nextPageToken; only then have you seen every transaction in the range.

prevPageTokenstring nullable

Present when there is an earlier page. Pass it back as pageToken, with the same other parameters, to fetch the previous page.

Example response

{
  "transactions": [
    {
      "categorizationLines": [
        {
          "ledgerId": "7JRNsKwy2Lw66caxVU7WGC",
          "lineEntryId": "7JRNsKwy2Lw66caxVU7WGC"
        }
      ],
      "datetime": "2016-07-22T00:00:00Z",
      "journalEntryId": "7JRNsKwy2Lw66caxVU7WGC",
      "ledgerId": "7JRNsKwy2Lw66caxVU7WGC",
      "lineEntryId": "7JRNsKwy2Lw66caxVU7WGC",
      "sourceAccountId": "7JRNsKwy2Lw66caxVU7WGC"
    }
  ]
}

Changes