{"openapi":"3.1.0","info":{"title":"POST /api/v1/contracts/{contract_id}/invoices","version":"1.0.0","description":"Manually draft an additional invoice"},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/contracts/{contract_id}/invoices":{"post":{"tags":["contracts"],"summary":"Manually draft an additional invoice","description":"Draft an additional (e.g. future-dated) invoice on the contract, outside the execution/period automation. Lines default to the contract's recurring (each-period) order lines when omitted. The draft is reviewed and sent like any other contract invoice.","operationId":"draft_manual_contract_invoice_api_v1_contracts__contract_id__invoices_post","parameters":[{"name":"contract_id","in":"path","required":true,"schema":{"type":"string","title":"Contract 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":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/ContractManualInvoiceRequest"},{"type":"null"}],"title":"Request"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_ContractInvoiceResult_"}}}},"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":{"ContractInvoiceResult":{"properties":{"contract_id":{"type":"string","title":"Contract Id"},"drafted_invoice_ids":{"items":{"type":"string"},"type":"array","title":"Drafted Invoice Ids"},"drafted_count":{"type":"integer","title":"Drafted Count","default":0},"total_drafted_cents":{"type":"integer","title":"Total Drafted Cents","default":0}},"type":"object","required":["contract_id"],"title":"ContractInvoiceResult","description":"Result of drafting invoices from a contract's billing rules."},"ContractManualInvoiceLine":{"properties":{"description":{"type":"string","minLength":1,"title":"Description","description":"Line description."},"amount_cents":{"type":"integer","exclusiveMinimum":0.0,"title":"Amount Cents","description":"Line total in cents."},"quantity":{"type":"number","exclusiveMinimum":0.0,"title":"Quantity","description":"Units billed (display only).","default":1}},"type":"object","required":["description","amount_cents"],"title":"ContractManualInvoiceLine","description":"One line on a manually drafted contract invoice."},"ContractManualInvoiceRequest":{"properties":{"due_date":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Due Date","description":"Invoice due date (YYYY-MM-DD); defaults to 30 days out."},"line_items":{"anyOf":[{"items":{"$ref":"#/components/schemas/ContractManualInvoiceLine"},"type":"array"},{"type":"null"}],"title":"Line Items","description":"Lines to bill. Defaults to the contract's recurring (each-period) order lines when omitted."}},"type":"object","title":"ContractManualInvoiceRequest","description":"Request body for manually drafting an additional contract invoice.\n\nThe escape hatch beside the two automatic paths (execution invoice /\nperiod invoices) — e.g. a future-dated invoice agreed with the customer."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"SuccessEnvelope_ContractInvoiceResult_":{"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/ContractInvoiceResult"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[ContractInvoiceResult]"},"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":[]}]}