{"openapi":"3.1.0","info":{"title":"InkOps Platform API","version":"1.0.0","description":"Shop-scoped REST API. Authenticate with `Authorization: Bearer ik_…` (create keys in Settings → API). Money is decimal strings; timestamps are ISO 8601 UTC. Writes accept an Idempotency-Key header."},"servers":[{"url":"/api/v1"}],"security":[{"bearerAuth":[]}],"paths":{"/me":{"get":{"summary":"Introspect the key: shop, scopes, subscription state.","x-required-scope":"read","responses":{"200":{"description":"Success. Data envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataEnvelope"}}}},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/customers":{"get":{"summary":"List customers.","x-required-scope":"read","parameters":[{"name":"search","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":200}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":25}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string","description":"Opaque cursor from the previous page's nextCursor."}}],"responses":{"200":{"description":"Success. Paginated list envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListEnvelope"}}}},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"summary":"Create a customer with optional contacts (duplicate-checked).","x-required-scope":"write","parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string","minLength":1,"maxLength":200},"description":"Optional. Retries with the same key replay the original result."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"companyName":{"type":"string","minLength":1,"maxLength":255},"email":{"anyOf":[{"type":"string","maxLength":255,"format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string","maxLength":50},{"type":"null"}]},"website":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}]},"billingAddressLine1":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}]},"billingAddressLine2":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}]},"billingCity":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}]},"billingState":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}]},"billingZip":{"anyOf":[{"type":"string","maxLength":20},{"type":"null"}]},"shippingAddressLine1":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}]},"shippingAddressLine2":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}]},"shippingCity":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}]},"shippingState":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}]},"shippingZip":{"anyOf":[{"type":"string","maxLength":20},{"type":"null"}]},"taxExempt":{"type":"boolean"},"paymentTerms":{"type":"string","enum":["due_on_receipt","net_15","net_30","net_60"]},"tags":{"maxItems":20,"type":"array","items":{"type":"string","maxLength":50}},"notes":{"anyOf":[{"type":"string","maxLength":5000},{"type":"null"}]},"contacts":{"maxItems":10,"type":"array","items":{"type":"object","properties":{"firstName":{"type":"string","minLength":1,"maxLength":100},"lastName":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}]},"email":{"anyOf":[{"type":"string","maxLength":255,"format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string","maxLength":50},{"type":"null"}]},"role":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}]},"isPrimary":{"type":"boolean"}},"required":["firstName"],"additionalProperties":false}}},"required":["companyName"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success. Data envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataEnvelope"}}}},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/customers/{id}":{"get":{"summary":"Customer detail with contacts.","x-required-scope":"read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success. Data envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataEnvelope"}}}},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"summary":"Update customer fields (null clears; absent leaves untouched).","x-required-scope":"write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"companyName":{"type":"string","minLength":1,"maxLength":255},"email":{"anyOf":[{"type":"string","maxLength":255,"format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string","maxLength":50},{"type":"null"}]},"website":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}]},"billingAddressLine1":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}]},"billingAddressLine2":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}]},"billingCity":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}]},"billingState":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}]},"billingZip":{"anyOf":[{"type":"string","maxLength":20},{"type":"null"}]},"shippingAddressLine1":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}]},"shippingAddressLine2":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}]},"shippingCity":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}]},"shippingState":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}]},"shippingZip":{"anyOf":[{"type":"string","maxLength":20},{"type":"null"}]},"taxExempt":{"type":"boolean"},"paymentTerms":{"type":"string","enum":["due_on_receipt","net_15","net_30","net_60"]},"tags":{"maxItems":20,"type":"array","items":{"type":"string","maxLength":50}},"notes":{"anyOf":[{"type":"string","maxLength":5000},{"type":"null"}]}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success. Data envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataEnvelope"}}}},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/orders":{"get":{"summary":"List orders (or quotes via ?type=quote).","x-required-scope":"read","parameters":[{"name":"type","in":"query","required":false,"schema":{"default":"order","type":"string","enum":["order","quote"]}},{"name":"statusId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"}},{"name":"customerId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"}},{"name":"search","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":200}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":25}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string","description":"Opaque cursor from the previous page's nextCursor."}}],"responses":{"200":{"description":"Success. Paginated list envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListEnvelope"}}}},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"summary":"Create an order or quote with flat line items.","x-required-scope":"write","parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string","minLength":1,"maxLength":200},"description":"Optional. Retries with the same key replay the original result."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"customerId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"contactId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},{"type":"null"}]},"type":{"type":"string","enum":["order","quote"]},"statusId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},{"type":"null"}]},"customerPo":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}]},"orderDate":{"anyOf":[{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},{"type":"null"}]},"dueDate":{"anyOf":[{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},{"type":"null"}]},"shipDate":{"anyOf":[{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},{"type":"null"}]},"decorationMethod":{"anyOf":[{"type":"string","enum":["screen_print","embroidery","dtg","dtf","heat_transfer","vinyl","mixed"]},{"type":"null"}]},"deliveryMethod":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}]},"shippingAddress":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}]},"shippingMethod":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}]},"shippingAmount":{"type":"string","pattern":"^\\d{1,8}(\\.\\d{1,2})?$"},"subtotal":{"type":"string","pattern":"^\\d{1,8}(\\.\\d{1,2})?$"},"taxRate":{"type":"string","pattern":"^\\d(\\.\\d{1,4})?$"},"taxAmount":{"type":"string","pattern":"^\\d{1,8}(\\.\\d{1,2})?$"},"total":{"type":"string","pattern":"^\\d{1,8}(\\.\\d{1,2})?$"},"notes":{"anyOf":[{"type":"string","maxLength":10000},{"type":"null"}]},"customerNotes":{"anyOf":[{"type":"string","maxLength":10000},{"type":"null"}]},"rush":{"type":"boolean"},"rushFee":{"anyOf":[{"type":"string","pattern":"^\\d{1,8}(\\.\\d{1,2})?$"},{"type":"null"}]},"lineItems":{"maxItems":200,"type":"array","items":{"type":"object","properties":{"description":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}]},"garmentStyle":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}]},"garmentColor":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}]},"garmentBrand":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}]},"totalQuantity":{"type":"integer","minimum":0,"maximum":100000},"unitPrice":{"type":"string","pattern":"^\\d{1,8}(\\.\\d{1,2})?$"},"totalPrice":{"type":"string","pattern":"^\\d{1,8}(\\.\\d{1,2})?$"},"notes":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}]},"catalogProductId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},{"type":"null"}]},"sizes":{"maxItems":30,"type":"array","items":{"type":"object","properties":{"size":{"type":"string","minLength":1,"maxLength":10},"quantity":{"type":"integer","minimum":0,"maximum":100000},"upcharge":{"type":"string","pattern":"^\\d{1,8}(\\.\\d{1,2})?$"}},"required":["size","quantity"],"additionalProperties":false}},"decorations":{"maxItems":10,"type":"array","items":{"type":"object","properties":{"location":{"anyOf":[{"type":"string","enum":["front","back","left_sleeve","right_sleeve","left_chest","right_chest","nape","full_front","full_back","pocket_print","other"]},{"type":"null"}]},"locationCustom":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}]},"method":{"anyOf":[{"type":"string","enum":["screen_print","embroidery","dtg","dtf","heat_transfer","vinyl"]},{"type":"null"}]},"colorCount":{"anyOf":[{"type":"integer","minimum":0,"maximum":20},{"type":"null"}]},"colors":{"anyOf":[{"maxItems":20,"type":"array","items":{"type":"string","maxLength":50}},{"type":"null"}]},"stitchCount":{"anyOf":[{"type":"integer","minimum":0,"maximum":1000000},{"type":"null"}]},"setupFee":{"type":"string","pattern":"^\\d{1,8}(\\.\\d{1,2})?$"},"runPrice":{"type":"string","pattern":"^\\d{1,8}(\\.\\d{1,2})?$"},"notes":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}]}},"additionalProperties":false}}},"additionalProperties":false}}},"required":["customerId"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success. Data envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataEnvelope"}}}},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/orders/{id}":{"get":{"summary":"Order detail with line items, sizes, decorations, and fees.","x-required-scope":"read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success. Data envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataEnvelope"}}}},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"summary":"Update order header fields; status changes fire automations.","x-required-scope":"write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"name":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}]},"statusId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"orderDate":{"anyOf":[{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},{"type":"null"}]},"dueDate":{"anyOf":[{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},{"type":"null"}]},"shipDate":{"anyOf":[{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},{"type":"null"}]},"completedDate":{"anyOf":[{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},{"type":"null"}]},"customerPo":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}]},"deliveryMethod":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}]},"shippingAddress":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}]},"shippingMethod":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}]},"trackingNumber":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}]},"notes":{"anyOf":[{"type":"string","maxLength":10000},{"type":"null"}]},"customerNotes":{"anyOf":[{"type":"string","maxLength":10000},{"type":"null"}]},"rush":{"type":"boolean"},"proofRequired":{"type":"boolean"}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success. Data envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataEnvelope"}}}},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/statuses":{"get":{"summary":"List workflow statuses.","x-required-scope":"read","parameters":[{"name":"type","in":"query","required":false,"schema":{"type":"string","enum":["order","quote"]}}],"responses":{"200":{"description":"Success. Data envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataEnvelope"}}}},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/proposals":{"get":{"summary":"List proposals.","x-required-scope":"read","parameters":[{"name":"status","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":40}},{"name":"customerId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":25}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string","description":"Opaque cursor from the previous page's nextCursor."}}],"responses":{"200":{"description":"Success. Paginated list envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListEnvelope"}}}},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/proposals/{id}":{"get":{"summary":"Proposal detail with quote options.","x-required-scope":"read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success. Data envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataEnvelope"}}}},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/invoices":{"get":{"summary":"List invoices.","x-required-scope":"read","parameters":[{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["draft","sent","viewed","paid","overdue","void"]}},{"name":"customerId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":25}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string","description":"Opaque cursor from the previous page's nextCursor."}}],"responses":{"200":{"description":"Success. Paginated list envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListEnvelope"}}}},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"summary":"Create a draft invoice from same-customer orders.","x-required-scope":"write","parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string","minLength":1,"maxLength":200},"description":"Optional. Retries with the same key replay the original result."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"orderIds":{"minItems":1,"maxItems":50,"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"}},"dueDate":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"notes":{"anyOf":[{"type":"string","maxLength":5000},{"type":"null"}]}},"required":["orderIds"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success. Data envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataEnvelope"}}}},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/invoices/{id}":{"get":{"summary":"Invoice detail with snapshot line items, fees, and payments.","x-required-scope":"read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success. Data envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataEnvelope"}}}},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/invoices/{id}/payments":{"get":{"summary":"List payments recorded on an invoice.","x-required-scope":"read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success. Data envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataEnvelope"}}}},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"summary":"Record a manual payment. Requires an Idempotency-Key header; replays return the original payment.","x-required-scope":"write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","minLength":1,"maxLength":200},"description":"Required. Retries with the same key replay the original result."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"amount":{"type":"string","pattern":"^\\d{1,8}(\\.\\d{1,2})?$"},"method":{"type":"string","enum":["cash","check","card","stripe","other"]},"referenceNumber":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}]},"notes":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}]}},"required":["amount","method"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success. Data envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataEnvelope"}}}},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/production-jobs":{"get":{"summary":"List production jobs (?start/?end bound scheduledDate).","x-required-scope":"read","parameters":[{"name":"start","in":"query","required":false,"schema":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"}},{"name":"end","in":"query","required":false,"schema":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"}},{"name":"orderId","in":"query","required":false,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":25}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string","description":"Opaque cursor from the previous page's nextCursor."}}],"responses":{"200":{"description":"Success. Paginated list envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListEnvelope"}}}},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/catalog/products":{"get":{"summary":"Search the shared supplier catalog.","x-required-scope":"read","parameters":[{"name":"search","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":200}},{"name":"brand","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":200}},{"name":"supplier","in":"query","required":false,"schema":{"type":"string","enum":["ss_activewear","sanmar","as_colour","custom"]}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":25}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string","description":"Opaque cursor from the previous page's nextCursor."}}],"responses":{"200":{"description":"Success. Paginated list envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListEnvelope"}}}},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/catalog/products/{id}":{"get":{"summary":"Catalog product detail with color/size variants.","x-required-scope":"read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success. Data envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataEnvelope"}}}},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/pricing/quote":{"post":{"summary":"Price a hypothetical job through the shop's pricing matrices.","x-required-scope":"read","requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"method":{"type":"string","enum":["screen_print","embroidery","dtg","dtf","heat_transfer","vinyl"]},"quantity":{"type":"integer","minimum":1,"maximum":100000},"colorCount":{"type":"integer","minimum":0,"maximum":20},"stitchCount":{"type":"integer","minimum":0,"maximum":1000000},"sizes":{"maxItems":30,"type":"array","items":{"type":"object","properties":{"size":{"type":"string","minLength":1,"maxLength":10},"quantity":{"type":"integer","minimum":0,"maximum":100000}},"required":["size","quantity"],"additionalProperties":false}},"customerId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"}},"required":["method","quantity"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success. Data envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataEnvelope"}}}},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/orders/{id}/line-items":{"post":{"summary":"Append a line item; totals and invoice snapshots resync.","x-required-scope":"write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string","minLength":1,"maxLength":200},"description":"Optional. Retries with the same key replay the original result."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"description":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}]},"garmentStyle":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}]},"garmentColor":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}]},"garmentBrand":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}]},"totalQuantity":{"type":"integer","minimum":0,"maximum":100000},"unitPrice":{"type":"string","pattern":"^\\d{1,8}(\\.\\d{1,2})?$"},"totalPrice":{"type":"string","pattern":"^\\d{1,8}(\\.\\d{1,2})?$"},"notes":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}]},"catalogProductId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},{"type":"null"}]},"sizes":{"maxItems":30,"type":"array","items":{"type":"object","properties":{"size":{"type":"string","minLength":1,"maxLength":10},"quantity":{"type":"integer","minimum":0,"maximum":100000},"upcharge":{"type":"string","pattern":"^\\d{1,8}(\\.\\d{1,2})?$"}},"required":["size","quantity"],"additionalProperties":false}},"decorations":{"maxItems":10,"type":"array","items":{"type":"object","properties":{"location":{"anyOf":[{"type":"string","enum":["front","back","left_sleeve","right_sleeve","left_chest","right_chest","nape","full_front","full_back","pocket_print","other"]},{"type":"null"}]},"locationCustom":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}]},"method":{"anyOf":[{"type":"string","enum":["screen_print","embroidery","dtg","dtf","heat_transfer","vinyl"]},{"type":"null"}]},"colorCount":{"anyOf":[{"type":"integer","minimum":0,"maximum":20},{"type":"null"}]},"colors":{"anyOf":[{"maxItems":20,"type":"array","items":{"type":"string","maxLength":50}},{"type":"null"}]},"stitchCount":{"anyOf":[{"type":"integer","minimum":0,"maximum":1000000},{"type":"null"}]},"setupFee":{"type":"string","pattern":"^\\d{1,8}(\\.\\d{1,2})?$"},"runPrice":{"type":"string","pattern":"^\\d{1,8}(\\.\\d{1,2})?$"},"notes":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}]}},"additionalProperties":false}}},"additionalProperties":false}}}},"responses":{"201":{"description":"Success. Data envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataEnvelope"}}}},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/orders/{id}/line-items/{lineItemId}":{"patch":{"summary":"Update a line item; sizes/decorations replace when provided.","x-required-scope":"write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"lineItemId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"description":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}]},"garmentStyle":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}]},"garmentColor":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}]},"garmentBrand":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}]},"totalQuantity":{"type":"integer","minimum":0,"maximum":100000},"unitPrice":{"type":"string","pattern":"^\\d{1,8}(\\.\\d{1,2})?$"},"totalPrice":{"type":"string","pattern":"^\\d{1,8}(\\.\\d{1,2})?$"},"notes":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}]},"catalogProductId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},{"type":"null"}]},"sizes":{"maxItems":30,"type":"array","items":{"type":"object","properties":{"size":{"type":"string","minLength":1,"maxLength":10},"quantity":{"type":"integer","minimum":0,"maximum":100000},"upcharge":{"type":"string","pattern":"^\\d{1,8}(\\.\\d{1,2})?$"}},"required":["size","quantity"],"additionalProperties":false}},"decorations":{"maxItems":10,"type":"array","items":{"type":"object","properties":{"location":{"anyOf":[{"type":"string","enum":["front","back","left_sleeve","right_sleeve","left_chest","right_chest","nape","full_front","full_back","pocket_print","other"]},{"type":"null"}]},"locationCustom":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}]},"method":{"anyOf":[{"type":"string","enum":["screen_print","embroidery","dtg","dtf","heat_transfer","vinyl"]},{"type":"null"}]},"colorCount":{"anyOf":[{"type":"integer","minimum":0,"maximum":20},{"type":"null"}]},"colors":{"anyOf":[{"maxItems":20,"type":"array","items":{"type":"string","maxLength":50}},{"type":"null"}]},"stitchCount":{"anyOf":[{"type":"integer","minimum":0,"maximum":1000000},{"type":"null"}]},"setupFee":{"type":"string","pattern":"^\\d{1,8}(\\.\\d{1,2})?$"},"runPrice":{"type":"string","pattern":"^\\d{1,8}(\\.\\d{1,2})?$"},"notes":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}]}},"additionalProperties":false}}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success. Data envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataEnvelope"}}}},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"summary":"Delete a line item; totals and invoice snapshots resync.","x-required-scope":"write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"lineItemId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success. Data envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataEnvelope"}}}},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/proposals/{id}/transition":{"post":{"summary":"Move a proposal to sent/draft/closed.","x-required-scope":"write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"to":{"type":"string","enum":["sent","draft","closed"]}},"required":["to"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success. Data envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataEnvelope"}}}},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/production-jobs/{id}":{"patch":{"summary":"Reschedule, assign, or advance a production job.","x-required-scope":"write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"status":{"type":"string","enum":["not_started","in_progress","complete","on_hold"]},"stationId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},{"type":"null"}]},"operatorId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},{"type":"null"}]},"scheduledDate":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"startTime":{"anyOf":[{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d(:[0-5]\\d)?$"},{"type":"null"}]},"endTime":{"anyOf":[{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d(:[0-5]\\d)?$"},{"type":"null"}]},"estimatedMinutes":{"anyOf":[{"type":"integer","minimum":0,"maximum":100000},{"type":"null"}]},"actualMinutes":{"anyOf":[{"type":"integer","minimum":0,"maximum":100000},{"type":"null"}]},"priority":{"type":"integer","minimum":0,"maximum":1000},"notes":{"anyOf":[{"type":"string","maxLength":5000},{"type":"null"}]}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success. Data envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataEnvelope"}}}},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/webhooks":{"get":{"summary":"List webhook endpoints (secret included for write-scoped keys).","x-required-scope":"read","responses":{"200":{"description":"Success. Data envelope.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"url":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"secret":{"type":"string"},"events":{"type":"array","items":{"type":"string"}},"status":{"type":"string","enum":["active","disabled"]},"disabledReason":{"anyOf":[{"type":"string"},{"type":"null"}]},"consecutiveFailures":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"createdAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"updatedAt":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","url","description","events","status","disabledReason","consecutiveFailures","createdAt","updatedAt"],"additionalProperties":false}}},"required":["data"]}}}},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"summary":"Subscribe a webhook endpoint (https only; per-shop cap 10).","x-required-scope":"write","parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string","minLength":1,"maxLength":200},"description":"Optional. Retries with the same key replay the original result."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"url":{"type":"string","maxLength":2000,"format":"uri"},"description":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}]},"events":{"minItems":1,"maxItems":20,"type":"array","items":{"type":"string","enum":["order.created","order.status_changed","payment.received","proof.sent","proof.approved","proof.changes_requested","proposal.sent","proposal.approved","invoice.sent","customer.created","message.received","*"]}}},"required":["url","events"],"additionalProperties":false}}}},"responses":{"201":{"description":"Success. Data envelope.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"url":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"secret":{"type":"string"},"events":{"type":"array","items":{"type":"string"}},"status":{"type":"string","enum":["active","disabled"]},"disabledReason":{"anyOf":[{"type":"string"},{"type":"null"}]},"consecutiveFailures":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"createdAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"updatedAt":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","url","description","events","status","disabledReason","consecutiveFailures","createdAt","updatedAt"],"additionalProperties":false}},"required":["data"]}}}},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/webhooks/{id}":{"get":{"summary":"Webhook endpoint detail.","x-required-scope":"read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success. Data envelope.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"url":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"secret":{"type":"string"},"events":{"type":"array","items":{"type":"string"}},"status":{"type":"string","enum":["active","disabled"]},"disabledReason":{"anyOf":[{"type":"string"},{"type":"null"}]},"consecutiveFailures":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"createdAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"updatedAt":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","url","description","events","status","disabledReason","consecutiveFailures","createdAt","updatedAt"],"additionalProperties":false}},"required":["data"]}}}},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"summary":"Update url/description/events/status. Re-enabling cancels the stale queue and restarts from now.","x-required-scope":"write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"url":{"type":"string","maxLength":2000,"format":"uri"},"description":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}]},"events":{"minItems":1,"maxItems":20,"type":"array","items":{"type":"string","enum":["order.created","order.status_changed","payment.received","proof.sent","proof.approved","proof.changes_requested","proposal.sent","proposal.approved","invoice.sent","customer.created","message.received","*"]}},"status":{"type":"string","enum":["active","disabled"]}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success. Data envelope.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"url":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"secret":{"type":"string"},"events":{"type":"array","items":{"type":"string"}},"status":{"type":"string","enum":["active","disabled"]},"disabledReason":{"anyOf":[{"type":"string"},{"type":"null"}]},"consecutiveFailures":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"createdAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"updatedAt":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","url","description","events","status","disabledReason","consecutiveFailures","createdAt","updatedAt"],"additionalProperties":false}},"required":["data"]}}}},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"summary":"Delete the endpoint and its delivery log.","x-required-scope":"write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success. Data envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataEnvelope"}}}},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/webhooks/{id}/deliveries":{"get":{"summary":"Latest 50 deliveries (?status=). Retrying = pending with attempts > 0.","x-required-scope":"read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["pending","delivering","succeeded","exhausted"]}}],"responses":{"200":{"description":"Success. Data envelope.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"eventId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},{"type":"null"}]},"eventType":{"type":"string"},"status":{"type":"string","enum":["pending","delivering","succeeded","exhausted"]},"attempts":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"nextAttemptAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"lastStatusCode":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"lastError":{"anyOf":[{"type":"string"},{"type":"null"}]},"deliveredAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","eventId","eventType","status","attempts","nextAttemptAt","lastStatusCode","lastError","deliveredAt","createdAt"],"additionalProperties":false}}},"required":["data"]}}}},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/webhooks/{id}/test":{"post":{"summary":"Send a webhook.test delivery through the real pipeline (202).","x-required-scope":"write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"202":{"description":"Success. Data envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataEnvelope"}}}},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/events":{"get":{"summary":"The raw event fact log, ascending, behind a 2-minute safe watermark. ?types= csv, ?occurred_after= backfill.","x-required-scope":"read","parameters":[{"name":"types","in":"query","required":false,"schema":{"type":"string"}},{"name":"occurred_after","in":"query","required":false,"schema":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":25}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string","description":"Opaque cursor from the previous page's nextCursor."}}],"responses":{"200":{"description":"Success. Paginated list envelope.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"type":{"type":"string"},"source":{"anyOf":[{"type":"string"},{"type":"null"}]},"orderId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},{"type":"null"}]},"proposalId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},{"type":"null"}]},"invoiceId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},{"type":"null"}]},"customerId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},{"type":"null"}]},"payload":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"occurredAt":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","type","source","orderId","proposalId","invoiceId","customerId","payload","occurredAt"],"additionalProperties":false}},"pagination":{"$ref":"#/components/schemas/Pagination"}},"required":["data","pagination"]}}}},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/communications/{id}":{"get":{"summary":"Full customer message behind a message.received webhook.","x-required-scope":"read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success. Data envelope.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"customerId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},{"type":"null"}]},"proposalId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},{"type":"null"}]},"type":{"anyOf":[{"type":"string"},{"type":"null"}]},"direction":{"anyOf":[{"type":"string"},{"type":"null"}]},"fromAddress":{"anyOf":[{"type":"string"},{"type":"null"}]},"toAddress":{"anyOf":[{"type":"string"},{"type":"null"}]},"subject":{"anyOf":[{"type":"string"},{"type":"null"}]},"body":{"anyOf":[{"type":"string"},{"type":"null"}]},"bodyHtml":{"anyOf":[{"type":"string"},{"type":"null"}]},"attachments":{"anyOf":[{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},{"type":"null"}]},"createdAt":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","customerId","proposalId","type","direction","fromAddress","toAddress","subject","body","bodyHtml","attachments","createdAt"],"additionalProperties":false}},"required":["data"]}}}},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/openapi.json":{"get":{"summary":"This document.","security":[],"responses":{"200":{"description":"Success. Data envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataEnvelope"}}}},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"}},"schemas":{"Pagination":{"type":"object","properties":{"hasMore":{"type":"boolean"},"nextCursor":{"type":["string","null"]}},"required":["hasMore","nextCursor"]},"DataEnvelope":{"type":"object","properties":{"data":{}},"required":["data"]},"ListEnvelope":{"type":"object","properties":{"data":{"type":"array","items":{}},"pagination":{"type":"object","properties":{"hasMore":{"type":"boolean"},"nextCursor":{"type":["string","null"]}},"required":["hasMore","nextCursor"]}},"required":["data","pagination"]},"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{},"requestId":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}}