{"openapi":"3.1.0","info":{"title":"GET /api/v1/deferred-revenue","version":"1.0.0","description":"List deferred invoices"},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/deferred-revenue":{"get":{"tags":["deferred-revenue"],"summary":"List deferred invoices","description":"Deferred invoices with their schedules and remaining balances.","operationId":"list_deferrals_api_v1_deferred_revenue_get","parameters":[{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"$ref":"#/components/schemas/DeferralStatusEnum"},{"type":"null"}],"description":"Filter by deferral status","title":"Status"},"description":"Filter by deferral status"},{"name":"customer_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by customer","title":"Customer Id"},"description":"Filter by customer"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":500,"minimum":1,"description":"Page size","default":100,"title":"Limit"},"description":"Page size"},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"description":"Offset","default":0,"title":"Offset"},"description":"Offset"},{"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_DeferredRevenueListResponse_"}}}},"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":{"DeferralMethodEnum":{"type":"string","enum":["straight_line","custom"],"title":"DeferralMethodEnum","description":"How each period's numerator is filled in."},"DeferralPeriodResponse":{"properties":{"id":{"type":"string","title":"Id"},"sequence":{"type":"integer","title":"Sequence","description":"1-based position in the schedule"},"period_start":{"type":"string","format":"date","title":"Period Start"},"period_end":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Period End","description":"Date the entry posts on. NULL while the period is parked awaiting its numerator."},"units":{"anyOf":[{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"},{"type":"null"}],"title":"Units"},"amount_cents":{"type":"integer","title":"Amount Cents"},"recognized":{"type":"boolean","title":"Recognized"},"recognized_at":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Recognized At"},"journal_entry_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Journal Entry Id"}},"type":"object","required":["id","sequence","period_start","amount_cents","recognized"],"title":"DeferralPeriodResponse","description":"One recognition period of a deferral schedule."},"DeferralStatusEnum":{"type":"string","enum":["active","completed","cancelled"],"title":"DeferralStatusEnum","description":"Lifecycle of a deferral."},"DeferralUnitEnum":{"type":"string","enum":["months","hours","custom"],"title":"DeferralUnitEnum","description":"Denominator unit the deferral burns down against."},"DeferredRevenueListResponse":{"properties":{"deferrals":{"items":{"$ref":"#/components/schemas/InvoiceDeferralResponse"},"type":"array","title":"Deferrals"},"count":{"type":"integer","title":"Count"},"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":["deferrals","count","total_deferred_cents","total_recognized_cents","total_remaining_cents"],"title":"DeferredRevenueListResponse","description":"Deferred invoices with their outstanding balances."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"InvoiceDeferralResponse":{"properties":{"id":{"type":"string","title":"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"},"currency":{"type":"string","title":"Currency"},"unit":{"$ref":"#/components/schemas/DeferralUnitEnum"},"method":{"$ref":"#/components/schemas/DeferralMethodEnum"},"total_units":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Total Units"},"recognized_units":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Recognized Units"},"period_count":{"type":"integer","title":"Period Count"},"start_date":{"type":"string","format":"date","title":"Start Date"},"revenue_ledger_name":{"type":"string","title":"Revenue Ledger Name"},"status":{"$ref":"#/components/schemas/DeferralStatusEnum"},"booking_journal_entry_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Booking Journal Entry Id"},"reversal_journal_entry_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reversal Journal Entry Id"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Notes"},"periods":{"items":{"$ref":"#/components/schemas/DeferralPeriodResponse"},"type":"array","title":"Periods","default":[]}},"type":"object","required":["id","invoice_id","deferred_amount_cents","recognized_cents","remaining_cents","currency","unit","method","total_units","recognized_units","period_count","start_date","revenue_ledger_name","status"],"title":"InvoiceDeferralResponse","description":"A deferred invoice and the state of its recognition schedule."},"SuccessEnvelope_DeferredRevenueListResponse_":{"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/DeferredRevenueListResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[DeferredRevenueListResponse]"},"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":[]}]}