Create a webhook
Creates a webhook endpoint that listens to one or more of the available events.
Warning: You can create up to 10 webhooks per event.
Attributes
| Field | Type | Description | Required |
|---|---|---|---|
| url | string | The URL to listen for incoming POST notification containing event information. | yes |
| token | string | A token to secure your url. | |
| version | string | The version in which the information should be transformed to. Default: current api version | |
| description | json | A json object of localized description. | |
| state | string | State of the endpoint (see below). Default: inactive | |
| events | array | An array of Event Objects (see below). | yes |
States
| name | Default |
|---|---|
| inactive | yes |
| active |
Event Object
| Field | Type | Description | Required |
|---|---|---|---|
| name | string | The internal name | yes |
AuthorizationbearerAuth
Authorization
bearerAuth API token as bearer token — you receive a test and a live token, there is no switch between them. See Setup → Authentication and Setup → Test mode.
In: header
Header Parameters
The API only responds with JSON — this header is mandatory on every request (see Setup → Headers).
"application/json"Value in
- "application/json"
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Attributes for creating a webhook — see Create a webhook.
Response Body
application/json
application/json
application/json
curl -X POST "https://example.com/webhooks" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -d '{ "url": "https://requestb.in/1hd29kc1", "token": "my-secret-token", "description": { "en": "This is a description" }, "state": "active", "events": [ { "name": "order.completed" } ] }'{ "id": 2, "description": { "en": "This is a description" }, "version": "2022-02-01", "state": "active", "url": "https://requestb.in/1hd29kc1", "events": [ { "id": 3, "name": "order.completed" } ], "created_at": "2022-02-01T00:00:00+00:00", "updated_at": "2022-02-01T00:00:00+00:00"}List webhooks GET
You can configure webhook endpoints via the API to be notified about events that happen in Smake (how deliveries, retries and signatures work is described in [Basic Usage → Webhooks](/docs/checkout/2022-02-01/basic/webhooks)). > **Warning:** You can create up to 10 webhooks per event. ## Available Events Currently, these are all events you can listen to: * `order.completed` * `order.prepared` * `order.failed` * `order.cancelled` * `variant.completed` * `variant.failed` * `logo.completed` * `logo.failed` * `shipment.prepared` * `draft-order.checked` — a draft order passed the automatic checks * `draft-order.failed` — a draft order failed the automatic checks, see its `failure_message` * `merchant-variant.designer-condition.created` — the designer configuration of a variant was created * `merchant-variant.designer-condition.changed` — the designer configuration of a variant changed ## List Returns a collection of your webhooks.
Show a webhook GET
Returns the webhook with the given `id`.