{"openapi":"3.1.0","info":{"title":"GET /api/v1/deferred-revenue/matrix","version":"1.0.0","description":"Deferred revenue matrix"},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/deferred-revenue/matrix":{"get":{"tags":["deferred-revenue"],"summary":"Deferred revenue matrix","description":"Deferred invoices (rows) against recognition months (columns).","operationId":"deferred_revenue_matrix_api_v1_deferred_revenue_matrix_get","parameters":[{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"$ref":"#/components/schemas/DeferralStatusEnum"},{"type":"null"}],"description":"Filter by deferral status","default":"active","title":"Status"},"description":"Filter by deferral status"},{"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_DeferredRevenueMatrixResponse_"}}}},"401":{"description":"Unauthorized - Authentication required","content":{"application/json":{"example":{"detail":"Not authenticated"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"example":{"detail":"Not enough permissions"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"DeferralStatusEnum":{"type":"string","enum":["active","completed","cancelled"],"title":"DeferralStatusEnum","description":"Lifecycle of a deferral."},"DeferredRevenueMatrixCell":{"properties":{"period":{"type":"string","title":"Period","description":"YYYY-MM"},"amount_cents":{"type":"integer","title":"Amount Cents"},"recognized":{"type":"boolean","title":"Recognized"}},"type":"object","required":["period","amount_cents","recognized"],"title":"DeferredRevenueMatrixCell","description":"One invoice/month cell of the deferred revenue matrix."},"DeferredRevenueMatrixResponse":{"properties":{"periods":{"items":{"type":"string"},"type":"array","title":"Periods","description":"Month columns, ascending YYYY-MM"},"rows":{"items":{"$ref":"#/components/schemas/DeferredRevenueMatrixRow"},"type":"array","title":"Rows"},"period_totals":{"items":{"type":"integer"},"type":"array","title":"Period Totals","description":"Column totals, aligned with `periods`"},"customer_totals":{"additionalProperties":{"type":"integer"},"type":"object","title":"Customer Totals","description":"Remaining deferred balance grouped by customer name"},"total_deferred_cents":{"type":"integer","title":"Total Deferred Cents"},"total_recognized_cents":{"type":"integer","title":"Total Recognized Cents"},"total_remaining_cents":{"type":"integer","title":"Total Remaining Cents"}},"type":"object","required":["periods","rows","period_totals","total_deferred_cents","total_recognized_cents","total_remaining_cents"],"title":"DeferredRevenueMatrixResponse","description":"Invoices (rows) x months (columns) with column and customer roll-ups."},"DeferredRevenueMatrixRow":{"properties":{"deferral_id":{"type":"string","title":"Deferral Id"},"invoice_id":{"type":"string","title":"Invoice Id"},"invoice_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Invoice Number"},"customer_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Id"},"customer_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Name"},"deferred_amount_cents":{"type":"integer","title":"Deferred Amount Cents"},"recognized_cents":{"type":"integer","title":"Recognized Cents"},"remaining_cents":{"type":"integer","title":"Remaining Cents"},"cells":{"items":{"$ref":"#/components/schemas/DeferredRevenueMatrixCell"},"type":"array","title":"Cells"}},"type":"object","required":["deferral_id","invoice_id","deferred_amount_cents","recognized_cents","remaining_cents","cells"],"title":"DeferredRevenueMatrixRow","description":"One deferred invoice across the matrix's months."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"SuccessEnvelope_DeferredRevenueMatrixResponse_":{"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/DeferredRevenueMatrixResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[DeferredRevenueMatrixResponse]"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}},"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"API Token","description":"API token authentication. Format: `Bearer dz_...`"}}},"security":[{"BearerAuth":[]}]}