---
updatedAt: 2026-11-14T01:57:49.000Z
agentTools:
  projectIndex: https://docs.mercury.com/llms.txt
---

# Retrieve a transaction

Returns a single transaction of a source account (a bank account, credit card, or other feed) by its transaction ID, with the same fields as an item of `GET /books/transactions` (getBooksTransactions): its `amount`, `datetime`, `description`, `reviewStatus`, `postedStatus`, and `categorizationMethod`, and once posted its `journalEntryId`, its own `lineEntryId` on the source account's `ledgerId`, and `categorizationLines`, the other lines of its journal entry with their `lineEntryId`, `ledgerId`, `ledgerName`, `amount`, and `debitCredit`. Use it to read a transaction's current categorization and its `journalEntryId` before recategorizing it with `POST /books/transactions/categorize` (categorizeBooksTransactions). sourceAccountId is required and must be the transaction's own source account (its `sourceAccountId`). Pass enrich=true to add Mercury banking details where available. To find transactions, use `GET /books/transactions` (getBooksTransactions).

# OpenAPI definition

```json
{
  "components": {
    "schemas": {
      "BooksAPITransaction": {
        "description": " A transaction imported into Books from a source account (a bank, card, or\n other feed). Once posted, it has a journal entry with one line on the source\n account's ledger (`lineEntryId`) and one or more `categorizationLines`. To\n recategorize it, pass its `journalEntryId` and its current\n `categorizationLines` IDs as the expected categorization.",
        "properties": {
          "amount": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Dollar"
              },
              {
                "description": " The signed amount, in dollars. A positive amount posts on the source account's `debitCredit` side, increasing its ledger balance; a negative amount posts on the opposite side. Positive is money in for a Mercury bank account and a charge for a Mercury credit card; other source accounts follow their `debitCredit` and the signs their transactions were imported with."
              }
            ]
          },
          "attachments": {
            "description": " Files attached to the Mercury transaction, such as receipts. Only included with `enrich=true`.",
            "items": {
              "$ref": "#/components/schemas/BooksAPITransactionAttachment"
            },
            "nullable": true,
            "type": "array"
          },
          "cardLastFourDigits": {
            "description": " The last four digits of the card used for the transaction. Only included with `enrich=true`.",
            "nullable": true,
            "type": "string"
          },
          "categorizationLines": {
            "description": " The line entries that categorize the transaction: every other line of its journal entry. Empty when the transaction has no journal entry.",
            "items": {
              "$ref": "#/components/schemas/BooksAPITransactionCategorizationLine"
            },
            "type": "array"
          },
          "categorizationMethod": {
            "allOf": [
              {
                "$ref": "#/components/schemas/BooksAPITransactionCategorizationMethod"
              },
              {
                "description": " How the transaction got its current category: `uncategorized` when no categorizer matched it, `user` when a person categorized it, and otherwise the automatic categorizer. Omitted when the transaction has not been categorized."
              }
            ],
            "nullable": true
          },
          "counterpartyName": {
            "description": " The name of the transaction's counterparty (who the money went to or came from). Only included with `enrich=true`.",
            "nullable": true,
            "type": "string"
          },
          "customCategoryId": {
            "description": " The identifier of the Mercury custom category assigned to the transaction. Only included with `enrich=true`.",
            "nullable": true,
            "type": "string"
          },
          "customCategoryName": {
            "description": " The name of the Mercury custom category assigned to the transaction. Only included with `enrich=true`.",
            "nullable": true,
            "type": "string"
          },
          "datetime": {
            "allOf": [
              {
                "$ref": "#/components/schemas/UTCTime"
              },
              {
                "description": " When the transaction happened, in UTC."
              }
            ]
          },
          "description": {
            "description": " The transaction's description, as imported from its source.",
            "format": "size < 513",
            "type": "string"
          },
          "id": {
            "description": " The unique identifier of the transaction.",
            "type": "string"
          },
          "journalEntryId": {
            "description": " The identifier of the transaction's journal entry. Omitted when the transaction has no journal entry, because it is not posted or its posting was deleted.",
            "example": "7JRNsKwy2Lw66caxVU7WGC",
            "format": "base58 (max length 22)",
            "nullable": true,
            "type": "string"
          },
          "ledgerId": {
            "description": " The identifier of the source account's ledger, which the transaction's own line entry posts to.",
            "example": "7JRNsKwy2Lw66caxVU7WGC",
            "format": "base58 (max length 22)",
            "nullable": true,
            "type": "string"
          },
          "lineEntryId": {
            "description": " The identifier of the transaction's own line entry, on the source account's ledger. Omitted when the transaction has no journal entry.",
            "example": "7JRNsKwy2Lw66caxVU7WGC",
            "format": "base58 (max length 22)",
            "nullable": true,
            "type": "string"
          },
          "merchantType": {
            "description": " The display name of the merchant type (Mercury category) automatically assigned to the transaction, such as `Software`. Only included with `enrich=true`.",
            "nullable": true,
            "type": "string"
          },
          "note": {
            "description": " The note on the Mercury transaction. Only included with `enrich=true`.",
            "nullable": true,
            "type": "string"
          },
          "personal": {
            "description": " Whether the transaction is a personal (non-business) transaction.",
            "type": "boolean"
          },
          "postedStatus": {
            "allOf": [
              {
                "$ref": "#/components/schemas/BooksTransactionPostedStatus"
              },
              {
                "description": " Whether the transaction has been posted to the general ledger as a journal entry (`posted`), not yet (`notPosted`), or was posted and then deleted (`deleted`)."
              }
            ]
          },
          "reviewStatus": {
            "allOf": [
              {
                "$ref": "#/components/schemas/BooksTransactionReviewStatus"
              },
              {
                "description": " Whether the transaction's categorization has been reviewed."
              }
            ]
          },
          "sourceAccountId": {
            "description": " The identifier of the source account the transaction belongs to.",
            "example": "7JRNsKwy2Lw66caxVU7WGC",
            "format": "base58 (max length 22)",
            "type": "string"
          },
          "teamMemberId": {
            "description": " The identifier of the team member associated with the transaction, such as the cardholder. Only included with `enrich=true`.",
            "nullable": true,
            "type": "string"
          },
          "teamMemberName": {
            "description": " The full name of the team member associated with the transaction. Only included with `enrich=true`.",
            "nullable": true,
            "type": "string"
          },
          "transactionMethodKind": {
            "allOf": [
              {
                "$ref": "#/components/schemas/TransactionMethodKind"
              },
              {
                "description": " The kind of Mercury transaction, such as a card payment or a wire. Only included with `enrich=true`."
              }
            ],
            "nullable": true
          }
        },
        "required": [
          "id",
          "sourceAccountId",
          "amount",
          "datetime",
          "description",
          "reviewStatus",
          "postedStatus",
          "categorizationLines",
          "personal"
        ],
        "type": "object"
      },
      "BooksAPITransactionAttachment": {
        "description": " A file attached to the Mercury banking transaction behind a Books transaction.",
        "properties": {
          "downloadUrl": {
            "description": " A presigned URL for downloading the attachment, valid for 1 hour.",
            "type": "string"
          },
          "fileName": {
            "description": " The file name of the attachment.",
            "type": "string"
          },
          "id": {
            "description": " The unique identifier of the attachment.",
            "type": "string"
          }
        },
        "required": [
          "id",
          "fileName",
          "downloadUrl"
        ],
        "type": "object"
      },
      "BooksAPITransactionCategorizationLine": {
        "description": " A line of a transaction's journal entry other than its own line on the\n source account's ledger. Its ledger is the transaction's category; a split\n transaction has one line per category.",
        "properties": {
          "amount": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Dollar"
              },
              {
                "description": " The unsigned amount of the line, in dollars; `debitCredit` gives its direction."
              }
            ]
          },
          "debitCredit": {
            "allOf": [
              {
                "$ref": "#/components/schemas/BooksDebitCredit"
              },
              {
                "description": " Whether the amount is a debit or a credit to the ledger."
              }
            ]
          },
          "ledgerId": {
            "description": " The identifier of the ledger (general ledger account) the line posts to, i.e. the category.",
            "example": "7JRNsKwy2Lw66caxVU7WGC",
            "format": "base58 (max length 22)",
            "type": "string"
          },
          "ledgerName": {
            "description": " The display name of the ledger the line posts to.",
            "type": "string"
          },
          "lineEntryId": {
            "description": " The identifier of the categorization line entry.",
            "example": "7JRNsKwy2Lw66caxVU7WGC",
            "format": "base58 (max length 22)",
            "type": "string"
          }
        },
        "required": [
          "lineEntryId",
          "ledgerId",
          "ledgerName",
          "amount",
          "debitCredit"
        ],
        "type": "object"
      },
      "BooksAPITransactionCategorizationMethod": {
        "enum": [
          "ai",
          "rules",
          "similarity",
          "transferBetweenAccounts",
          "uncategorized",
          "user"
        ],
        "type": "string"
      },
      "BooksDebitCredit": {
        "enum": [
          "debit",
          "credit"
        ],
        "type": "string"
      },
      "BooksTransactionPostedStatus": {
        "enum": [
          "notPosted",
          "posted",
          "deleted"
        ],
        "type": "string"
      },
      "BooksTransactionReviewStatus": {
        "enum": [
          "reviewed",
          "unreviewed"
        ],
        "type": "string"
      },
      "Dollar": {
        "description": "A dollar amount",
        "format": "double",
        "type": "number"
      },
      "GetBooksAPITransactionResponse": {
        "description": " Response containing a single transaction.",
        "properties": {
          "transaction": {
            "allOf": [
              {
                "$ref": "#/components/schemas/BooksAPITransaction"
              },
              {
                "description": " The requested transaction"
              }
            ]
          }
        },
        "required": [
          "transaction"
        ],
        "type": "object"
      },
      "TransactionMethodKind": {
        "enum": [
          "outgoingElectronicPayment",
          "outgoingCheckPayment",
          "endogenousOutgoingAchTransfer",
          "endogenousIncomingAchTransfer",
          "exogenousOutgoingAch",
          "exogenousIncomingAch",
          "achReturn",
          "incomingCredit",
          "outgoingCredit",
          "incomingDebit",
          "outgoingDebit",
          "internalTransfer",
          "incomingCheck",
          "outgoingInternationalWire",
          "incomingInternationalWire",
          "outgoingDomesticWire",
          "incomingDomesticWire",
          "wireFee",
          "conversionFee",
          "personalBankingSubscriptionFee",
          "billingEngineSubscriptionFee",
          "physicalCardUpgradeFee",
          "exogenousOutgoingCheck",
          "exogenousOutgoingWire",
          "treasuryTransfer",
          "investTransfer",
          "currencyCloudReturn",
          "internationalWirePartnerReturn",
          "internalCreditAccountPayment",
          "autoRoutingTransfer",
          "ventureDebtFunding",
          "ventureDebtRepayment",
          "creditCashbackRewardsDeposit",
          "externalCreditCashbackRewardsDeposit",
          "interestPayment",
          "outgoingProvisionalCredit",
          "incomingProvisionalCredit",
          "lineOfCreditFunding",
          "lineOfCreditRepayment",
          "lineOfCreditInterestRepayment",
          "atmFeeReimbursement",
          "atmFeeReimbursementReversal",
          "expenseReimbursement",
          "requestedPayment",
          "exogenousWireDrawdown",
          "incomingCreditAccountRepayment",
          "cardIntlTransactionFee",
          "cardIntlTransactionFeeRebate",
          "cardIntlTransactionFeeReversal",
          "cardIntlTransactionFeeRebateReversal",
          "externalCreditAccountPayment",
          "realtimePayment",
          "outgoingRealTimePayment",
          "balanceHold",
          "linkedMercuryAccountTransfer"
        ],
        "type": "string"
      },
      "UTCTime": {
        "example": "2016-07-22T00:00:00Z",
        "format": "yyyy-mm-ddThh:MM:ssZ",
        "type": "string"
      }
    },
    "securitySchemes": {
      "bearerAuth": {
        "description": "Bearer token authentication for Mercury API.\n\nUse your API token in the Authorization header:\n`Authorization: Bearer TOKEN`\n\nExample:\n`Authorization: Bearer secret-token:mercury_production_wma_24SCp4G81X3yHL4Wq8FgzuaP9ye3VKf2mgTDctXyRg5HY_yrucrem`\n\nYour Mercury API token should include the 'secret-token:' prefix.\nTokens can be generated from your Mercury dashboard settings.\n",
        "scheme": "bearer",
        "type": "http"
      }
    }
  },
  "info": {
    "description": "Streamline financial tasks with secure account management and transaction processing. Enables user registration, balance tracking, and payment handling.",
    "title": "Mercury API",
    "version": "1.0.0"
  },
  "openapi": "3.0.0",
  "paths": {
    "/books/transaction/{transactionId}": {
      "get": {
        "description": "Returns a single transaction of a source account (a bank account, credit card, or other feed) by its transaction ID, with the same fields as an item of `GET /books/transactions` (getBooksTransactions): its `amount`, `datetime`, `description`, `reviewStatus`, `postedStatus`, and `categorizationMethod`, and once posted its `journalEntryId`, its own `lineEntryId` on the source account's `ledgerId`, and `categorizationLines`, the other lines of its journal entry with their `lineEntryId`, `ledgerId`, `ledgerName`, `amount`, and `debitCredit`. Use it to read a transaction's current categorization and its `journalEntryId` before recategorizing it with `POST /books/transactions/categorize` (categorizeBooksTransactions). sourceAccountId is required and must be the transaction's own source account (its `sourceAccountId`). Pass enrich=true to add Mercury banking details where available. To find transactions, use `GET /books/transactions` (getBooksTransactions).",
        "operationId": "getBooksTransaction",
        "parameters": [
          {
            "in": "path",
            "name": "transactionId",
            "required": true,
            "schema": {
              "description": "unique id for a transaction",
              "type": "string"
            }
          },
          {
            "description": "The source account the transaction belongs to: the transaction's `sourceAccountId`. It must belong to the Books instance.",
            "in": "query",
            "name": "sourceAccountId",
            "required": true,
            "schema": {
              "description": "unique id for a source account; emitted as base-58, but a base-16 UUID is also accepted",
              "example": "7JRNsKwy2Lw66caxVU7WGC",
              "format": "base58 (max length 22)",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "booksId",
            "required": false,
            "schema": {
              "description": "The Books instance to act on. Must be the token organization's own instance, which it defaults to.",
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "enrich",
            "required": false,
            "schema": {
              "description": "Whether to add Mercury banking details, such as the note, counterparty, and attachments, to the transaction. Defaults to false.",
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetBooksAPITransactionResponse"
                }
              }
            },
            "description": ""
          },
          "400": {
            "description": "Invalid `enrich` or `booksId` or `sourceAccountId`"
          },
          "404": {
            "description": "`transactionId` not found"
          }
        },
        "summary": "Retrieve a transaction",
        "tags": [
          "Books"
        ],
        "x-business-only": true
      }
    }
  },
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "servers": [
    {
      "description": "Mercury API URL",
      "url": "https://api.mercury.com/api/v1"
    }
  ],
  "tags": [
    {
      "description": "Manage organization books",
      "name": "Books",
      "x-business-only": true
    }
  ]
}
```