{"openapi":"3.1.0","info":{"title":"ScaleEdges API","version":"2.1.0","description":"Store API and durable automation events. Account limit: 120 requests/minute/store plus an IP limit. Events retained 30 days; pending deliveries survive retention. Docs: https://www.scaleedges.com/documentation/api-reference"},"servers":[{"url":"https://www.scaleedges.com/api/v2"}],"paths":{"/account":{"get":{"summary":"Get the connected store","operationId":"get__account","description":"Requires account:read.","x-required-scopes":["account:read"],"security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"parameters":[],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Account"},"request_id":{"type":"string"}},"required":["data","request_id"]}}}},"default":{"description":"400 validation, 401 credentials, 403 scope, 404 not found, 409 conflict, 429 rate limit or 500 server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/products":{"get":{"summary":"List products","operationId":"get__products","description":"Requires products:read. Newest insertion first; use next_cursor with the same filters. Events also require the resource read scope. Webhook resources are isolated to the current API key.","x-required-scopes":["products:read"],"security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":25},"description":""},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":""},{"name":"product_key","in":"query","required":false,"schema":{"type":"string"},"description":""}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"products":{"type":"array","items":{"$ref":"#/components/schemas/Product"}}},"required":["products"]},"request_id":{"type":"string"},"meta":{"$ref":"#/components/schemas/Page"}},"required":["data","request_id","meta"]}}}},"default":{"description":"400 validation, 401 credentials, 403 scope, 404 not found, 409 conflict, 429 rate limit or 500 server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/products/{id}":{"get":{"summary":"Get product","operationId":"get__products__id_","description":"Requires products:read.","x-required-scopes":["products:read"],"security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":""}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Product"},"request_id":{"type":"string"}},"required":["data","request_id"]}}}},"default":{"description":"400 validation, 401 credentials, 403 scope, 404 not found, 409 conflict, 429 rate limit or 500 server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/collections":{"get":{"summary":"List collections","operationId":"get__collections","description":"Requires products:read. Newest insertion first; use next_cursor with the same filters. Events also require the resource read scope. Webhook resources are isolated to the current API key.","x-required-scopes":["products:read"],"security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":25},"description":""},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":""}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"collections":{"type":"array","items":{"$ref":"#/components/schemas/Collection"}}},"required":["collections"]},"request_id":{"type":"string"},"meta":{"$ref":"#/components/schemas/Page"}},"required":["data","request_id","meta"]}}}},"default":{"description":"400 validation, 401 credentials, 403 scope, 404 not found, 409 conflict, 429 rate limit or 500 server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/orders":{"get":{"summary":"List orders","operationId":"get__orders","description":"Requires orders:read. Newest insertion first; use next_cursor with the same filters. Events also require the resource read scope. Webhook resources are isolated to the current API key.","x-required-scopes":["orders:read"],"security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":25},"description":""},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":""},{"name":"customer_id","in":"query","required":false,"schema":{"type":"string"},"description":""},{"name":"product_id","in":"query","required":false,"schema":{"type":"string"},"description":""}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"orders":{"type":"array","items":{"$ref":"#/components/schemas/Order"}}},"required":["orders"]},"request_id":{"type":"string"},"meta":{"$ref":"#/components/schemas/Page"}},"required":["data","request_id","meta"]}}}},"default":{"description":"400 validation, 401 credentials, 403 scope, 404 not found, 409 conflict, 429 rate limit or 500 server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/orders/{id}":{"get":{"summary":"Get order","operationId":"get__orders__id_","description":"Requires orders:read.","x-required-scopes":["orders:read"],"security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":""}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Order"},"request_id":{"type":"string"}},"required":["data","request_id"]}}}},"default":{"description":"400 validation, 401 credentials, 403 scope, 404 not found, 409 conflict, 429 rate limit or 500 server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/customers":{"get":{"summary":"List customers","operationId":"get__customers","description":"Requires customers:read. Newest insertion first; use next_cursor with the same filters. Events also require the resource read scope. Webhook resources are isolated to the current API key.","x-required-scopes":["customers:read"],"security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":25},"description":""},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":""},{"name":"email","in":"query","required":false,"schema":{"type":"string","format":"email"},"description":""}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"customers":{"type":"array","items":{"$ref":"#/components/schemas/Customer"}}},"required":["customers"]},"request_id":{"type":"string"},"meta":{"$ref":"#/components/schemas/Page"}},"required":["data","request_id","meta"]}}}},"default":{"description":"400 validation, 401 credentials, 403 scope, 404 not found, 409 conflict, 429 rate limit or 500 server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/customers/{id}":{"get":{"summary":"Get customer","operationId":"get__customers__id_","description":"Requires customers:read.","x-required-scopes":["customers:read"],"security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":""}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Customer"},"request_id":{"type":"string"}},"required":["data","request_id"]}}}},"default":{"description":"400 validation, 401 credentials, 403 scope, 404 not found, 409 conflict, 429 rate limit or 500 server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/events":{"get":{"summary":"List events","operationId":"get__events","description":"Requires events:read. Newest insertion first; use next_cursor with the same filters. Events also require the resource read scope. Webhook resources are isolated to the current API key.","x-required-scopes":["events:read"],"security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":25},"description":""},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":""},{"name":"type","in":"query","required":false,"schema":{"type":"string","enum":["order.created","order.refunded","customer.created","subscription.updated"]},"description":""},{"name":"since","in":"query","required":false,"schema":{"type":"string","format":"date-time"},"description":""}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"events":{"type":"array","items":{"$ref":"#/components/schemas/Event"}}},"required":["events"]},"request_id":{"type":"string"},"meta":{"$ref":"#/components/schemas/Page"}},"required":["data","request_id","meta"]}}}},"default":{"description":"400 validation, 401 credentials, 403 scope, 404 not found, 409 conflict, 429 rate limit or 500 server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/events/{id}":{"get":{"summary":"Get event","operationId":"get__events__id_","description":"Requires events:read.","x-required-scopes":["events:read"],"security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":""}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Event"},"request_id":{"type":"string"}},"required":["data","request_id"]}}}},"default":{"description":"400 validation, 401 credentials, 403 scope, 404 not found, 409 conflict, 429 rate limit or 500 server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/webhook-subscriptions":{"get":{"summary":"List webhook-subscriptions","operationId":"get__webhook_subscriptions","description":"Requires webhooks:write. Newest insertion first; use next_cursor with the same filters. Events also require the resource read scope. Webhook resources are isolated to the current API key.","x-required-scopes":["webhooks:write"],"security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":25},"description":""},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":""}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"webhook_subscriptions":{"type":"array","items":{"$ref":"#/components/schemas/Webhook"}}},"required":["webhook_subscriptions"]},"request_id":{"type":"string"},"meta":{"$ref":"#/components/schemas/Page"}},"required":["data","request_id","meta"]}}}},"default":{"description":"400 validation, 401 credentials, 403 scope, 404 not found, 409 conflict, 429 rate limit or 500 server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"summary":"Subscribe to events","operationId":"post__webhook_subscriptions","description":"Requires webhooks:write, events:read, plus orders:read for order/subscription events or customers:read for customer events. At most 100 subscriptions per store. Identical URL/event selections on the same key reuse the subscription.","x-required-scopes":["webhooks:write"],"security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string","minLength":8,"maxLength":200,"pattern":"^[A-Za-z0-9._:-]+$"},"description":"Replays the same successful request for 24 hours per API key and endpoint. Different bodies return 409."}],"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Webhook"},"request_id":{"type":"string"}},"required":["data","request_id"]}}}},"default":{"description":"400 validation, 401 credentials, 403 scope, 404 not found, 409 conflict, 429 rate limit or 500 server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookInput"}}}}}},"/webhook-deliveries":{"get":{"summary":"List webhook-deliveries","operationId":"get__webhook_deliveries","description":"Requires webhooks:write. Newest insertion first; use next_cursor with the same filters. Events also require the resource read scope. Webhook resources are isolated to the current API key.","x-required-scopes":["webhooks:write"],"security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":25},"description":""},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":""},{"name":"subscription_id","in":"query","required":false,"schema":{"type":"string"},"description":""}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"webhook_deliveries":{"type":"array","items":{"$ref":"#/components/schemas/Delivery"}}},"required":["webhook_deliveries"]},"request_id":{"type":"string"},"meta":{"$ref":"#/components/schemas/Page"}},"required":["data","request_id","meta"]}}}},"default":{"description":"400 validation, 401 credentials, 403 scope, 404 not found, 409 conflict, 429 rate limit or 500 server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/webhook-subscriptions/{id}":{"delete":{"summary":"Delete a webhook subscription","operationId":"delete__webhook_subscriptions__id_","description":"Requires webhooks:write.","x-required-scopes":["webhooks:write"],"security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":""}],"responses":{"204":{"description":"Deleted"},"default":{"description":"400 validation, 401 credentials, 403 scope, 404 not found, 409 conflict, 429 rate limit or 500 server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/webhook-deliveries/{id}/retry":{"post":{"summary":"Replay a delivery","operationId":"post__webhook_deliveries__id__retry","description":"Requeue a failed or delivered event on an active subscription. Keeps event ID; resets attempt counter. Consumers must deduplicate.","x-required-scopes":["webhooks:write"],"security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":""},{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string","minLength":8,"maxLength":200,"pattern":"^[A-Za-z0-9._:-]+$"},"description":"Replays the same successful request for 24 hours per API key and endpoint. Different bodies return 409."}],"responses":{"202":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"status":{"const":"pending"}},"required":["id","status"]},"request_id":{"type":"string"}},"required":["data","request_id"]}}}},"default":{"description":"400 validation, 401 credentials, 403 scope, 404 not found, 409 conflict, 429 rate limit or 500 server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/coupons":{"get":{"summary":"List or find coupons","operationId":"get__coupons","description":"Requires coupons:read. Legacy offset pagination: meta contains limit, offset, total, has_more. code is an optional exact case-insensitive match.","x-required-scopes":["coupons:read"],"security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":10},"description":""},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0},"description":""},{"name":"code","in":"query","required":false,"schema":{"type":"string"},"description":""}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"coupons":{"type":"array","items":{"$ref":"#/components/schemas/Coupon"}}},"required":["coupons"]},"request_id":{"type":"string"},"meta":{"type":"object","properties":{"limit":{"type":"integer","minimum":0},"offset":{"type":"integer","minimum":0},"total":{"type":"integer","minimum":0},"has_more":{"type":"boolean"}},"required":["limit","offset","total","has_more"]}},"required":["data","request_id"]}}}},"default":{"description":"400 validation, 401 credentials, 403 scope, 404 not found, 409 conflict, 429 rate limit or 500 server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"summary":"Create a coupon","operationId":"post__coupons","description":"Requires coupons:write. Supply exactly one of percent_off or amount_off. single requires product_key; collection requires collection_id.","x-required-scopes":["coupons:write"],"security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string","minLength":8,"maxLength":200,"pattern":"^[A-Za-z0-9._:-]+$"},"description":"Replays the same successful request for 24 hours per API key and endpoint. Different bodies return 409."}],"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Coupon"},"request_id":{"type":"string"}},"required":["data","request_id"]}}}},"default":{"description":"400 validation, 401 credentials, 403 scope, 404 not found, 409 conflict, 429 rate limit or 500 server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CouponInput"}}}}}},"/coupons/{id}":{"get":{"summary":"Get a coupon","operationId":"get__coupons__id_","description":"Requires coupons:read.","x-required-scopes":["coupons:read"],"security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":""}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Coupon"},"request_id":{"type":"string"}},"required":["data","request_id"]}}}},"default":{"description":"400 validation, 401 credentials, 403 scope, 404 not found, 409 conflict, 429 rate limit or 500 server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"summary":"Update a coupon","operationId":"patch__coupons__id_","description":"Requires coupons:write.","x-required-scopes":["coupons:write"],"security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":""}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Coupon"},"request_id":{"type":"string"}},"required":["data","request_id"]}}}},"default":{"description":"400 validation, 401 credentials, 403 scope, 404 not found, 409 conflict, 429 rate limit or 500 server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"coupon_type":{"type":"string","enum":["single","multi","collection"]},"code":{"type":"string","maxLength":40},"percent_off":{"type":["number","null"],"exclusiveMinimum":0,"maximum":100},"amount_off":{"type":["integer","null"],"minimum":1},"product_key":{"type":["string","null"]},"collection_id":{"type":["string","null"]},"start_date":{"type":["string","null"],"format":"date-time"},"end_date":{"type":["string","null"],"format":"date-time"},"minimum_purchase_amount":{"type":["integer","null"],"minimum":1},"usage_limit":{"type":["integer","null"],"minimum":1},"notes":{"type":["string","null"]}},"required":[]}}}}},"put":{"summary":"Update a coupon","operationId":"put__coupons__id_","description":"Requires coupons:write.","x-required-scopes":["coupons:write"],"security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":""}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Coupon"},"request_id":{"type":"string"}},"required":["data","request_id"]}}}},"default":{"description":"400 validation, 401 credentials, 403 scope, 404 not found, 409 conflict, 429 rate limit or 500 server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"coupon_type":{"type":"string","enum":["single","multi","collection"]},"code":{"type":"string","maxLength":40},"percent_off":{"type":["number","null"],"exclusiveMinimum":0,"maximum":100},"amount_off":{"type":["integer","null"],"minimum":1},"product_key":{"type":["string","null"]},"collection_id":{"type":["string","null"]},"start_date":{"type":["string","null"],"format":"date-time"},"end_date":{"type":["string","null"],"format":"date-time"},"minimum_purchase_amount":{"type":["integer","null"],"minimum":1},"usage_limit":{"type":["integer","null"],"minimum":1},"notes":{"type":["string","null"]}},"required":[]}}}}},"delete":{"summary":"Delete a coupon","operationId":"delete__coupons__id_","description":"Requires coupons:write.","x-required-scopes":["coupons:write"],"security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":""}],"responses":{"204":{"description":"Deleted"},"default":{"description":"400 validation, 401 credentials, 403 scope, 404 not found, 409 conflict, 429 rate limit or 500 server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/license/verify":{"get":{"summary":"Verify a product license","operationId":"get__license_verify","description":"","security":[{"productSecret":[]},{"bearerAuth":[]}],"parameters":[{"name":"license_key","in":"query","required":true,"schema":{"type":"string"},"description":""}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/License"},"request_id":{"type":"string"}},"required":["data","request_id"]}}}},"default":{"description":"400 validation, 401 credentials, 403 scope, 404 not found, 409 conflict, 429 rate limit or 500 server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/license/enable":{"put":{"summary":"License enable","operationId":"put__license_enable","description":"Uses a product secret, not an account API key. usage and decrease are not idempotent; do not blindly retry.","security":[{"productSecret":[]},{"bearerAuth":[]}],"parameters":[],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/License"},"request_id":{"type":"string"}},"required":["data","request_id"]}}}},"default":{"description":"400 validation, 401 credentials, 403 scope, 404 not found, 409 conflict, 429 rate limit or 500 server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"license_key":{"type":"string"}},"required":["license_key"]}}}}}},"/license/disable":{"put":{"summary":"License disable","operationId":"put__license_disable","description":"Uses a product secret, not an account API key. usage and decrease are not idempotent; do not blindly retry.","security":[{"productSecret":[]},{"bearerAuth":[]}],"parameters":[],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/License"},"request_id":{"type":"string"}},"required":["data","request_id"]}}}},"default":{"description":"400 validation, 401 credentials, 403 scope, 404 not found, 409 conflict, 429 rate limit or 500 server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"license_key":{"type":"string"}},"required":["license_key"]}}}}}},"/license/usage":{"put":{"summary":"License usage","operationId":"put__license_usage","description":"Uses a product secret, not an account API key. usage and decrease are not idempotent; do not blindly retry.","security":[{"productSecret":[]},{"bearerAuth":[]}],"parameters":[],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/License"},"request_id":{"type":"string"}},"required":["data","request_id"]}}}},"default":{"description":"400 validation, 401 credentials, 403 scope, 404 not found, 409 conflict, 429 rate limit or 500 server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"license_key":{"type":"string"}},"required":["license_key"]}}}}}},"/license/decrease":{"put":{"summary":"License decrease","operationId":"put__license_decrease","description":"Uses a product secret, not an account API key. usage and decrease are not idempotent; do not blindly retry.","security":[{"productSecret":[]},{"bearerAuth":[]}],"parameters":[],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/License"},"request_id":{"type":"string"}},"required":["data","request_id"]}}}},"default":{"description":"400 validation, 401 credentials, 403 scope, 404 not found, 409 conflict, 429 rate limit or 500 server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"license_key":{"type":"string"}},"required":["license_key"]}}}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"},"apiKeyHeader":{"type":"apiKey","in":"header","name":"scaleedges-api-key"},"productSecret":{"type":"apiKey","in":"header","name":"product-secret-key"}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"type":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["type","code","message"]},"request_id":{"type":"string"}},"required":["error","request_id"]},"Page":{"type":"object","properties":{"limit":{"type":"integer","minimum":0},"has_more":{"type":"boolean"},"next_cursor":{"type":["string","null"]}},"required":["limit","has_more","next_cursor"]},"Account":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"store_slug":{"type":"string"},"currency":{"type":"string"},"scopes":{"type":"array","items":{"type":"string","enum":["account:read","products:read","orders:read","customers:read","events:read","coupons:read","coupons:write","webhooks:write"]}}},"required":["id","name","store_slug","currency","scopes"]},"Variant":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"price_cents":{"type":"integer","minimum":0},"currency":{"type":["string","null"]}},"required":["id","name","price_cents","currency"]},"Product":{"type":"object","properties":{"id":{"type":"string"},"product_key":{"type":"string"},"name":{"type":"string"},"price_cents":{"type":"integer","minimum":0},"currency":{"type":"string"},"type":{"type":"string"},"published":{"type":"boolean"},"created_at":{"type":["string","null"],"format":"date-time"},"updated_at":{"type":["string","null"],"format":"date-time"},"variants":{"type":"array","items":{"$ref":"#/components/schemas/Variant"}}},"required":["id","product_key","name","price_cents","currency","type","published","created_at","updated_at"]},"Collection":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"created_at":{"type":["string","null"],"format":"date-time"}},"required":["id","name","slug","created_at"]},"Customer":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string","format":"email"},"name":{"type":["string","null"]},"created_at":{"type":["string","null"],"format":"date-time"}},"required":["id","email","name","created_at"]},"OrderItem":{"type":"object","properties":{"purchase_id":{"type":["string","null"]},"product_id":{"type":"string"},"product_name":{"type":"string"},"product_key":{"type":"string"},"variant_id":{"type":["string","null"]},"variant_name":{"type":["string","null"]},"quantity":{"type":"integer","minimum":1},"amount_cents":{"type":"integer","minimum":0},"coupon_code":{"type":["string","null"]}},"required":["purchase_id","product_id","product_name","product_key","variant_id","variant_name","quantity","amount_cents","coupon_code"]},"Order":{"type":"object","properties":{"id":{"type":"string"},"customer_id":{"type":"string"},"customer_email":{"type":["string","null"]},"customer_name":{"type":["string","null"]},"amount_cents":{"type":"integer","minimum":0},"refunded_cents":{"type":"integer","minimum":0},"currency":{"type":"string"},"payment_provider":{"type":"string"},"kind":{"type":"string"},"subscription_id":{"type":["string","null"]},"items":{"type":"array","items":{"$ref":"#/components/schemas/OrderItem"}},"created_at":{"type":"string","format":"date-time"}},"required":["id","customer_id","customer_email","customer_name","amount_cents","refunded_cents","currency","payment_provider","kind","subscription_id","items","created_at"]},"Subscription":{"type":"object","properties":{"id":{"type":"string"},"customer_id":{"type":"string"},"product_id":{"type":"string"},"variant_id":{"type":["string","null"]},"status":{"type":"string"},"previous_status":{"type":["string","null"]},"price_cents":{"type":"integer","minimum":0},"currency":{"type":"string"},"billing_interval":{"type":"string"},"cancel_at_period_end":{"type":"boolean"},"current_period_start":{"type":["string","null"],"format":"date-time"},"current_period_end":{"type":["string","null"],"format":"date-time"},"access_until":{"type":["string","null"],"format":"date-time"},"trial_end":{"type":["string","null"],"format":"date-time"},"cancel_at":{"type":["string","null"],"format":"date-time"}},"required":["id","customer_id","product_id","variant_id","status","previous_status","price_cents","currency","billing_interval","cancel_at_period_end","current_period_start","current_period_end","access_until","trial_end","cancel_at"]},"Event":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["order.created","order.refunded","customer.created","subscription.updated"]},"created_at":{"type":"string","format":"date-time"},"data":{"anyOf":[{"type":"object","properties":{"order":{"$ref":"#/components/schemas/Order"}},"required":["order"]},{"type":"object","properties":{"order":{"$ref":"#/components/schemas/Order"},"refund":{"type":"object","properties":{"amount_cents":{"type":"integer","minimum":0},"total_refunded_cents":{"type":"integer","minimum":0}},"required":["amount_cents","total_refunded_cents"]}},"required":["order","refund"]},{"type":"object","properties":{"customer":{"$ref":"#/components/schemas/Customer"}},"required":["customer"]},{"type":"object","properties":{"subscription":{"$ref":"#/components/schemas/Subscription"}},"required":["subscription"]}]}},"required":["id","type","created_at","data"]},"WebhookInput":{"type":"object","properties":{"url":{"type":"string","format":"uri","maxLength":2048,"description":"Public HTTPS URL on port 443. Redirects are not followed."},"events":{"type":"array","items":{"type":"string","enum":["order.created","order.refunded","customer.created","subscription.updated"]},"minItems":1,"uniqueItems":true}},"required":["url","events"]},"Webhook":{"type":"object","properties":{"id":{"type":"string"},"url":{"type":"string","format":"uri"},"events":{"type":"array","items":{"type":"string","enum":["order.created","order.refunded","customer.created","subscription.updated"]}},"status":{"type":"string","enum":["active","disabled"]},"created_at":{"type":"string","format":"date-time"},"secret":{"type":"string","description":"Only returned on creation (or idempotent replay)."}},"required":["id","url","events","status","created_at"]},"Delivery":{"type":"object","properties":{"id":{"type":"string"},"event_id":{"type":"string"},"subscription_id":{"type":"string"},"status":{"type":"string","enum":["pending","sending","delivered","failed","canceled"]},"attempts":{"type":"integer","minimum":0},"next_attempt_at":{"type":["string","null"],"format":"date-time"},"last_status":{"type":["integer","null"]},"last_error":{"type":["string","null"]},"delivered_at":{"type":["string","null"],"format":"date-time"},"created_at":{"type":"string","format":"date-time"},"history":{"type":"array","items":{"type":"object","properties":{"attempted_at":{"type":"string","format":"date-time"},"status_code":{"type":["integer","null"]},"error_code":{"type":["string","null"]}},"required":["attempted_at","status_code","error_code"]}}},"required":["id","event_id","subscription_id","status","attempts","next_attempt_at","last_status","last_error","delivered_at","created_at","history"]},"Coupon":{"type":"object","properties":{"id":{"type":"integer","minimum":0},"coupon_type":{"type":"string","enum":["single","multi","collection"]},"percent_off":{"type":["number","null"],"exclusiveMinimum":0,"maximum":100},"amount_off":{"type":["integer","null"],"minimum":1},"code":{"type":"string","maxLength":40,"pattern":"^[A-Z0-9_-]+$"},"start_date":{"type":["string","null"],"format":"date-time"},"end_date":{"type":["string","null"],"format":"date-time"},"product_key":{"type":["string","null"]},"collection_id":{"type":["string","null"]},"minimum_purchase_amount":{"type":["integer","null"],"minimum":1},"usage_limit":{"type":["integer","null"],"minimum":1},"times_redeemed":{"type":"integer","minimum":0},"notes":{"type":["string","null"]},"created_at":{"type":["string","null"],"format":"date-time"}},"required":["id","coupon_type","percent_off","amount_off","code","start_date","end_date","product_key","collection_id","minimum_purchase_amount","usage_limit","times_redeemed","notes","created_at"]},"CouponInput":{"type":"object","properties":{"coupon_type":{"type":"string","enum":["single","multi","collection"]},"code":{"type":"string","maxLength":40},"percent_off":{"type":["number","null"],"exclusiveMinimum":0,"maximum":100},"amount_off":{"type":["integer","null"],"minimum":1},"product_key":{"type":["string","null"]},"collection_id":{"type":["string","null"]},"start_date":{"type":["string","null"],"format":"date-time"},"end_date":{"type":["string","null"],"format":"date-time"},"minimum_purchase_amount":{"type":["integer","null"],"minimum":1},"usage_limit":{"type":["integer","null"],"minimum":1},"notes":{"type":["string","null"]}},"required":["coupon_type","code"]},"License":{"type":"object","properties":{"license_key":{"type":"string"},"enabled":{"type":"boolean"},"valid":{"type":"boolean"},"product_link":{"type":"string"},"buyer_email":{"type":"string"},"uses":{"type":"integer","minimum":0},"max_uses":{"type":["integer","null"]},"license_type":{"type":"string"},"product_name":{"type":"string"},"variant_name":{"type":["string","null"]},"variant_id":{"type":["string","null"]},"date":{"type":["string","null"],"format":"date-time"}},"required":["license_key","enabled","valid","product_link","buyer_email","uses","max_uses","license_type","product_name","variant_name","variant_id","date"]}}},"webhooks":{"storeEvent":{"post":{"summary":"Signed ScaleEdges store event","parameters":[{"name":"ScaleEdges-Signature","in":"header","required":true,"schema":{"type":"string"},"description":"t=unix_seconds,v1=HMAC-SHA256(secret, timestamp + \".\" + rawBody)"},{"name":"ScaleEdges-Event-Id","in":"header","required":true,"schema":{"type":"string"},"description":""},{"name":"ScaleEdges-Delivery-Id","in":"header","required":true,"schema":{"type":"string"},"description":""}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Event"}}}},"responses":{"200":{"description":"Durably accepted. Delivery is at least once; deduplicate by event id."},"410":{"description":"Disable this subscription."},"429":{"description":"Retry later; Retry-After is respected up to 24 hours."}}}}}}