{"openapi":"3.1.0","info":{"title":"POST /api/v1/bills/upcoming/{upcoming_bill_id}/link","version":"1.0.0","description":"Match an upcoming bill to a bill that arrived"},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/bills/upcoming/{upcoming_bill_id}/link":{"post":{"tags":["bills"],"summary":"Match an upcoming bill to a bill that arrived","description":"Links the forecast row to an existing bill so the obligation stops being counted twice — once as a projection and once as a payable.","operationId":"link_upcoming_bill_api_v1_bills_upcoming__upcoming_bill_id__link_post","parameters":[{"name":"upcoming_bill_id","in":"path","required":true,"schema":{"type":"string","title":"Upcoming Bill 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/UpcomingBillLinkRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_UpcomingBillResponse_"}}}},"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":{"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"SuccessEnvelope_UpcomingBillResponse_":{"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/UpcomingBillResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[UpcomingBillResponse]"},"UpcomingBillLinkRequest":{"properties":{"bill_id":{"type":"string","title":"Bill Id","description":"The real bill that satisfies this row."}},"type":"object","required":["bill_id"],"title":"UpcomingBillLinkRequest","description":"Match an expected bill to a bill that already arrived."},"UpcomingBillResponse":{"properties":{"id":{"type":"string","title":"Id"},"business_id":{"type":"string","title":"Business Id"},"vendor_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Vendor Id"},"vendor_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Vendor Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"estimated_amount":{"type":"integer","title":"Estimated Amount","description":"Estimated amount in cents."},"expected_date":{"type":"string","format":"date","title":"Expected Date"},"status":{"type":"string","title":"Status"},"series_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Series Id","description":"Shared by every occurrence generated together."},"frequency":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Frequency"},"day_of_week":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Day Of Week"},"day_of_month":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Day Of Month"},"bill_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Bill Id","description":"The real bill this became, once converted or matched."},"notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Notes"},"is_estimate":{"type":"boolean","title":"Is Estimate","description":"Always true. Upcoming bills are forecast rows: they carry no journal entries and are excluded from AP totals, aged payables and the balance sheet.","default":true},"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","estimated_amount","expected_date","status","created_at","updated_at"],"title":"UpcomingBillResponse","description":"A projected bill occurrence."},"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":[]}]}