Skip to main content

Manage Subscriptions

Create a subscription​

curl -X POST https://staging.api.v2.wino.fr/webhooks/subscriptions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $WINO_API_KEY" \
-d '{ "shopId": "<your shop ID>", "url": "https://example.com/wino-webhooks", "clientState": "<a secret of yours>" }'
Body fieldRequiredDescription
shopIdyesThe shop to follow
urlyesThe URL to notify. It must be a valid http or https URL, not localhost, and 255 characters at most
clientStateno, but set itA secret of your choice (255 characters at most), sent back in every notification. Your receiver checks it to know the notification comes from Wino (see Receive notifications)
disablednotrue to create it paused. Default: false

Any other field is refused. The response is 201 Created with the subscription:

{
"id": "0b7e…",
"createdAt": 1793869920000,
"updatedAt": 1793869920000,
"userId": "…",
"url": "https://example.com/wino-webhooks",
"clientState": "<a secret of yours>",
"shopId": "<your shop ID>",
"disabled": false,
"settings": {
"Product": true,
"Variant": true,
"VariantPrice": true,
"StockActivity": true,
"Customer": false,
"…": false
}
}

createdAt and updatedAt are timestamps in milliseconds. userId identifies the account behind the key that created the subscription. To follow several shops, create one subscription per shop.

The POST doesn't accept settings: a new subscription starts with the default kinds below. To choose other kinds, create it, then send a PATCH.

localhost is refused. To test from your computer, expose your local server through a tunnel service that gives you a public HTTPS URL, and subscribe that URL.

Turn kinds on or off with PATCH. Only the kinds you send change (subscriptionId is the id returned when you created it):

curl -X PATCH https://staging.api.v2.wino.fr/webhooks/subscriptions/<subscription id> \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $WINO_API_KEY" \
-d '{ "settings": { "Customer": true, "SalesReceipt": true } }'

PATCH also changes url, clientState, disabled or shopId. It ignores the fields it doesn't know, without an error: check the subscription it returns. If you change clientState, keep accepting the old value for 5 minutes: notifications still carry it until the change applies. PUT replaces the whole subscription with a body like the POST one, and resets settings to the defaults. Send clientState again: without it, PUT removes it. Without disabled, PUT also turns a paused subscription back on.

List, get and delete​

# List your subscriptions
curl https://staging.api.v2.wino.fr/webhooks/subscriptions \
-H "Authorization: Bearer $WINO_API_KEY"

# Delete one
curl -X DELETE https://staging.api.v2.wino.fr/webhooks/subscriptions/<subscription id> \
-H "Authorization: Bearer $WINO_API_KEY"

The list contains only the subscriptions created with your key. With an id, you can also read, change or delete another subscription of a shop your key accesses (for example the one of the shop's online store): check its shopId and url before changing it. PUT makes you its owner. Errors use HTTP status codes: see Errors.