{"openapi":"3.1.0","info":{"title":"PATCH /api/v1/transactions/batch/category","version":"1.0.0","description":"Batch update category"},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/transactions/batch/category":{"patch":{"tags":["transactions"],"summary":"Batch update category","description":"Batch update category for multiple transactions. Updates the opposing line entries' ledger to the specified ledger, effectively recategorizing the transactions.","operationId":"update_transactions_category","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"x-business-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Business-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransactionBulkUpdateCategoryRequest"},"example":{"ledger_id":"019ab37c-1ed6-7000-8000-000000000001","transaction_ids":["019ab37c-0001-7000-8000-000000000001","019ab37c-0002-7000-8000-000000000002","019ab37c-0003-7000-8000-000000000003"]}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_TransactionListResponse_"}}}},"400":{"description":"Bad Request - Invalid input","content":{"application/json":{"example":{"error":"validation_error","message":"Validation failed: due_date: Input should be a valid date","errors":{"due_date":"Input should be a valid date"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized - Missing or expired token, an MCP OAuth token used against the REST API, or no access to this business","content":{"application/json":{"example":{"error":"unauthorized","message":"Authentication required","code":"AUTH_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"example":{"error":"forbidden","message":"You don't have permission to access this resource","code":"AUTH_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"error":"not_found","message":"Resource not found","code":"NOT_FOUND_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"validation_error","message":"Validation failed: amount: Input should be a valid integer","errors":{"amount":"Input should be a valid integer"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}}},"x-fastapi-operation-id":"update_transactions_category_api_v1_transactions_batch_category_patch"}}},"components":{"schemas":{"CategorizedBy":{"properties":{"rule_id":{"type":"string","title":"Rule Id"},"rule_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rule Name"},"field_matched":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Field Matched","description":"The condition field the rule matched on: description, counterparty, amount, transaction_type or bank_account. Null for rows booked before it was recorded."}},"type":"object","required":["rule_id"],"title":"CategorizedBy","description":"The bank rule that chose a transaction's category, from ``meta``."},"CommentResponse":{"properties":{"comment":{"type":"string","maxLength":10000,"minLength":1,"title":"Comment","description":"The comment text content"},"comment_id":{"type":"string","title":"Comment Id","description":"Unique identifier for the comment"},"thread_id":{"type":"string","title":"Thread Id","description":"UUID of the thread this comment belongs to"},"user_id":{"type":"string","title":"User Id","description":"UUID of the user who created the comment"},"user_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Name","description":"Display name of the comment author"},"object_type":{"type":"string","title":"Object Type","description":"Type of object this comment is attached to"},"object_id":{"type":"string","title":"Object Id","description":"UUID of the object this comment is attached to"},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Timestamp when the comment was created"}},"type":"object","required":["comment","comment_id","thread_id","user_id","object_type","object_id","created_at"],"title":"CommentResponse","description":"Schema for comment response."},"CounterpartyProvenance":{"properties":{"source":{"type":"string","enum":["manual","alias","matched","registry","naming_rule","raw"],"title":"Source","description":"``manual`` (renamed by hand on this row), ``naming_rule`` (a business naming rule named it), ``alias`` (a saved rename), ``matched`` (named after the business's own customer/vendor: the invoice/bill this payment is linked to, the AR/AP ledger it is booked to, or a customer/vendor the bank text names), ``registry`` (the linked registry entry's canonical name) or ``raw`` (the stored bank counterparty text)."},"alias_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Alias Id","description":"The saved rename that supplied the name (``alias`` only)."},"alias_key_kind":{"anyOf":[{"type":"string","enum":["registry","name"]},{"type":"null"}],"title":"Alias Key Kind","description":"What that saved rename is keyed on: the registry entry or the raw name (``alias`` only)."},"registry_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Registry Id","description":"Linked counterparty registry entry, if any."},"registry_canonical_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Registry Canonical Name","description":"Canonical name of the linked registry entry, if loaded."},"raw_counterparty":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Raw Counterparty","description":"The counterparty text stored on the row."},"registry_confidence":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Registry Confidence","description":"Confidence of the registry link (0-1), if linked."},"counterparty_method":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Counterparty Method","description":"Who wrote the stored text: ``system``, ``pattern``, ``plaid``, ``ai``, ``rule``, ``matched`` or ``user``."},"naming_rule_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Naming Rule Id","description":"The naming rule that wrote the name (``naming_rule`` only)."},"matched_from":{"anyOf":[{"type":"string","enum":["match","ledger","own_master"]},{"type":"null"}],"title":"Matched From","description":"Which accounting fact named the row (``matched`` only): ``match`` (a linked invoice/bill payment), ``ledger`` (the per-party AR/AP ledger it is booked to) or ``own_master`` (the bank text names one of the business's customers/vendors)."},"matched_party_type":{"anyOf":[{"type":"string","enum":["customer","vendor"]},{"type":"null"}],"title":"Matched Party Type","description":"Kind of master that named the row (``matched`` only)."},"matched_party_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Matched Party Id","description":"Customer or vendor id that named the row (``matched`` only)."}},"type":"object","required":["source"],"title":"CounterpartyProvenance","description":"Where a transaction's displayed counterparty name comes from.\n\nComputed with the same precedence as the displayed name: a name a person\ntyped on the row (``manual``, or ``naming_rule`` when a business naming\nrule wrote it) > a saved rename (``alias``) > the business's own\ncustomer/vendor name taken from its accounting (``matched``) > the linked\nregistry entry's canonical name (``registry``) > the stored bank text\n(``raw``)."},"ExternalReferenceResponse":{"properties":{"system":{"type":"string","title":"System","description":"Source system: `quickbooks`."},"type":{"type":"string","title":"Type","description":"The source object type, e.g. `JournalEntry`, `Bill`, `Invoice`, `Purchase`, `Deposit`, `Transfer`, `Payment`, `BillPayment`, `OpeningBalance`."},"id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Id","description":"The source system's id for the object (the as-of date for an opening balance)."},"number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Number","description":"The source system's visible number exactly as typed there (QuickBooks DocNumber, the Num column; PaymentRefNum on a customer payment). Null when it has none."}},"type":"object","required":["system","type"],"title":"ExternalReferenceResponse","description":"The accounting-system object an imported record came from."},"JournalEntryMandateStamp":{"properties":{"mandate_id":{"type":"string","title":"Mandate Id"},"signature":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Signature"},"subject_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Subject Type"},"subject_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Subject Id"},"subject_label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Subject Label"},"per_payment_ceiling_cents":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Per Payment Ceiling Cents"},"counter_signed_by":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Counter Signed By"},"counter_signed_by_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Counter Signed By Name"},"self_signed":{"type":"boolean","title":"Self Signed","default":false}},"additionalProperties":true,"type":"object","required":["mandate_id"],"title":"JournalEntryMandateStamp","description":"The agent payment mandate stamped on a journal entry."},"JournalEntryResponse":{"properties":{"id":{"type":"string","title":"Id","description":"Unique identifier for this journal entry (UUID7)."},"entry_number":{"type":"string","title":"Entry Number","description":"Sequential display number for this journal entry (prefix + sequence)."},"description":{"type":"string","title":"Description","description":"Human-readable description of the transaction."},"currency":{"type":"string","title":"Currency","description":"Currency for the journal entry (USD, CAD, AUD, EUR, or GBP).","default":"USD"},"entry_date":{"type":"string","format":"date","title":"Entry Date","description":"The date this transaction occurred."},"invoice_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Invoice Id","description":"UUID of linked invoice, if this entry relates to an invoice."},"inventory_order_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Inventory Order Id","description":"UUID of linked inventory order (PO), if this entry relates to a PO."},"production_run_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Production Run Id","description":"UUID of the production run whose transfer this entry books."},"reversed_by_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reversed By Id","description":"UUID of the offsetting reversal journal entry, when this entry has been reversed. Set by reverse_journal_entry for idempotency."},"file_ids":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"File Ids","description":"S3 keys of attached supporting documents (PDF, PNG, JPG)."},"source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source","description":"Backend origin: manual, invoice, bill, credit_memo, transaction, stripe, shopify, plaid, ramp, square, system"},"document_source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Document Source","description":"The document type the entry belongs to: `source`, except an entry imported from QuickBooks reads as the document it came from (bill, invoice, credit_memo, vendor_credit, transaction, manual for a QuickBooks journal entry, system for the opening balance); an entry a credit program posted reads as credit_ledger. The `source` filter matches on it."},"origin":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Origin","description":"The accounting system the entry was imported from (`quickbooks`), else null."},"external_reference":{"anyOf":[{"$ref":"#/components/schemas/ExternalReferenceResponse"},{"type":"null"}],"description":"The QuickBooks object (type, id, number) an imported entry came from; null otherwise."},"creation_method":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Creation Method","description":"User-facing creation method: ai (system-generated), manual (user-typed, including journal entries typed in QuickBooks) or imported (brought over from another accounting system)"},"created_method":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created Method","description":"How the entry was created: hand_typed (a person keyed the lines), bulk_upload (posted from an uploaded spreadsheet; also source=manual) or system (generated by an integration or workflow)"},"business_id":{"type":"string","title":"Business Id","description":"UUID of the business this entry belongs to."},"line_entries":{"anyOf":[{"items":{"$ref":"#/components/schemas/LineEntryResponse"},"type":"array"},{"type":"null"}],"title":"Line Entries","description":"The debit and credit line entries that make up this journal entry. Will be empty list if not expanded."},"thread":{"anyOf":[{"$ref":"#/components/schemas/JournalEntryThreadResponse"},{"type":"null"}],"description":"Comment thread information if this journal entry has comments. Contains thread_id, comments array, and comment_count."},"credit_memo_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Credit Memo Id","description":"UUID of the linked credit memo, if any."},"vendor_credit_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Vendor Credit Id","description":"UUID of the linked vendor credit, if any."},"bill_ids":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Bill Ids","description":"UUIDs of the bills this entry is linked to."},"created_by":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created By","description":"User id that created the entry. Null for entries created before attribution was recorded or by a system process."},"updated_by":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Updated By","description":"User id that last updated the entry. Null when never updated by a user."},"warnings":{"items":{"type":"string"},"type":"array","title":"Warnings","description":"Advisory notes on a create or update, such as a description that is empty, only an id, or has no month or year. The entry is saved regardless."},"combined_line_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Combined Line Count","description":"On a create with combine_duplicate_lines, how many input lines were merged into another line."},"mandate":{"anyOf":[{"$ref":"#/components/schemas/JournalEntryMandateStamp"},{"type":"null"}],"description":"The agent payment mandate that covered the payment this entry books (id, signature, subject, ceiling, approver). Null for an entry a person made or that no mandate covered."},"created_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Created At","description":"When this journal entry was created."},"updated_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Updated At","description":"When this journal entry was last modified."}},"additionalProperties":true,"type":"object","required":["id","entry_number","description","entry_date","business_id"],"title":"JournalEntryResponse","description":"Response schema for a journal entry.\n\nA journal entry is a complete double-entry accounting record consisting of\ntwo or more line entries that must balance (total debits = total credits).","example":{"business_id":"019ab37c-0002-7000-8000-000000000002","created_at":"2024-01-15T10:30:00Z","description":"Record sale to customer - Invoice #1234","entry_date":"2024-01-15","id":"019ab37c-0001-7000-8000-000000000001","invoice_id":"019ab37c-e5b3-7c49-96e1-7c3b4d9f0e2b","line_entries":[{"amount":150000,"business_id":"019ab37c-0002-7000-8000-000000000002","created_at":"2024-01-15T10:30:00Z","debit_credit":"debit","description":"Accounts Receivable - Customer ABC","entry_date":"2024-01-15","id":"019ab37c-a1b2-7c3d-e4f5-6a7b8c9d0e1f","journal_entry_id":"019ab37c-0001-7000-8000-000000000001","ledger_id":"019ab37c-c309-7698-a8d9-14e0409977d8","updated_at":"2024-01-15T10:30:00Z"},{"amount":150000,"business_id":"019ab37c-0002-7000-8000-000000000002","created_at":"2024-01-15T10:30:00Z","debit_credit":"credit","description":"Sales Revenue","entry_date":"2024-01-15","id":"019ab37c-b2c3-7d4e-f5a6-7b8c9d0e1f2a","journal_entry_id":"019ab37c-0001-7000-8000-000000000001","ledger_id":"019ab37c-d4a2-7b38-85f0-6b2a3c8e9f1a","updated_at":"2024-01-15T10:30:00Z"}],"updated_at":"2024-01-15T10:30:00Z"},"examples":[{"business_id":"019ab37c-0002-7000-8000-000000000002","created_at":"2024-01-15T10:30:00Z","description":"Record sale to customer - Invoice #1234","entry_date":"2024-01-15","id":"019ab37c-0001-7000-8000-000000000001","invoice_id":"019ab37c-e5b3-7c49-96e1-7c3b4d9f0e2b","line_entries":[{"amount":150000,"business_id":"019ab37c-0002-7000-8000-000000000002","created_at":"2024-01-15T10:30:00Z","debit_credit":"debit","description":"Accounts Receivable - Customer ABC","entry_date":"2024-01-15","id":"019ab37c-a1b2-7c3d-e4f5-6a7b8c9d0e1f","journal_entry_id":"019ab37c-0001-7000-8000-000000000001","ledger_id":"019ab37c-c309-7698-a8d9-14e0409977d8","updated_at":"2024-01-15T10:30:00Z"},{"amount":150000,"business_id":"019ab37c-0002-7000-8000-000000000002","created_at":"2024-01-15T10:30:00Z","debit_credit":"credit","description":"Sales Revenue","entry_date":"2024-01-15","id":"019ab37c-b2c3-7d4e-f5a6-7b8c9d0e1f2a","journal_entry_id":"019ab37c-0001-7000-8000-000000000001","ledger_id":"019ab37c-d4a2-7b38-85f0-6b2a3c8e9f1a","updated_at":"2024-01-15T10:30:00Z"}],"updated_at":"2024-01-15T10:30:00Z"}]},"JournalEntryThreadResponse":{"properties":{"thread_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Thread Id","description":"UUID of the associated comment thread."},"comments":{"items":{"$ref":"#/components/schemas/CommentResponse"},"type":"array","title":"Comments","description":"List of comments in the thread."},"comment_count":{"type":"integer","title":"Comment Count","description":"Total number of comments.","default":0}},"type":"object","title":"JournalEntryThreadResponse","description":"Nested thread information for journal entries.\n\nContains comment thread data when a journal entry has associated comments/discussion."},"LineEntryResponse":{"properties":{"id":{"type":"string","title":"Id","description":"Unique identifier for this line entry (UUID7)."},"amount":{"type":"integer","title":"Amount","description":"Amount in cents (e.g., 15000 = $150.00). Always positive; direction determined by debit_credit."},"currency":{"type":"string","title":"Currency","description":"Currency for the line entry (USD, CAD, AUD, EUR, or GBP).","default":"USD"},"debit_credit":{"type":"string","title":"Debit Credit","description":"Whether this is a 'debit' or 'credit' entry. Debits increase asset/expense accounts; credits increase liability/equity/revenue accounts."},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"Description of what this specific line entry represents."},"entry_date":{"type":"string","format":"date","title":"Entry Date","description":"Date of the line entry (typically matches parent journal entry)."},"ledger_id":{"type":"string","title":"Ledger Id","description":"UUID of the ledger account this entry affects (e.g., Cash, Accounts Receivable)."},"ledger_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ledger Name","description":"Human-readable name of the ledger account (e.g., 'Cash', 'Accounts Receivable')."},"class_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Class Id","description":"Optional Class dimension tag for this line."},"location_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Location Id","description":"Optional Location dimension tag for this line."},"project_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Project Id","description":"Optional Project (job-costing) tag for this line."},"counterparty_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Counterparty Name","description":"Counterparty of this line when it differs from the transaction's (e.g. one employee's leg of a split payroll debit). Null means the line shares the transaction's counterparty."},"person_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Person Id","description":"People-roster person this line is about (resolved from the counterparty name, or chosen). Null when the line names nobody on the roster."},"journal_entry_id":{"type":"string","title":"Journal Entry Id","description":"UUID of the parent journal entry this line belongs to."},"business_id":{"type":"string","title":"Business Id","description":"UUID of the business this entry belongs to."},"created_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Created At","description":"When this line entry was created."},"updated_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Updated At","description":"When this line entry was last modified."}},"type":"object","required":["id","amount","debit_credit","entry_date","ledger_id","journal_entry_id","business_id"],"title":"LineEntryResponse","description":"Response schema for a line entry within a journal entry.\n\nEach line entry represents one side of the double-entry accounting record,\neither a debit or credit to a specific ledger account.","example":{"amount":150000,"business_id":"019ab37c-0002-7000-8000-000000000002","created_at":"2024-01-15T10:30:00Z","debit_credit":"debit","description":"Accounts Receivable - Customer ABC","entry_date":"2024-01-15","id":"019ab37c-a1b2-7c3d-e4f5-6a7b8c9d0e1f","journal_entry_id":"019ab37c-0001-7000-8000-000000000001","ledger_id":"019ab37c-c309-7698-a8d9-14e0409977d8","updated_at":"2024-01-15T10:30:00Z"},"examples":[{"amount":150000,"business_id":"019ab37c-0002-7000-8000-000000000002","created_at":"2024-01-15T10:30:00Z","debit_credit":"debit","description":"Accounts Receivable - Customer ABC","entry_date":"2024-01-15","id":"019ab37c-a1b2-7c3d-e4f5-6a7b8c9d0e1f","journal_entry_id":"019ab37c-0001-7000-8000-000000000001","ledger_id":"019ab37c-c309-7698-a8d9-14e0409977d8","updated_at":"2024-01-15T10:30:00Z"}]},"OpposingLineEntryLedgerInfo":{"properties":{"id":{"type":"string","title":"Id","description":"Ledger UUID."},"name":{"type":"string","title":"Name","description":"Ledger name (e.g., 'Office Supplies', 'Sales Revenue')."},"type":{"type":"string","title":"Type","description":"Ledger type: asset, liability, equity, revenue, expense."},"financial_account_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Financial Account Type","description":"If this ledger is a connected bank/credit-card/prepaid account, the account subtype (e.g. 'bank_account', 'credit_card'). Null for regular category ledgers. Non-null means this opposing entry represents an inter-account movement, not a spend category."},"system_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"System Key","description":"Immutable system identifier for built-in ledgers (e.g. 'transfers_between_accounts', 'accounts_receivable'). Null for user-created ledgers."}},"type":"object","required":["id","name","type"],"title":"OpposingLineEntryLedgerInfo","description":"Embedded ledger information for opposing line entries."},"OpposingLineEntryResponse":{"properties":{"id":{"type":"string","title":"Id","description":"Line entry UUID."},"amount":{"type":"integer","title":"Amount","description":"Amount in cents (always positive; direction via debit_credit)."},"debit_credit":{"type":"string","title":"Debit Credit","description":"Whether this is a 'debit' or 'credit' entry."},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"Description of this line entry."},"class_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Class Id","description":"Class dimension assigned to this line, if any."},"location_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Location Id","description":"Location dimension assigned to this line, if any."},"project_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Project Id","description":"Project assigned to this line, if any."},"counterparty_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Counterparty Name","description":"Counterparty of this leg when it differs from the transaction's, e.g. the employee on one leg of a split payroll debit. Null means the leg shares the transaction's counterparty."},"ledger":{"$ref":"#/components/schemas/OpposingLineEntryLedgerInfo","description":"The ledger (account) this entry affects."}},"type":"object","required":["id","amount","debit_credit","ledger"],"title":"OpposingLineEntryResponse","description":"Response schema for opposing line entries with ledger details.\n\nOpposing line entries are the counter-entries in a double-entry transaction.\nFor a bank transaction, these represent the category/account the transaction\nwas posted to (e.g., an expense or revenue account).","example":{"amount":15000,"debit_credit":"debit","description":"Office supplies purchase","id":"019ab37c-a1b2-7c3d-e4f5-6a7b8c9d0e1f","ledger":{"id":"019ab37c-1ed1-7000-8000-000000000001","name":"Office Supplies","type":"expense"}},"examples":[{"amount":15000,"debit_credit":"debit","description":"Office supplies purchase","id":"019ab37c-a1b2-7c3d-e4f5-6a7b8c9d0e1f","ledger":{"id":"019ab37c-1ed1-7000-8000-000000000001","name":"Office Supplies","type":"expense"}}]},"SuccessEnvelope_TransactionListResponse_":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message"},"code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Code"},"data":{"anyOf":[{"$ref":"#/components/schemas/TransactionListResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[TransactionListResponse]"},"TransactionBulkUpdateCategoryRequest":{"properties":{"transaction_ids":{"items":{"type":"string"},"type":"array","minItems":1,"title":"Transaction Ids","description":"Array of transaction UUIDs to update."},"ledger_id":{"type":"string","title":"Ledger Id","description":"UUID of the ledger to assign to opposing line entries."},"create_rules":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Create Rules","description":"Also create a bank rule per counterparty so future transactions follow. Omit to follow the business's 'Learn rules from my recategorizations' automation setting (off by default)."}},"type":"object","required":["transaction_ids","ledger_id"],"title":"TransactionBulkUpdateCategoryRequest","description":"Request schema for bulk updating transaction categories.\n\nUpdates the opposing line entries' ledger for multiple transactions at once.\nThis recategorizes transactions by changing the ledger on their opposing line entries.","example":{"ledger_id":"019ab37c-1ed6-7000-8000-000000000001","transaction_ids":["019ab37c-0001-7000-8000-000000000001","019ab37c-0002-7000-8000-000000000002","019ab37c-0003-7000-8000-000000000003"]},"examples":[{"ledger_id":"019ab37c-1ed6-7000-8000-000000000001","transaction_ids":["019ab37c-0001-7000-8000-000000000001","019ab37c-0002-7000-8000-000000000002","019ab37c-0003-7000-8000-000000000003"]}]},"TransactionListItemResponse":{"properties":{"id":{"type":"string","title":"Id","description":"Unique identifier (UUID7)."},"amount":{"type":"integer","title":"Amount","description":"Amount in cents. Positive = deposit/income, negative = withdrawal/expense."},"display_amount":{"type":"integer","title":"Display Amount","description":"UI-facing amount in cents using cash-flow convention: negative = outflow/expense, positive = inflow/income. Differs from ``amount`` for credit-card accounts that store Plaid-native signs."},"currency":{"type":"string","title":"Currency","description":"Currency code (USD, CAD, AUD, EUR, or GBP).","default":"USD"},"datetime":{"type":"string","format":"date","title":"Datetime","description":"The date the transaction occurred."},"counterparty":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Counterparty","description":"Clean counterparty/merchant name extracted from bank data."},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"Transaction memo/description (cleaned)."},"meta":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Meta","description":"Additional metadata (raw Plaid description in raw_plaid_description)."},"attachment_count":{"type":"integer","title":"Attachment Count","description":"Number of receipts / supporting documents attached to this transaction. The entries themselves are in ``meta.attachments``.","default":0},"receipt_status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Receipt Status","description":"Where this transaction stands on receipts: 'attached', 'exempt' (marked no receipt needed), 'not_required' (the business's receipt policy does not ask for one), 'requested' (the client has an open request) or 'missing'."},"categorization_method":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Categorization Method","description":"How categorized: 'ai', 'rules', 'similarity', 'transfer_between_accounts', 'uncategorized', 'user', 'historical', or 'global_pattern'; null if uncategorized."},"counterparty_category":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Counterparty Category","description":"The bank's category for the row (Plaid's personal finance category, e.g. TRANSFER_IN). A bank rule skips a row whose category is a transfer unless the rule has `match_transfers`."},"categorized_by":{"anyOf":[{"$ref":"#/components/schemas/CategorizedBy"},{"type":"null"}],"description":"The bank rule that chose the current category: rule_id, rule_name and field_matched (the condition field it matched on). Null when no rule did. Filter by it with `rule_id`."},"posted_status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Posted Status","description":"Posting status: 'not_posted', 'posted', or 'deleted'."},"review_status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Review Status","description":"Review status: 'unreviewed' or 'reviewed'."},"source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source","description":"Transaction origin: 'manual', 'plaid', 'bulk_upload', 'xero', 'quickbooks', or 'ramp'. Determines if the transaction can be deleted."},"opposing_line_entry_ids":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Opposing Line Entry Ids","description":"Linked line entry UUIDs for categorization."},"personal":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Personal","description":"True if marked as personal (non-business) expense."},"journal_entry_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Journal Entry Id","description":"Linked journal entry UUID."},"external_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Id","description":"External accounting system ID."},"external_ledger_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Ledger Id","description":"External ledger ID."},"external_source_account_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Source Account Id","description":"External source account ID."},"external_reference":{"anyOf":[{"$ref":"#/components/schemas/ExternalReferenceResponse"},{"type":"null"}],"description":"The QuickBooks object (type, id, number) an imported row came from; null otherwise."},"ledger_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ledger Id","description":"Bank account (ledger) UUID."},"ledger_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ledger Name","description":"Bank account (ledger) name for display."},"ledger_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ledger Type","description":"Ledger account type: asset, liability, equity, revenue, or expense."},"account_mask":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Account Mask","description":"Last 4 digits of the card/account this transaction settled on. From the connected provider account when the ledger is linked; for Ramp rows (which all post to one payable ledger) it is the individual card's last 4. Null when neither is known. Display convention is ``****1234`` (see ``Account.display_name``)."},"card_holder_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Card Holder Name","description":"Whose card this charge (or reimbursement) was on: the employee as the card program (Ramp) reports it, or the card member a bank reports for an account that carries several cards (Plaid ``account_owner``, e.g. AMEX supplementary cards), in the bank's own format, or the Ramp cardholder on a row imported from QuickBooks. Null when the row cannot say."},"account_holder":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Account Holder","description":"Whose card or bank account this row was on, one field across Ramp, Plaid, Brex and Payliance (same value as ``card_holder_name``, which stays for existing clients). Null when the row cannot say."},"holder_last4":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Holder Last4","description":"Last 4 digits of the holder's card or bank account: what the feed recorded on the row, else the ledger's ``account_mask``."},"counterparty_provenance":{"anyOf":[{"$ref":"#/components/schemas/CounterpartyProvenance"},{"type":"null"}],"description":"Why ``counterparty`` shows this name: which layer of the name precedence (manual rename > naming rule > saved rename > registry > raw bank text) supplied it."},"business_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Business Id","description":"Business UUID."},"reconciled":{"type":"boolean","title":"Reconciled","description":"True if reconciled with bank statement.","default":false},"assigned_to_user_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Assigned To User Id","description":"Team member this transaction is assigned to."},"assigned_to_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Assigned To Name","description":"That team member's name (email when no name is set)."},"invoice_ids":{"items":{"type":"string"},"type":"array","title":"Invoice Ids","description":"Invoice UUIDs linked via payments (from invoice_payments junction table)."},"bill_ids":{"items":{"type":"string"},"type":"array","title":"Bill Ids","description":"Bill UUIDs linked via payments (from bill_payments junction table)."},"created_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Created At","description":"Record creation timestamp."},"updated_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Updated At","description":"Last update timestamp."},"comment_count":{"type":"integer","title":"Comment Count","description":"Number of comments on this transaction.","default":0},"journal_entry":{"anyOf":[{"$ref":"#/components/schemas/JournalEntryResponse"},{"type":"null"}],"description":"Full journal entry details if categorized."},"opposing_line_entries":{"items":{"$ref":"#/components/schemas/OpposingLineEntryResponse"},"type":"array","title":"Opposing Line Entries","description":"Opposing line entries showing the category/account(s) this transaction was posted to. Empty if uncategorized."},"can_be_deleted":{"type":"boolean","title":"Can Be Deleted","description":"True iff the caller can delete this transaction. Manual and bulk-uploaded rows are permanently deletable on any engine; Plaid rows can be hidden on the DayZero local engine.","default":false}},"additionalProperties":true,"type":"object","required":["id","amount","display_amount","datetime"],"title":"TransactionListItemResponse","description":"Response schema for a transaction in list endpoints.\n\nOptimized for list views - includes comment_count instead of full thread data.\nUse GET /transactions/{id} to retrieve full thread details.","example":{"amount":-15000,"bill_ids":[],"business_id":"019ab37c-b051-7000-8000-000000000001","can_be_deleted":true,"categorization_method":"rules","comment_count":3,"counterparty":"Staples","created_at":"2024-01-15T10:30:00Z","datetime":"2024-01-15","description":"Office Supplies","display_amount":-15000,"id":"019ab37c-0001-7000-8000-000000000001","invoice_ids":["019ab37c-1a01-7000-8000-000000000001"],"journal_entry_id":"019ab37c-3e01-7000-8000-000000000001","ledger_id":"019ab37c-1ed1-7000-8000-000000000001","ledger_name":"Chase Checking ****1234","opposing_line_entries":[{"amount":15000,"debit_credit":"debit","description":"Office supplies purchase","id":"019ab37c-a1b2-7c3d-e4f5-6a7b8c9d0e1f","ledger":{"id":"019ab37c-1ed2-7000-8000-000000000002","name":"Office Supplies","type":"expense"}}],"personal":false,"posted_status":"posted","reconciled":true,"review_status":"reviewed","updated_at":"2024-01-16T09:00:00Z"},"examples":[{"amount":-15000,"bill_ids":[],"business_id":"019ab37c-b051-7000-8000-000000000001","can_be_deleted":true,"categorization_method":"rules","comment_count":3,"counterparty":"Staples","created_at":"2024-01-15T10:30:00Z","datetime":"2024-01-15","description":"Office Supplies","display_amount":-15000,"id":"019ab37c-0001-7000-8000-000000000001","invoice_ids":["019ab37c-1a01-7000-8000-000000000001"],"journal_entry_id":"019ab37c-3e01-7000-8000-000000000001","ledger_id":"019ab37c-1ed1-7000-8000-000000000001","ledger_name":"Chase Checking ****1234","opposing_line_entries":[{"amount":15000,"debit_credit":"debit","description":"Office supplies purchase","id":"019ab37c-a1b2-7c3d-e4f5-6a7b8c9d0e1f","ledger":{"id":"019ab37c-1ed2-7000-8000-000000000002","name":"Office Supplies","type":"expense"}}],"personal":false,"posted_status":"posted","reconciled":true,"review_status":"reviewed","updated_at":"2024-01-16T09:00:00Z"}]},"TransactionListResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/TransactionListItemResponse"},"type":"array","title":"Items","description":"List of items"},"total":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Total","description":"Total number of items (null when not calculated for performance)"},"limit":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Limit","description":"Pagination limit"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor","description":"Cursor for next page"},"prev_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Prev Cursor","description":"Cursor for previous page"},"has_next":{"type":"boolean","title":"Has Next","description":"Whether there are more items"},"has_prev":{"type":"boolean","title":"Has Prev","description":"Whether there are previous items"}},"type":"object","required":["items","has_next","has_prev"],"title":"TransactionListResponse","description":"Paginated list of transactions with cursor-based navigation.\n\nUses TransactionListItemResponse with comment_count for efficiency.\nUse GET /transactions/{id} to get full thread details with comments."},"ErrorResponse":{"title":"ErrorResponse","type":"object","description":"Envelope returned by every non-2xx response. Branch on `code` (stable) rather than `message` (human-readable, may change).","required":["error","message","code"],"properties":{"error":{"type":"string","description":"Error category: `validation_error`, `unauthorized`, `forbidden`, `not_found`, `conflict`, `rate_limited`, `server_error`, or `service_unavailable`."},"message":{"type":"string","description":"Human-readable explanation, safe to show to end users."},"code":{"type":"string","description":"Stable machine-readable code in `CATEGORY_NNN` form (e.g. `NOT_FOUND_006`, `AUTH_010`, `GEN_002`)."},"request_id":{"type":"string","description":"Correlation id for support requests. Echoes the `x-request-id` request header when one was supplied."},"errors":{"type":"object","additionalProperties":{"type":"string"},"description":"Field-level validation messages keyed by field name. Present on 400/422 validation failures only."}}}},"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"API Token","description":"API token authentication. Format: `Bearer dz_...`"}}},"security":[{"BearerAuth":[]}]}