{"openapi":"3.1.0","info":{"title":"GET /api/v1/o2c/deals/pipeline","version":"1.0.0","description":"Pipeline view: forecast metrics + deals"},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/o2c/deals/pipeline":{"get":{"tags":["deals"],"summary":"Pipeline view: forecast metrics + deals","description":"Stage-weighted pipeline forecast metrics (computed over all open deals) plus a filtered, paginated deals page with `effective_stage` computed server-side (deal.stage, or the linked order's live status once converted).","operationId":"get_pipeline_api_v1_o2c_deals_pipeline_get","parameters":[{"name":"stage","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter the deals page by stage.","title":"Stage"},"description":"Filter the deals page by stage."},{"name":"is_expansion","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"description":"Filter the deals page by new-customer vs. expansion.","title":"Is Expansion"},"description":"Filter the deals page by new-customer vs. expansion."},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Pagination cursor","title":"Cursor"},"description":"Pagination cursor"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"description":"Page size","default":50,"title":"Limit"},"description":"Page size"},{"name":"sort_by","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Column to sort by.","title":"Sort By"},"description":"Column to sort by."},{"name":"descending","in":"query","required":false,"schema":{"type":"boolean","description":"Sort direction.","default":true,"title":"Descending"},"description":"Sort direction."},{"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_PipelineResponse_"}}}},"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":{"DealResponse":{"properties":{"id":{"type":"string","title":"Id"},"business_id":{"type":"string","title":"Business Id"},"number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Number"},"name":{"type":"string","title":"Name"},"stage":{"type":"string","title":"Stage"},"effective_stage":{"type":"string","title":"Effective Stage","description":"The stage the deal should be treated as: deal.stage, or the linked order's status once order_id is set."},"prospect_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Prospect Name"},"customer_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Id"},"customer_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Name"},"project_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Project Id"},"project_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Project Name"},"contact_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Contact Name"},"contact_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Contact Email"},"source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source"},"is_expansion":{"type":"boolean","title":"Is Expansion","default":false},"expected_value_cents":{"type":"integer","title":"Expected Value Cents","default":0},"expected_hours":{"anyOf":[{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"},{"type":"null"}],"title":"Expected Hours"},"expected_term_months":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Expected Term Months"},"expected_start_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Expected Start Date"},"expected_close_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Expected Close Date"},"order_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Order Id"},"lost_reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Lost Reason"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Notes"},"stage_changed_at":{"type":"string","format":"date-time","title":"Stage Changed At"},"days_in_stage":{"type":"integer","title":"Days In Stage","default":0},"is_stalled":{"type":"boolean","title":"Is Stalled","default":false},"is_open":{"type":"boolean","title":"Is Open","default":false},"is_closed":{"type":"boolean","title":"Is Closed","default":false},"is_won":{"type":"boolean","title":"Is Won","default":false},"is_lost":{"type":"boolean","title":"Is Lost","default":false},"is_converted":{"type":"boolean","title":"Is Converted","default":false},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["id","business_id","name","stage","effective_stage","stage_changed_at","created_at","updated_at"],"title":"DealResponse","description":"Response schema for a deal."},"DealsListResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/DealResponse"},"type":"array","title":"Items","description":"List of items"},"total":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Total","description":"Total number of items (null when not calculated for performance)"},"limit":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Limit","description":"Pagination limit"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor","description":"Cursor for next page"},"prev_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Prev Cursor","description":"Cursor for previous page"},"has_next":{"type":"boolean","title":"Has Next","description":"Whether there are more items"},"has_prev":{"type":"boolean","title":"Has Prev","description":"Whether there are previous items"}},"type":"object","required":["items","has_next","has_prev"],"title":"DealsListResponse","description":"Paginated list of deals."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"PipelineMetrics":{"properties":{"weighted_pipeline_cents":{"type":"integer","title":"Weighted Pipeline Cents","default":0},"total_pipeline_cents":{"type":"integer","title":"Total Pipeline Cents","default":0},"open_deal_count":{"type":"integer","title":"Open Deal Count","default":0},"closing_this_quarter_cents":{"type":"integer","title":"Closing This Quarter Cents","default":0},"new_customer_cents":{"type":"integer","title":"New Customer Cents","default":0},"expansion_cents":{"type":"integer","title":"Expansion Cents","default":0}},"type":"object","title":"PipelineMetrics","description":"Stage-weighted pipeline forecast, computed over open (non-closed,\nnon-converted) deals only. See ``DealService.get_pipeline_metrics``."},"PipelineResponse":{"properties":{"metrics":{"$ref":"#/components/schemas/PipelineMetrics"},"deals":{"$ref":"#/components/schemas/DealsListResponse"}},"type":"object","required":["metrics","deals"],"title":"PipelineResponse","description":"Response for ``GET /o2c/deals/pipeline``: metrics + the deals page,\neach deal's ``effective_stage`` computed server-side."},"SuccessEnvelope_PipelineResponse_":{"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/PipelineResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[PipelineResponse]"},"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":[]}]}