{"openapi":"3.1.0","info":{"title":"GET /api/v1/inventory/reports/gl-reconciliation","version":"1.0.0","description":"Inventory subledger vs GL tie-out"},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/inventory/reports/gl-reconciliation":{"get":{"tags":["inventory:reports"],"summary":"Inventory subledger vs GL tie-out","description":"Compare the inventory valuation with every inventory-type ledger as of a date and list the reconciling items.","operationId":"get_gl_reconciliation","parameters":[{"name":"as_of_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"description":"Tie-out date (YYYY-MM-DD). Omit for today.","title":"As Of Date"},"description":"Tie-out date (YYYY-MM-DD). Omit for today."},{"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_GLReconciliationResponse_"}}}},"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"}}}},"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_gl_reconciliation_api_v1_inventory_reports_gl_reconciliation_get"}}},"components":{"schemas":{"GLLedgerRow":{"properties":{"ledger_id":{"type":"string","title":"Ledger Id"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"account_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Account Number"},"system_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"System Key"},"role":{"type":"string","enum":["on_hand","landed","prepaid","in_transit"],"title":"Role"},"balance_cents":{"type":"integer","title":"Balance Cents","default":0}},"type":"object","required":["ledger_id","role"],"title":"GLLedgerRow"},"GLReconciliationResponse":{"properties":{"as_of_date":{"type":"string","title":"As Of Date"},"status":{"type":"string","enum":["ties","differs","no_inventory"],"title":"Status"},"ties":{"type":"boolean","title":"Ties"},"tolerance_cents":{"type":"integer","title":"Tolerance Cents"},"cost_basis":{"type":"string","title":"Cost Basis"},"valuation_method":{"type":"string","enum":["live_lots","reconstructed","snapshot","standard"],"title":"Valuation Method"},"subledger_total_cents":{"type":"integer","title":"Subledger Total Cents"},"gl_total_cents":{"type":"integer","title":"Gl Total Cents"},"gl_on_hand_cents":{"type":"integer","title":"Gl On Hand Cents"},"difference_cents":{"type":"integer","title":"Difference Cents","description":"GL total minus subledger."},"on_hand_difference_cents":{"type":"integer","title":"On Hand Difference Cents","description":"Difference left after goods not received yet."},"unexplained_cents":{"type":"integer","title":"Unexplained Cents","description":"Difference the reconciling items do not explain."},"ledgers":{"items":{"$ref":"#/components/schemas/GLLedgerRow"},"type":"array","title":"Ledgers"},"gl_by_source":{"items":{"$ref":"#/components/schemas/GLSourceRow"},"type":"array","title":"Gl By Source"},"reconciling_items":{"items":{"$ref":"#/components/schemas/ReconcilingItem"},"type":"array","title":"Reconciling Items"},"unbilled_receipts":{"items":{"$ref":"#/components/schemas/UnbilledReceiptRow"},"type":"array","title":"Unbilled Receipts"},"entries_not_from_subledger":{"items":{"$ref":"#/components/schemas/NonSubledgerEntryRow"},"type":"array","title":"Entries Not From Subledger"},"uncosted":{"$ref":"#/components/schemas/UncostedSummary"}},"type":"object","required":["as_of_date","status","ties","tolerance_cents","cost_basis","valuation_method","subledger_total_cents","gl_total_cents","gl_on_hand_cents","difference_cents","on_hand_difference_cents","unexplained_cents"],"title":"GLReconciliationResponse","description":"Inventory subledger value against every inventory-type ledger."},"GLSourceRow":{"properties":{"source":{"type":"string","title":"Source"},"amount_cents":{"type":"integer","title":"Amount Cents","default":0},"from_subledger":{"type":"boolean","title":"From Subledger","default":false}},"type":"object","required":["source"],"title":"GLSourceRow"},"NonSubledgerEntryRow":{"properties":{"journal_entry_id":{"type":"string","title":"Journal Entry Id"},"entry_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Entry Number"},"date":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Date"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"source":{"type":"string","title":"Source"},"amount_cents":{"type":"integer","title":"Amount Cents","default":0}},"type":"object","required":["journal_entry_id","source"],"title":"NonSubledgerEntryRow"},"ReconcilingItem":{"properties":{"kind":{"type":"string","enum":["goods_not_received","entries_not_from_subledger","unbilled_receipts"],"title":"Kind"},"label":{"type":"string","title":"Label"},"amount_cents":{"type":"integer","title":"Amount Cents","default":0}},"type":"object","required":["kind","label"],"title":"ReconcilingItem"},"SuccessEnvelope_GLReconciliationResponse_":{"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/GLReconciliationResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[GLReconciliationResponse]"},"UnbilledReceiptRow":{"properties":{"inventory_order_id":{"type":"string","title":"Inventory Order Id"},"po_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Po Number"},"received_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Received At"},"units":{"type":"number","title":"Units","default":0},"value_cents":{"type":"integer","title":"Value Cents","default":0}},"type":"object","required":["inventory_order_id"],"title":"UnbilledReceiptRow"},"UncostedSummary":{"properties":{"variant_count":{"type":"integer","title":"Variant Count","default":0},"units":{"type":"number","title":"Units","default":0},"estimated_value_cents":{"type":"integer","title":"Estimated Value Cents","default":0}},"type":"object","title":"UncostedSummary"},"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":[]}]}