{"openapi":"3.1.0","info":{"title":"POST /api/v1/o2c/deals/{deal_id}/mark-lost","version":"1.0.0","description":"Mark a deal lost"},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/o2c/deals/{deal_id}/mark-lost":{"post":{"tags":["deals"],"summary":"Mark a deal lost","description":"Close an open deal as lost with a required reason.","operationId":"mark_deal_lost_api_v1_o2c_deals__deal_id__mark_lost_post","parameters":[{"name":"deal_id","in":"path","required":true,"schema":{"type":"string","title":"Deal Id"}},{"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"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DealMarkLostRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_DealResponse_"}}}},"400":{"description":"Bad Request - Invalid input","content":{"application/json":{"example":{"detail":"Invalid request parameters"}}}},"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"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"detail":"Resource not found"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"DealMarkLostRequest":{"properties":{"reason":{"type":"string","title":"Reason","description":"One of ['competitor', 'no_budget', 'no_decision', 'other', 'poor_fit', 'price', 'timing']."},"note":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Note","description":"Optional context on why it was lost."}},"type":"object","required":["reason"],"title":"DealMarkLostRequest","description":"Request schema for closing a deal as lost."},"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."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"SuccessEnvelope_DealResponse_":{"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/DealResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[DealResponse]"},"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":[]}]}