{"openapi":"3.1.0","info":{"title":"Ottr Commerce Execution API","version":"2.0.0","description":"Ottr executes customer-authorised purchases for AI agents. Send a structured purchase request; Ottr verifies the product and prices the checkout, returns a hosted approval for the customer, completes checkout through the merchant's API or Ottr's browser execution engine once the customer approves, and returns a verified order. Agents never see card details and can never approve a purchase themselves. The same operations are available as MCP tools (/api/mcp) and A2A skills (/api/a2a). The older /v1/agent endpoints remain supported."},"servers":[{"url":"https://ottr.si"}],"components":{"securitySchemes":{"agentKey":{"type":"http","scheme":"bearer","description":"Your agent key, ottr_ak_..."},"customerRef":{"type":"apiKey","in":"header","name":"OTTR-Customer-Ref","description":"The reference the customer issued to your agent from their OTTR Security page, ottr_cr_..."},"linkedAccount":{"type":"oauth2","description":"Customer account linking (OAuth 2.1, PKCE S256 required, dynamic client registration at /oauth/register). The access token identifies both your agent and the customer; no OTTR-Customer-Ref is needed.","flows":{"authorizationCode":{"authorizationUrl":"https://ottr.si/oauth/authorize","tokenUrl":"https://ottr.si/oauth/token","refreshUrl":"https://ottr.si/oauth/token","scopes":{"commerce.read":"commerce.read","commerce.checkout.prepare":"commerce.checkout.prepare","commerce.purchase.request":"commerce.purchase.request","commerce.orders.read":"commerce.orders.read","commerce.orders.cancel":"commerce.orders.cancel"}}}}},"schemas":{"Error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]},"Money":{"type":"object","properties":{"amount":{"type":"number"},"currency":{"type":"string","example":"GBP"}},"required":["amount","currency"]},"Offer":{"type":"object","properties":{"offer_id":{"type":"string"},"title":{"type":"string"},"brand":{"type":["string","null"]},"merchant":{"type":"string"},"merchant_environment":{"type":"string","enum":["sandbox","live"]},"price":{"type":"object","properties":{"amount":{"type":"number"},"currency":{"type":"string","example":"GBP"}},"required":["amount","currency"]},"delivery":{"type":"object","properties":{"amount":{"type":"number"},"currency":{"type":"string"},"estimate":{"type":["string","null"]}}},"total":{"type":"object","properties":{"amount":{"type":"number"},"currency":{"type":"string","example":"GBP"}},"required":["amount","currency"]},"in_stock":{"type":"boolean"},"purchasable":{"type":"boolean","description":"Whether OTTR can buy this offer itself"},"url":{"type":["string","null"]}}},"PurchaseIntent":{"type":"object","properties":{"id":{"type":"string"},"product":{"type":"string"},"merchant":{"type":"string"},"total":{"type":"object","properties":{"amount":{"type":"number"},"currency":{"type":"string","example":"GBP"}},"required":["amount","currency"]},"state":{"type":"string","enum":["OFFER_SELECTED","AWAITING_APPROVAL","APPROVED","FUNDING_PENDING","FUNDED","CARD_ISSUED","CHECKOUT_IN_PROGRESS","OUTCOME_UNKNOWN","PAYMENT_AUTHORISED","ORDER_CONFIRMED","COMPLETED","FAILED","CANCELLED","REFUND_PENDING","REFUNDED"]},"state_label":{"type":"string"},"failure_reason":{"type":["string","null"]},"order_id":{"type":["string","null"]},"merchant_order_ref":{"type":["string","null"]},"created_at":{"type":"string","format":"date-time"},"expires_at":{"type":"string","format":"date-time"}}},"PurchaseRequest":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"request_id":{"type":"string","minLength":1,"maxLength":100,"description":"Your own id for this request. Repeating it returns the same purchase."},"merchant":{"description":"Merchant id or domain, e.g. \"example-retailer.com\". Optional when product.url is given.","type":"string","maxLength":200},"product":{"type":"object","properties":{"url":{"description":"Exact product page on the merchant's own website.","type":"string","maxLength":2048},"id":{"description":"Merchant product or variant identifier.","type":"string","maxLength":200},"name":{"description":"Product name, when no URL or id is known.","type":"string","maxLength":300},"size":{"type":"string","maxLength":60},"colour":{"type":"string","maxLength":60},"variant":{"description":"Other options, e.g. {\"material\": \"leather\"}.","type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string","maxLength":100}},"quantity":{"default":1,"type":"integer","minimum":1,"maximum":5}}},"purchase_constraints":{"type":"object","properties":{"maximum_total_amount":{"type":"number","exclusiveMinimum":0,"maximum":10000,"description":"The most the customer will pay for items and delivery, in major units (e.g. 150 = £150)."},"currency":{"type":"string","minLength":3,"maxLength":3},"delivery_country":{"type":"string","minLength":2,"maxLength":2},"allow_substitutions":{"default":false,"type":"boolean"}},"required":["maximum_total_amount","currency"]},"execution_preference":{"default":"auto","type":"string","enum":["auto","merchant_api","browser"]},"delivery":{"type":"object","properties":{"address_ref":{"description":"One of the customer's saved Ottr addresses. Defaults to their default address.","type":"string","maxLength":100}}},"payment":{"type":"object","properties":{"payment_method_ref":{"description":"One of the customer's saved Ottr payment methods. Defaults to their default card.","type":"string","maxLength":100}}},"correlation_id":{"type":"string","maxLength":200},"notify_customer":{"default":true,"description":"Also send the approval link to the customer on their Ottr channels.","type":"boolean"}},"required":["request_id","product","purchase_constraints"]},"CommerceStatus":{"type":"string","enum":["CREATED","VALIDATING","PRODUCT_VERIFIED","CHECKOUT_PREPARING","AWAITING_CUSTOMER_APPROVAL","APPROVED","PAYMENT_PREPARING","ORDER_SUBMITTING","ORDER_CONFIRMED","COMPLETED","PRODUCT_UNAVAILABLE","PRICE_CHANGED","CUSTOMER_ACTION_REQUIRED","AUTHENTICATION_REQUIRED","PAYMENT_FAILED","ORDER_OUTCOME_UNKNOWN","FAILED","CANCELLED","EXPIRED"]},"Amount":{"type":["object","null"],"properties":{"amount":{"type":"number"},"currency":{"type":"string"},"formatted":{"type":"string"}}},"Approval":{"type":["object","null"],"properties":{"type":{"type":"string","enum":["hosted_authorisation","account_setup"]},"url":{"type":"string"},"expires_at":{"type":"string","format":"date-time"},"expires_in_seconds":{"type":"integer"},"instructions":{"type":"string"}}},"Purchase":{"type":"object","properties":{"purchase_id":{"type":"string"},"request_id":{"type":"string"},"correlation_id":{"type":["string","null"]},"status":{"$ref":"#/components/schemas/CommerceStatus"},"merchant":{"type":["object","null"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"domain":{"type":["string","null"]},"environment":{"type":"string"}}},"requested":{"type":"object"},"constraints":{"type":"object"},"order_summary":{"type":["object","null"],"properties":{"merchant":{"type":"string"},"product":{"type":"string"},"variant":{"type":["string","null"]},"quantity":{"type":"integer"},"item_price":{"$ref":"#/components/schemas/Amount"},"delivery":{"$ref":"#/components/schemas/Amount"},"total":{"$ref":"#/components/schemas/Amount"},"card_fee":{"$ref":"#/components/schemas/Amount"},"total_payable":{"$ref":"#/components/schemas/Amount"},"execution_method":{"type":"string"}}},"approval":{"$ref":"#/components/schemas/Approval"},"order":{"type":["object","null"],"properties":{"order_id":{"type":"string"},"merchant_order_ref":{"type":"string"},"status":{"type":"string"},"placed_at":{"type":"string","format":"date-time"},"total":{"$ref":"#/components/schemas/Amount"}}},"failure":{"type":["object","null"],"properties":{"code":{"type":"string"},"message":{"type":["string","null"]}}},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"expires_at":{"type":"string","format":"date-time"}}},"MerchantCapabilities":{"type":"object","properties":{"merchant_id":{"type":"string"},"name":{"type":"string"},"supported":{"type":"boolean"},"execution_methods":{"type":"array","items":{"type":"object","properties":{"method":{"type":"string"},"status":{"type":"string"}}}},"capabilities":{"type":"object"},"performance":{"type":"object"},"known_restrictions":{"type":["string","null"]}}},"CommerceEvent":{"type":"object","required":["id","type","created_at","agent_id","purchase_id","status"],"properties":{"id":{"type":"string","description":"Event id; de-duplicate on it."},"type":{"type":"string","enum":["commerce.purchase.created","commerce.purchase.checkout_prepared","commerce.purchase.approval_required","commerce.purchase.approved","commerce.purchase.authentication_required","commerce.purchase.payment_processing","commerce.purchase.order_confirmed","commerce.purchase.completed","commerce.purchase.failed","commerce.purchase.cancelled","commerce.purchase.outcome_unknown"]},"created_at":{"type":"string","format":"date-time"},"agent_id":{"type":"string"},"purchase_id":{"type":"string"},"status":{"$ref":"#/components/schemas/CommerceStatus"},"data":{"type":"object","description":"Non-sensitive details: approval, order_summary, order or failure."}}},"Order":{"type":"object","properties":{"id":{"type":"string"},"merchant_order_ref":{"type":"string"},"status":{"type":"string"},"total":{"type":"object","properties":{"amount":{"type":"number"},"currency":{"type":"string","example":"GBP"}},"required":["amount","currency"]},"items":{"type":"array","items":{"type":"object","properties":{"title":{"type":"string"},"quantity":{"type":"integer"}}}},"shipment":{"type":["object","null"]},"refunds":{"type":"array","items":{"type":"object"}}}}}},"paths":{"/v1/commerce/purchases":{"post":{"operationId":"preparePurchase","summary":"Create a purchase from a structured request","description":"Validates the agent, the customer's permission, the merchant and the product URL, then prepares the checkout asynchronously. Poll the status or wait for commerce.purchase.approval_required. Repeating a request_id returns the same purchase.","security":[{"agentKey":[],"customerRef":[]},{"linkedAccount":[]}],"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string","maxLength":255},"description":"Repeating a POST with the same key and body returns the original response (24 hours)."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PurchaseRequest"}}}},"responses":{"202":{"description":"Purchase","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Purchase"}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"operationId":"listPurchases","summary":"Purchases your agent made for this customer","security":[{"agentKey":[],"customerRef":[]},{"linkedAccount":[]}],"parameters":[{"name":"limit","in":"query","schema":{"type":"integer","maximum":50}},{"name":"cursor","in":"query","schema":{"type":"string"}},{"name":"status","in":"query","schema":{"$ref":"#/components/schemas/CommerceStatus"}}],"responses":{"200":{"description":"Page","content":{"application/json":{"schema":{"type":"object","properties":{"purchases":{"type":"array","items":{"$ref":"#/components/schemas/Purchase"}},"next_cursor":{"type":["string","null"]}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/commerce/purchases/{purchase_id}":{"get":{"operationId":"getPurchase","summary":"A purchase","security":[{"agentKey":[],"customerRef":[]},{"linkedAccount":[]}],"parameters":[{"name":"purchase_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Purchase","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Purchase"}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/commerce/purchases/{purchase_id}/status":{"get":{"operationId":"getPurchaseStatus","summary":"Status and timeline","security":[{"agentKey":[],"customerRef":[]},{"linkedAccount":[]}],"parameters":[{"name":"purchase_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Status","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"$ref":"#/components/schemas/CommerceStatus"},"timeline":{"type":"array","items":{"type":"object"}}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/commerce/purchases/{purchase_id}/quote":{"get":{"operationId":"getCheckoutQuote","summary":"Verified checkout pricing","security":[{"agentKey":[],"customerRef":[]},{"linkedAccount":[]}],"parameters":[{"name":"purchase_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Quote"},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/commerce/purchases/{purchase_id}/approval":{"get":{"operationId":"getPurchaseApproval","summary":"The approval the customer must give","description":"Returns Ottr's hosted approval link (refreshed if it expired). Only the customer, signed in to Ottr, can approve.","security":[{"agentKey":[],"customerRef":[]},{"linkedAccount":[]}],"parameters":[{"name":"purchase_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Approval","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"$ref":"#/components/schemas/CommerceStatus"},"approval":{"$ref":"#/components/schemas/Approval"}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/commerce/purchases/{purchase_id}/execute":{"post":{"operationId":"executeApprovedPurchase","summary":"Proceed with an approved purchase","description":"Sensitive. Ottr verifies the customer's approval itself; 409 approval_required otherwise. Nothing in the request counts as approval.","security":[{"agentKey":[],"customerRef":[]},{"linkedAccount":[]}],"parameters":[{"name":"purchase_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string","maxLength":255},"description":"Repeating a POST with the same key and body returns the original response (24 hours)."}],"responses":{"200":{"description":"Purchase","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Purchase"}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/commerce/purchases/{purchase_id}/cancel":{"post":{"operationId":"cancelPurchase","summary":"Cancel where possible","security":[{"agentKey":[],"customerRef":[]},{"linkedAccount":[]}],"parameters":[{"name":"purchase_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string","maxLength":255},"description":"Repeating a POST with the same key and body returns the original response (24 hours)."}],"responses":{"200":{"description":"Purchase","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Purchase"}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/commerce/orders":{"get":{"operationId":"listOrders","summary":"Confirmed orders from your agent's purchases","security":[{"agentKey":[],"customerRef":[]},{"linkedAccount":[]}],"responses":{"200":{"description":"Orders"},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/commerce/orders/{order_id}":{"get":{"operationId":"getOrder","summary":"An order and its confirmation evidence","security":[{"agentKey":[],"customerRef":[]},{"linkedAccount":[]}],"parameters":[{"name":"order_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Order"},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/commerce/merchants":{"get":{"operationId":"listMerchants","summary":"Supported merchants","security":[{"agentKey":[]},{"linkedAccount":[]}],"responses":{"200":{"description":"Merchants","content":{"application/json":{"schema":{"type":"object","properties":{"merchants":{"type":"array","items":{"$ref":"#/components/schemas/MerchantCapabilities"}}}}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/commerce/merchants/{merchant_id}/capabilities":{"get":{"operationId":"getMerchantCapabilities","summary":"A merchant's capability profile","security":[{"agentKey":[]},{"linkedAccount":[]}],"parameters":[{"name":"merchant_id","in":"path","required":true,"schema":{"type":"string"},"description":"Merchant id or domain"}],"responses":{"200":{"description":"Capabilities","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MerchantCapabilities"}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/commerce/merchants/check":{"post":{"operationId":"checkMerchantSupport","summary":"Can Ottr buy from this merchant or product URL?","security":[{"agentKey":[]},{"linkedAccount":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"merchant":{"type":"string"},"product_url":{"type":"string"}}}}}},"responses":{"200":{"description":"Capabilities or {supported: false, reason}"},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/commerce/webhooks":{"post":{"operationId":"createWebhookEndpoint","summary":"Register a webhook endpoint","description":"https only, public addresses only. Ottr immediately sends a signed webhook.verification event; respond 2xx with the challenge value in the body. The signing secret is returned once.","security":[{"agentKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["url"],"properties":{"url":{"type":"string"},"events":{"type":"array","items":{"type":"string","enum":["commerce.purchase.created","commerce.purchase.checkout_prepared","commerce.purchase.approval_required","commerce.purchase.approved","commerce.purchase.authentication_required","commerce.purchase.payment_processing","commerce.purchase.order_confirmed","commerce.purchase.completed","commerce.purchase.failed","commerce.purchase.cancelled","commerce.purchase.outcome_unknown"]}}}}}}},"responses":{"201":{"description":"Endpoint (with secret)"},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"operationId":"listWebhookEndpoints","summary":"Your webhook endpoints","security":[{"agentKey":[]}],"responses":{"200":{"description":"Endpoints"}}}},"/v1/commerce/webhooks/{endpoint_id}":{"delete":{"operationId":"deleteWebhookEndpoint","summary":"Remove an endpoint","security":[{"agentKey":[]}],"parameters":[{"name":"endpoint_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Removed"},"404":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/commerce/webhooks/{endpoint_id}/verify":{"post":{"operationId":"verifyWebhookEndpoint","summary":"Re-run the verification challenge","security":[{"agentKey":[]}],"parameters":[{"name":"endpoint_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Verified"},"422":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/agent/search":{"post":{"summary":"Search products","security":[{"agentKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"query":{"type":"string"},"max_price":{"type":"number","description":"Pounds, including delivery"},"limit":{"type":"integer","maximum":10}},"required":["query"]}}}},"responses":{"200":{"description":"Offers","content":{"application/json":{"schema":{"type":"object","properties":{"results":{"type":"array","items":{"$ref":"#/components/schemas/Offer"}}}}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/agent/purchase-intents":{"post":{"summary":"Prepare a purchase (charges nothing)","security":[{"agentKey":[],"customerRef":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"offer_id":{"type":"string"},"quantity":{"type":"integer","minimum":1,"maximum":5}},"required":["offer_id"]}}}},"responses":{"200":{"description":"Prepared","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PurchaseIntent"}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/agent/purchase-intents/{id}":{"get":{"summary":"Purchase state","security":[{"agentKey":[],"customerRef":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Purchase","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PurchaseIntent"}}}},"404":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/agent/purchase-intents/{id}/approval-requests":{"post":{"summary":"Ask the customer to approve","description":"Sends the customer a secure, single-use approval link on their own channel. Only the customer can approve, signed in to OTTR.","security":[{"agentKey":[],"customerRef":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Requested","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["awaiting_customer_approval","needs_customer_setup"]},"approval_url":{"type":"string"},"expires_at":{"type":"string","format":"date-time"},"delivered_to_customer":{"type":"boolean"},"missing":{"type":"array","items":{"type":"string"}}}}}}},"409":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/agent/purchases":{"post":{"summary":"Proceed with an approved purchase","description":"Refused with 409 approval_required until the customer has approved.","security":[{"agentKey":[],"customerRef":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"intent_id":{"type":"string"}},"required":["intent_id"]}}}},"responses":{"200":{"description":"Purchase","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PurchaseIntent"}}}},"409":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/agent/orders/{id}":{"get":{"summary":"Order status","security":[{"agentKey":[],"customerRef":[]}],"parameters":[{"name":"id","in":"path","required":true,"description":"Order id or merchant order reference","schema":{"type":"string"}}],"responses":{"200":{"description":"Order","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Order"}}}},"404":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/agent/orders/{id}/returns":{"post":{"summary":"Start a return","security":[{"agentKey":[],"customerRef":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string"}}}}}},"responses":{"200":{"description":"Return started"},"409":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"webhooks":{"commerce.purchase.created":{"post":{"summary":"commerce.purchase.created","description":"Sent to your verified webhook endpoints. Verify Ottr-Signature (t=<unix>,v1=<HMAC-SHA256 hex of \"<t>.<raw body>\" with your endpoint secret>), reject timestamps older than 5 minutes, and de-duplicate on the event id. Respond 2xx; failures are retried with backoff for about an hour.","parameters":[{"name":"Ottr-Signature","in":"header","required":true,"schema":{"type":"string"}},{"name":"Ottr-Event-Id","in":"header","required":true,"schema":{"type":"string"}},{"name":"Ottr-Event-Type","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommerceEvent"}}}},"responses":{"200":{"description":"Received"}}}},"commerce.purchase.checkout_prepared":{"post":{"summary":"commerce.purchase.checkout_prepared","description":"Sent to your verified webhook endpoints. Verify Ottr-Signature (t=<unix>,v1=<HMAC-SHA256 hex of \"<t>.<raw body>\" with your endpoint secret>), reject timestamps older than 5 minutes, and de-duplicate on the event id. Respond 2xx; failures are retried with backoff for about an hour.","parameters":[{"name":"Ottr-Signature","in":"header","required":true,"schema":{"type":"string"}},{"name":"Ottr-Event-Id","in":"header","required":true,"schema":{"type":"string"}},{"name":"Ottr-Event-Type","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommerceEvent"}}}},"responses":{"200":{"description":"Received"}}}},"commerce.purchase.approval_required":{"post":{"summary":"commerce.purchase.approval_required","description":"Sent to your verified webhook endpoints. Verify Ottr-Signature (t=<unix>,v1=<HMAC-SHA256 hex of \"<t>.<raw body>\" with your endpoint secret>), reject timestamps older than 5 minutes, and de-duplicate on the event id. Respond 2xx; failures are retried with backoff for about an hour.","parameters":[{"name":"Ottr-Signature","in":"header","required":true,"schema":{"type":"string"}},{"name":"Ottr-Event-Id","in":"header","required":true,"schema":{"type":"string"}},{"name":"Ottr-Event-Type","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommerceEvent"}}}},"responses":{"200":{"description":"Received"}}}},"commerce.purchase.approved":{"post":{"summary":"commerce.purchase.approved","description":"Sent to your verified webhook endpoints. Verify Ottr-Signature (t=<unix>,v1=<HMAC-SHA256 hex of \"<t>.<raw body>\" with your endpoint secret>), reject timestamps older than 5 minutes, and de-duplicate on the event id. Respond 2xx; failures are retried with backoff for about an hour.","parameters":[{"name":"Ottr-Signature","in":"header","required":true,"schema":{"type":"string"}},{"name":"Ottr-Event-Id","in":"header","required":true,"schema":{"type":"string"}},{"name":"Ottr-Event-Type","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommerceEvent"}}}},"responses":{"200":{"description":"Received"}}}},"commerce.purchase.authentication_required":{"post":{"summary":"commerce.purchase.authentication_required","description":"Sent to your verified webhook endpoints. Verify Ottr-Signature (t=<unix>,v1=<HMAC-SHA256 hex of \"<t>.<raw body>\" with your endpoint secret>), reject timestamps older than 5 minutes, and de-duplicate on the event id. Respond 2xx; failures are retried with backoff for about an hour.","parameters":[{"name":"Ottr-Signature","in":"header","required":true,"schema":{"type":"string"}},{"name":"Ottr-Event-Id","in":"header","required":true,"schema":{"type":"string"}},{"name":"Ottr-Event-Type","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommerceEvent"}}}},"responses":{"200":{"description":"Received"}}}},"commerce.purchase.payment_processing":{"post":{"summary":"commerce.purchase.payment_processing","description":"Sent to your verified webhook endpoints. Verify Ottr-Signature (t=<unix>,v1=<HMAC-SHA256 hex of \"<t>.<raw body>\" with your endpoint secret>), reject timestamps older than 5 minutes, and de-duplicate on the event id. Respond 2xx; failures are retried with backoff for about an hour.","parameters":[{"name":"Ottr-Signature","in":"header","required":true,"schema":{"type":"string"}},{"name":"Ottr-Event-Id","in":"header","required":true,"schema":{"type":"string"}},{"name":"Ottr-Event-Type","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommerceEvent"}}}},"responses":{"200":{"description":"Received"}}}},"commerce.purchase.order_confirmed":{"post":{"summary":"commerce.purchase.order_confirmed","description":"Sent to your verified webhook endpoints. Verify Ottr-Signature (t=<unix>,v1=<HMAC-SHA256 hex of \"<t>.<raw body>\" with your endpoint secret>), reject timestamps older than 5 minutes, and de-duplicate on the event id. Respond 2xx; failures are retried with backoff for about an hour.","parameters":[{"name":"Ottr-Signature","in":"header","required":true,"schema":{"type":"string"}},{"name":"Ottr-Event-Id","in":"header","required":true,"schema":{"type":"string"}},{"name":"Ottr-Event-Type","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommerceEvent"}}}},"responses":{"200":{"description":"Received"}}}},"commerce.purchase.completed":{"post":{"summary":"commerce.purchase.completed","description":"Sent to your verified webhook endpoints. Verify Ottr-Signature (t=<unix>,v1=<HMAC-SHA256 hex of \"<t>.<raw body>\" with your endpoint secret>), reject timestamps older than 5 minutes, and de-duplicate on the event id. Respond 2xx; failures are retried with backoff for about an hour.","parameters":[{"name":"Ottr-Signature","in":"header","required":true,"schema":{"type":"string"}},{"name":"Ottr-Event-Id","in":"header","required":true,"schema":{"type":"string"}},{"name":"Ottr-Event-Type","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommerceEvent"}}}},"responses":{"200":{"description":"Received"}}}},"commerce.purchase.failed":{"post":{"summary":"commerce.purchase.failed","description":"Sent to your verified webhook endpoints. Verify Ottr-Signature (t=<unix>,v1=<HMAC-SHA256 hex of \"<t>.<raw body>\" with your endpoint secret>), reject timestamps older than 5 minutes, and de-duplicate on the event id. Respond 2xx; failures are retried with backoff for about an hour.","parameters":[{"name":"Ottr-Signature","in":"header","required":true,"schema":{"type":"string"}},{"name":"Ottr-Event-Id","in":"header","required":true,"schema":{"type":"string"}},{"name":"Ottr-Event-Type","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommerceEvent"}}}},"responses":{"200":{"description":"Received"}}}},"commerce.purchase.cancelled":{"post":{"summary":"commerce.purchase.cancelled","description":"Sent to your verified webhook endpoints. Verify Ottr-Signature (t=<unix>,v1=<HMAC-SHA256 hex of \"<t>.<raw body>\" with your endpoint secret>), reject timestamps older than 5 minutes, and de-duplicate on the event id. Respond 2xx; failures are retried with backoff for about an hour.","parameters":[{"name":"Ottr-Signature","in":"header","required":true,"schema":{"type":"string"}},{"name":"Ottr-Event-Id","in":"header","required":true,"schema":{"type":"string"}},{"name":"Ottr-Event-Type","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommerceEvent"}}}},"responses":{"200":{"description":"Received"}}}},"commerce.purchase.outcome_unknown":{"post":{"summary":"commerce.purchase.outcome_unknown","description":"Sent to your verified webhook endpoints. Verify Ottr-Signature (t=<unix>,v1=<HMAC-SHA256 hex of \"<t>.<raw body>\" with your endpoint secret>), reject timestamps older than 5 minutes, and de-duplicate on the event id. Respond 2xx; failures are retried with backoff for about an hour.","parameters":[{"name":"Ottr-Signature","in":"header","required":true,"schema":{"type":"string"}},{"name":"Ottr-Event-Id","in":"header","required":true,"schema":{"type":"string"}},{"name":"Ottr-Event-Type","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommerceEvent"}}}},"responses":{"200":{"description":"Received"}}}}}}