{"openapi":"3.1.0","info":{"title":"GET /api/v1/deferred-revenue/recognized","version":"1.0.0","description":"Recognized revenue"},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/deferred-revenue/recognized":{"get":{"tags":["deferred-revenue"],"summary":"Recognized revenue","description":"Recognized revenue by period, method and source, with upcoming totals for drill-down.","operationId":"get_recognized_revenue","parameters":[{"name":"start_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"description":"Only periods ending on/after this date","title":"Start Date"},"description":"Only periods ending on/after this date"},{"name":"end_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"description":"Only periods ending on/before this date","title":"End Date"},"description":"Only periods ending on/before this date"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":500,"minimum":1,"description":"Page size, in groups","default":100,"title":"Limit"},"description":"Page size, in groups"},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"description":"Offset, in groups","default":0,"title":"Offset"},"description":"Offset, in groups"},{"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_RecognizedRevenueResponse_"}}}},"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_recognized_revenue_api_v1_deferred_revenue_recognized_get"}}},"components":{"schemas":{"RecognizedRevenueMethodTotal":{"properties":{"recognized_cents":{"type":"integer","title":"Recognized Cents","default":0},"upcoming_cents":{"type":"integer","title":"Upcoming Cents","default":0}},"type":"object","title":"RecognizedRevenueMethodTotal","description":"Recognized/upcoming totals for one recognition method, across all groups."},"RecognizedRevenueResponse":{"properties":{"rows":{"items":{"$ref":"#/components/schemas/RecognizedRevenueRow"},"type":"array","title":"Rows"},"count":{"type":"integer","title":"Count","description":"Total groups matching the filters, unpaged"},"limit":{"type":"integer","title":"Limit"},"offset":{"type":"integer","title":"Offset"},"method_totals":{"additionalProperties":{"$ref":"#/components/schemas/RecognizedRevenueMethodTotal"},"type":"object","title":"Method Totals","description":"Recognized/upcoming totals per recognition method, across every matching group - not just the current page"},"total_recognized_cents":{"type":"integer","title":"Total Recognized Cents"},"total_upcoming_cents":{"type":"integer","title":"Total Upcoming Cents"}},"type":"object","required":["rows","count","limit","offset","total_recognized_cents","total_upcoming_cents"],"title":"RecognizedRevenueResponse","description":"Recognized revenue by period, method and source, paginated over groups."},"RecognizedRevenueRow":{"properties":{"period":{"type":"string","title":"Period","description":"YYYY-MM recognition period (period_end month)"},"method":{"$ref":"#/components/schemas/RevenueRecognitionMethodEnum"},"source":{"type":"string","enum":["invoice","contract"],"title":"Source","description":"invoice: an invoice-deferral tranche (source=invoice). contract: any contract-referenced tranche (ASC 606 straight-line or hours-percent burndown) - the union the O2C waterfall export does not cover, since it only sees reference_type=contract."},"label":{"type":"string","title":"Label","description":"Invoice number (with customer) for invoice-sourced rows, or the contract's number/name for contract-sourced rows - including hours-percent burndown rows, which the O2C waterfall otherwise leaves unlabeled."},"reference_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reference Id","description":"Invoice id or contract id this group's tranches reference"},"recognized_cents":{"type":"integer","title":"Recognized Cents","description":"Posted (recognized=true) total"},"upcoming_cents":{"type":"integer","title":"Upcoming Cents","description":"Scheduled but not yet recognized total"},"schedule_ids":{"items":{"type":"string"},"type":"array","title":"Schedule Ids","description":"revenue_schedules row ids behind this group, for drill-down"}},"type":"object","required":["period","method","source","label","recognized_cents","upcoming_cents"],"title":"RecognizedRevenueRow","description":"One (period, method, source, reference) group in the recognized-revenue report."},"RevenueRecognitionMethodEnum":{"type":"string","enum":["straight_line","point_in_time","hours_percent"],"title":"RevenueRecognitionMethodEnum","description":"How a tranche becomes due for recognition."},"SuccessEnvelope_RecognizedRevenueResponse_":{"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/RecognizedRevenueResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[RecognizedRevenueResponse]"},"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":[]}]}