{"openapi":"3.1.0","info":{"title":"POST /api/v1/orders/{order_id}/esign/send","version":"1.0.0","description":"Send an order for e-signature"},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/orders/{order_id}/esign/send":{"post":{"tags":["orders-esign"],"summary":"Send an order for e-signature","description":"Create an e-signature envelope for a draft or sent order and email it to the customer contact for signing. The request supplies the document (an https URL or an uploaded `s3_key`) since order PDFs are rendered client-side. A draft order is moved to `sent`. Returns 400 when e-signature is not configured, the order is in the wrong status, the customer has no email, or an envelope is already out.","operationId":"send_order_for_esign_api_v1_orders__order_id__esign_send_post","parameters":[{"name":"order_id","in":"path","required":true,"schema":{"type":"string","title":"Order 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/ESignSendRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_ESignStatusResponse_"}}}},"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":{"ESignSendRequest":{"properties":{"document_url":{"type":"string","maxLength":2048,"minLength":1,"title":"Document Url","description":"Document to send for signature: an https URL or an uploaded s3_key (from POST /upload). Required because orders have no backend PDF generator — the caller supplies the rendered order form."},"subject":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Subject","description":"Email subject for the signature request (defaults to one derived from the order number)."}},"type":"object","required":["document_url"],"title":"ESignSendRequest","description":"Request body for sending an order out for e-signature."},"ESignStatusResponse":{"properties":{"order_id":{"type":"string","title":"Order Id"},"order_status":{"type":"string","title":"Order Status","description":"The order's own lifecycle status."},"provider":{"type":"string","title":"Provider","description":"E-signature provider, e.g. 'docusign'."},"envelope_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Envelope Id"},"esign_status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Esign Status","description":"sent, delivered, completed, declined, or voided."},"esign_sent_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Esign Sent At"},"refreshed":{"type":"boolean","title":"Refreshed","description":"True when this response reflects a live provider lookup rather than the stored status.","default":false}},"type":"object","required":["order_id","order_status","provider"],"title":"ESignStatusResponse","description":"Envelope-tracking state for an order."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"SuccessEnvelope_ESignStatusResponse_":{"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/ESignStatusResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[ESignStatusResponse]"},"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":[]}]}