{"openapi":"3.1.0","info":{"title":"GET /api/v1/credit/finance/postings/{entry_id}","version":"1.0.0","description":"Audit one credit ledger posting"},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/credit/finance/postings/{entry_id}":{"get":{"tags":["credit"],"summary":"Audit one credit ledger posting","description":"One posted journal entry, or a draft, with its accounts, the line, loan and payment behind it, the register entries and arithmetic it follows from, the record it came from (Brex charge, Payliance debit), and who posted it and when.","operationId":"get_posting_audit","parameters":[{"name":"entry_id","in":"path","required":true,"schema":{"type":"string","description":"A journal entry id, or a draft id.","title":"Entry Id"},"description":"A journal entry id, or a draft id."},{"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"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_PostingAuditResponse_"}}}},"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":"get_posting_audit_api_v1_credit_finance_postings__entry_id__get"}}},"components":{"schemas":{"PostingAccrualDay":{"properties":{"accrual_date":{"type":"string","format":"date","title":"Accrual Date","description":"The day."},"principal_basis_cents":{"type":"integer","title":"Principal Basis Cents","description":"The principal the day was charged on."},"rate_bps":{"type":"integer","title":"Rate Bps","description":"The annual rate in basis points."},"amount":{"type":"string","title":"Amount","description":"Interest for the day in cents, full precision."}},"type":"object","required":["accrual_date","principal_basis_cents","rate_bps","amount"],"title":"PostingAccrualDay","description":"One day's interest behind an accrual entry."},"PostingAllocation":{"properties":{"loan_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Loan Id","description":"The loan it paid."},"principal_cents":{"type":"integer","title":"Principal Cents","description":"Principal paid."},"fee_cents":{"type":"integer","title":"Fee Cents","description":"Fee paid."},"interest_cents":{"type":"integer","title":"Interest Cents","description":"Interest paid."}},"type":"object","required":["principal_cents","fee_cents","interest_cents"],"title":"PostingAllocation","description":"How a payment applied to one loan."},"PostingAuditResponse":{"properties":{"id":{"type":"string","title":"Id","description":"The journal entry id, or the draft id while a draft."},"status":{"type":"string","enum":["draft","posted"],"title":"Status","description":"`draft` or `posted`."},"journal_entry_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Journal Entry Id","description":"The journal entry id; null while the entry is a draft."},"draft_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Draft Id","description":"The draft the entry was posted from, if any."},"entry_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Entry Number","description":"The journal entry number."},"entry_date":{"type":"string","format":"date","title":"Entry Date","description":"The date the entry books on."},"event":{"type":"string","title":"Event","description":"What the entry records."},"event_label":{"type":"string","title":"Event Label","description":"The event as an operator reads it."},"memo":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Memo","description":"The entry's description."},"reference":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reference","description":"The reference it carries."},"source":{"type":"string","title":"Source","description":"The source the books show.","default":"Credit Ledger"},"program_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Program Id","description":"The program."},"program_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Program Name","description":"The program's name."},"legs":{"items":{"$ref":"#/components/schemas/PostingLeg"},"type":"array","title":"Legs","description":"The accounts it touches."},"line":{"anyOf":[{"$ref":"#/components/schemas/PostingLineInfo"},{"type":"null"}],"description":"The credit line."},"loan":{"anyOf":[{"$ref":"#/components/schemas/PostingLoanInfo"},{"type":"null"}],"description":"The loan."},"payment":{"anyOf":[{"$ref":"#/components/schemas/PostingPaymentInfo"},{"type":"null"}],"description":"The payment."},"register_entries":{"items":{"$ref":"#/components/schemas/PostingRegisterEntry"},"type":"array","title":"Register Entries","description":"Register entries on the same loan or payment and date."},"calculation":{"anyOf":[{"$ref":"#/components/schemas/PostingCalculation"},{"type":"null"}],"description":"How the amount follows from the terms."},"source_events":{"items":{"$ref":"#/components/schemas/PostingSourceEvent"},"type":"array","title":"Source Events","description":"The outside records it came from."},"created_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Created At","description":"When the credit ledger recorded the entry."},"posted_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Posted At","description":"When it was booked."},"posted_by_user_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Posted By User Id","description":"The operator who posted a draft."},"posted_by":{"type":"string","title":"Posted By","description":"Who posted it: a person's name, or the credit ledger itself."}},"type":"object","required":["id","status","entry_date","event","event_label","posted_by"],"title":"PostingAuditResponse","description":"Everything behind one posting: the line, the loans and payments, the numbers, who posted it."},"PostingCalculation":{"properties":{"summary":{"type":"string","title":"Summary","description":"The calculation in words."},"rate_bps":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Rate Bps","description":"The rate used, in basis points."},"days":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Days","description":"Days, or the term."},"base_cents":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Base Cents","description":"What the rate applied to."},"result_cents":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Result Cents","description":"The amount that posted."},"accrual_days":{"items":{"$ref":"#/components/schemas/PostingAccrualDay"},"type":"array","title":"Accrual Days","description":"The daily rows of an accrual."}},"type":"object","required":["summary"],"title":"PostingCalculation","description":"How the entry's amount follows from the loan's terms."},"PostingLeg":{"properties":{"ledger_id":{"type":"string","title":"Ledger Id","description":"The ledger."},"account":{"type":"string","title":"Account","description":"The account name."},"account_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Account Number","description":"The account number."},"debit_cents":{"type":"integer","title":"Debit Cents","description":"Amount debited.","default":0},"credit_cents":{"type":"integer","title":"Credit Cents","description":"Amount credited.","default":0}},"type":"object","required":["ledger_id","account"],"title":"PostingLeg","description":"One account an entry touches."},"PostingLineInfo":{"properties":{"credit_line_id":{"type":"string","title":"Credit Line Id","description":"The line."},"borrower":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Borrower","description":"The merchant's name or id."},"external_line_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Line Id","description":"The partner's line id."},"external_merchant_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Merchant Id","description":"The partner's merchant id."},"status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status","description":"The line's status."}},"type":"object","required":["credit_line_id"],"title":"PostingLineInfo","description":"The credit line behind an entry."},"PostingLoanInfo":{"properties":{"loan_id":{"type":"string","title":"Loan Id","description":"The loan."},"external_settlement_id":{"type":"string","title":"External Settlement Id","description":"The issuer transaction id."},"merchant_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Merchant Name","description":"Where the card was used."},"originated_on":{"type":"string","format":"date","title":"Originated On","description":"The issuer posting date."},"due_date":{"type":"string","format":"date","title":"Due Date","description":"When the loan falls due."},"principal_cents":{"type":"integer","title":"Principal Cents","description":"The settled transaction amount."},"disbursement_fee_cents":{"type":"integer","title":"Disbursement Fee Cents","description":"The fee assessed at origination."},"rate_bps":{"type":"integer","title":"Rate Bps","description":"The annual interest rate in basis points."},"term_days":{"type":"integer","title":"Term Days","description":"The payback term."},"status":{"type":"string","title":"Status","description":"The loan's status."}},"type":"object","required":["loan_id","external_settlement_id","originated_on","due_date","principal_cents","disbursement_fee_cents","rate_bps","term_days","status"],"title":"PostingLoanInfo","description":"The loan behind an entry."},"PostingPaymentInfo":{"properties":{"payment_id":{"type":"string","title":"Payment Id","description":"The payment."},"external_payment_id":{"type":"string","title":"External Payment Id","description":"The partner's payment reference."},"method":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Method","description":"How it was paid."},"amount_cents":{"type":"integer","title":"Amount Cents","description":"The amount received."},"paid_on":{"type":"string","format":"date","title":"Paid On","description":"The date it counts from."},"status":{"type":"string","title":"Status","description":"The payment's status."},"reversed_on":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Reversed On","description":"When it was returned."},"allocations":{"items":{"$ref":"#/components/schemas/PostingAllocation"},"type":"array","title":"Allocations","description":"How it applied across loans."}},"type":"object","required":["payment_id","external_payment_id","amount_cents","paid_on","status"],"title":"PostingPaymentInfo","description":"The payment behind an entry."},"PostingRegisterEntry":{"properties":{"sequence_no":{"type":"integer","title":"Sequence No","description":"Position in the line's register."},"entry_type":{"type":"string","title":"Entry Type","description":"What the register entry records."},"effective_date":{"type":"string","format":"date","title":"Effective Date","description":"The date it counts from."},"amount_cents":{"type":"integer","title":"Amount Cents","description":"The event's gross amount."},"principal_delta_cents":{"type":"integer","title":"Principal Delta Cents","description":"Change to principal."},"fee_delta_cents":{"type":"integer","title":"Fee Delta Cents","description":"Change to the fee."},"interest_delta_cents":{"type":"integer","title":"Interest Delta Cents","description":"Change to interest."},"memo":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Memo","description":"The register's memo."}},"type":"object","required":["sequence_no","entry_type","effective_date","amount_cents","principal_delta_cents","fee_delta_cents","interest_delta_cents"],"title":"PostingRegisterEntry","description":"A credit register entry on the same loan or payment and date."},"PostingSourceEvent":{"properties":{"kind":{"type":"string","enum":["brex_charge","payliance_debit","card_settlement","payment"],"title":"Kind","description":"What kind of record."},"label":{"type":"string","title":"Label","description":"The record as an operator reads it."},"reference":{"type":"string","title":"Reference","description":"Its id or reference."},"detail":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Detail","description":"What identifies it."}},"type":"object","required":["kind","label","reference"],"title":"PostingSourceEvent","description":"The record outside the credit ledger the event came from."},"SuccessEnvelope_PostingAuditResponse_":{"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/PostingAuditResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[PostingAuditResponse]"},"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":[]}]}