Webhook endpoints
The owner's own endpoints (D354) and their deliveries, with webhooks:write.
| Operation | Method and path | Scope |
|---|---|---|
| List webhook endpoints | GET /webhooks | webhooks:write |
| Add a webhook endpoint | POST /webhooks | webhooks:write |
| Change a webhook endpoint | PATCH /webhooks/{id} | webhooks:write |
| Remove a webhook endpoint | DELETE /webhooks/{id} | webhooks:write |
| List an endpoint's deliveries | GET /webhooks/{id}/deliveries | webhooks:write |
| Send a delivery again | POST /webhooks/{id}/deliveries/{delivery_id}/resend | webhooks:write |
List webhook endpoints
GET https://kaizenaflow.com/api/admin/v1/webhooks
The owner's endpoints, each with how its deliveries go; never an address or a secret.
Operation:
webhooks.listScope:
webhooks:writeAnswers:
200, the answer underdata.
Answer
| Field | Type | Description |
|---|---|---|
data | list of objects | |
data[].id | string (uuid) | |
data[].name | string | |
data[].hint | string | The address's host, to tell endpoints apart: the address itself is kept encrypted and never answered. |
data[].topics | list of string | |
data[].enabled | boolean | |
data[].disabled_reason | one of failing, owner or null | failing: switched off after three days of failed deliveries. |
data[].failing_since | string (date-time) or null | |
data[].last_delivery | object or null | |
data[].last_delivery.status | one of pending, delivered, failed | |
data[].last_delivery.at | string (date-time) | |
data[].recent_failures | integer | Deliveries that failed in the last 7 days. |
Errors
| Status | Code | When |
|---|---|---|
| 401 | unauthorized | No valid token in Authorization: Bearer kf_…, or one that was revoked. |
| 403 | forbidden | The token does not hold the scope the operation needs, or its owner does not hold the staff permission it needs in the store now (a store that is not open, as in the admin, keeps open only its orders, customers, reports and the owner's own pages such as its webhooks; its products, discounts, website and settings, read or changed, are refused); the message names which. |
| 429 | rate_limited | More calls than the budget allows; Retry-After says how many seconds to wait. |
| 500 | failed | Something went wrong on our side; nothing more was done. It is safe to try again. |
Example request
curl
curl 'https://kaizenaflow.com/api/admin/v1/webhooks' \
-H "Authorization: Bearer $KAIZENA_TOKEN"JavaScript
const response = await fetch("https://kaizenaflow.com/api/admin/v1/webhooks", {
headers: {
Authorization: `Bearer ${process.env.KAIZENA_TOKEN}`,
},
});
const answer = await response.json();Python
import json
import os
import urllib.request
request = urllib.request.Request(
"https://kaizenaflow.com/api/admin/v1/webhooks",
headers={
"Authorization": "Bearer " + os.environ["KAIZENA_TOKEN"],
},
)
with urllib.request.urlopen(request) as response:
answer = json.load(response)Add a webhook endpoint
POST https://kaizenaflow.com/api/admin/v1/webhooks
Adds an endpoint, on, through the Integrations page's own writer (an HTTPS address on a public host, checked again at every send). Its signing secret is answered this once, never again (a replay of the request answers it as null).
Operation:
webhooks.createScope:
webhooks:writeAnswers:
201, made: the answer underdata.Once only: with an
Idempotency-Keyheader.
Body
JSON, with Content-Type: application/json.
| Field | Type | Required | Description |
|---|---|---|---|
name | string, 1 to 80 characters | yes | |
url | string, at most 2,000 characters | yes | An HTTPS address on a public host. |
topics | list of one of order.paid, order.sent, order.cancelled, order.refunded, customer.created, subscription.started, subscription.cancelled, return.requested, withdrawal.received, product.created, product.updated, stock.low, discount.created, inventory.updated, product.archived, order.created, order.updated, fulfilment.created, fulfilment.updated, refund.created, return.updated, quote.requested, draft.sent, customer.updated, customer.erased, subscription.renewed, subscription.payment_failed, gift_card.issued, review.created, experiment.answered, contract.sent, contract.signed, contract.declined, form.response, support.waiting, deal.created, deal.stage_changed, deal.won, deal.lost, subscriber.subscribed, subscriber.unsubscribed, conversation.ended, conversation.rated, review.published, checkout.abandoned, work_client.created, work_invoice.sent, work_invoice.paid, work_invoice.credited, email.bounced, email.complained, broadcast.sent, marketing.paused, activity.created, activity.done, lead.dismissed, lead.deal_made, domain.failing, domain.recovered, 1 to 40 items | yes |
Answer
| Field | Type | Description |
|---|---|---|
data | object | |
data.id | string (uuid) | |
data.name | string | |
data.hint | string | The address's host, to tell endpoints apart: the address itself is kept encrypted and never answered. |
data.topics | list of string | |
data.enabled | boolean | |
data.disabled_reason | one of failing, owner or null | failing: switched off after three days of failed deliveries. |
data.failing_since | string (date-time) or null | |
data.last_delivery | object or null | |
data.last_delivery.status | one of pending, delivered, failed | |
data.last_delivery.at | string (date-time) | |
data.recent_failures | integer | Deliveries that failed in the last 7 days. |
data.secret | string or null | The signing secret, this once. |
Errors
| Status | Code | When |
|---|---|---|
| 401 | unauthorized | No valid token in Authorization: Bearer kf_…, or one that was revoked. |
| 403 | forbidden | The token does not hold the scope the operation needs, or its owner does not hold the staff permission it needs in the store now (a store that is not open, as in the admin, keeps open only its orders, customers, reports and the owner's own pages such as its webhooks; its products, discounts, website and settings, read or changed, are refused); the message names which. |
| 409 | conflict | Nothing was done: it clashes with how things are now (nothing left to send), or an Idempotency-Key is in use or was used for another request. |
| 422 | invalid | Nothing was done: a body, query or cursor that is not as described, or a check of the screen it goes through; the message says what. |
| 429 | rate_limited | More calls than the budget allows; Retry-After says how many seconds to wait. |
| 500 | failed | Something went wrong on our side; nothing more was done. It is safe to try again. |
Example request
curl
curl -X POST 'https://kaizenaflow.com/api/admin/v1/webhooks' \
-H "Authorization: Bearer $KAIZENA_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name":"Example","url":"https://example.com","topics":["order.paid"]}'JavaScript
const response = await fetch("https://kaizenaflow.com/api/admin/v1/webhooks", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.KAIZENA_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"name": "Example",
"url": "https://example.com",
"topics": [
"order.paid"
]
}),
});
const answer = await response.json();Python
import json
import os
import urllib.request
request = urllib.request.Request(
"https://kaizenaflow.com/api/admin/v1/webhooks",
method="POST",
headers={
"Authorization": "Bearer " + os.environ["KAIZENA_TOKEN"],
"Content-Type": "application/json",
},
data=json.dumps({
"name": "Example",
"url": "https://example.com",
"topics": [
"order.paid",
],
}).encode(),
)
with urllib.request.urlopen(request) as response:
answer = json.load(response)Change a webhook endpoint
PATCH https://kaizenaflow.com/api/admin/v1/webhooks/{id}
Changes its name, address or topics, or switches it on or off.
Operation:
webhooks.updateScope:
webhooks:writeAnswers:
200, the answer underdata.
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string (uuid) | yes | The thing's id in this store. |
Body
JSON, with Content-Type: application/json.
| Field | Type | Required | Description |
|---|---|---|---|
name | string, 1 to 80 characters | no | |
url | string, at most 2,000 characters | no | A new address; the one there stays when left out. |
topics | list of one of order.paid, order.sent, order.cancelled, order.refunded, customer.created, subscription.started, subscription.cancelled, return.requested, withdrawal.received, product.created, product.updated, stock.low, discount.created, inventory.updated, product.archived, order.created, order.updated, fulfilment.created, fulfilment.updated, refund.created, return.updated, quote.requested, draft.sent, customer.updated, customer.erased, subscription.renewed, subscription.payment_failed, gift_card.issued, review.created, experiment.answered, contract.sent, contract.signed, contract.declined, form.response, support.waiting, deal.created, deal.stage_changed, deal.won, deal.lost, subscriber.subscribed, subscriber.unsubscribed, conversation.ended, conversation.rated, review.published, checkout.abandoned, work_client.created, work_invoice.sent, work_invoice.paid, work_invoice.credited, email.bounced, email.complained, broadcast.sent, marketing.paused, activity.created, activity.done, lead.dismissed, lead.deal_made, domain.failing, domain.recovered, 1 to 40 items | no | |
enabled | boolean | no |
Answer
| Field | Type | Description |
|---|---|---|
data | object | |
data.id | string (uuid) | |
data.name | string | |
data.hint | string | The address's host, to tell endpoints apart: the address itself is kept encrypted and never answered. |
data.topics | list of string | |
data.enabled | boolean | |
data.disabled_reason | one of failing, owner or null | failing: switched off after three days of failed deliveries. |
data.failing_since | string (date-time) or null | |
data.last_delivery | object or null | |
data.last_delivery.status | one of pending, delivered, failed | |
data.last_delivery.at | string (date-time) | |
data.recent_failures | integer | Deliveries that failed in the last 7 days. |
Errors
| Status | Code | When |
|---|---|---|
| 401 | unauthorized | No valid token in Authorization: Bearer kf_…, or one that was revoked. |
| 403 | forbidden | The token does not hold the scope the operation needs, or its owner does not hold the staff permission it needs in the store now (a store that is not open, as in the admin, keeps open only its orders, customers, reports and the owner's own pages such as its webhooks; its products, discounts, website and settings, read or changed, are refused); the message names which. |
| 404 | not_found | No such route, or nothing with that id in the token's store (another store's ids are simply not found). |
| 422 | invalid | Nothing was done: a body, query or cursor that is not as described, or a check of the screen it goes through; the message says what. |
| 429 | rate_limited | More calls than the budget allows; Retry-After says how many seconds to wait. |
| 500 | failed | Something went wrong on our side; nothing more was done. It is safe to try again. |
Example request
curl
curl -X PATCH 'https://kaizenaflow.com/api/admin/v1/webhooks/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f' \
-H "Authorization: Bearer $KAIZENA_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name":"Example"}'JavaScript
const response = await fetch("https://kaizenaflow.com/api/admin/v1/webhooks/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f", {
method: "PATCH",
headers: {
Authorization: `Bearer ${process.env.KAIZENA_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"name": "Example"
}),
});
const answer = await response.json();Python
import json
import os
import urllib.request
request = urllib.request.Request(
"https://kaizenaflow.com/api/admin/v1/webhooks/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f",
method="PATCH",
headers={
"Authorization": "Bearer " + os.environ["KAIZENA_TOKEN"],
"Content-Type": "application/json",
},
data=json.dumps({
"name": "Example",
}).encode(),
)
with urllib.request.urlopen(request) as response:
answer = json.load(response)Remove a webhook endpoint
DELETE https://kaizenaflow.com/api/admin/v1/webhooks/{id}
Removes the endpoint; what it still has waiting is not sent.
Operation:
webhooks.deleteScope:
webhooks:writeAnswers:
200, the answer underdata.
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string (uuid) | yes | The thing's id in this store. |
Answer
| Field | Type | Description |
|---|---|---|
data | object | |
data.id | string (uuid) | |
data.deleted | true |
Errors
| Status | Code | When |
|---|---|---|
| 401 | unauthorized | No valid token in Authorization: Bearer kf_…, or one that was revoked. |
| 403 | forbidden | The token does not hold the scope the operation needs, or its owner does not hold the staff permission it needs in the store now (a store that is not open, as in the admin, keeps open only its orders, customers, reports and the owner's own pages such as its webhooks; its products, discounts, website and settings, read or changed, are refused); the message names which. |
| 404 | not_found | No such route, or nothing with that id in the token's store (another store's ids are simply not found). |
| 429 | rate_limited | More calls than the budget allows; Retry-After says how many seconds to wait. |
| 500 | failed | Something went wrong on our side; nothing more was done. It is safe to try again. |
Example request
curl
curl -X DELETE 'https://kaizenaflow.com/api/admin/v1/webhooks/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f' \
-H "Authorization: Bearer $KAIZENA_TOKEN"JavaScript
const response = await fetch("https://kaizenaflow.com/api/admin/v1/webhooks/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f", {
method: "DELETE",
headers: {
Authorization: `Bearer ${process.env.KAIZENA_TOKEN}`,
},
});
const answer = await response.json();Python
import json
import os
import urllib.request
request = urllib.request.Request(
"https://kaizenaflow.com/api/admin/v1/webhooks/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f",
method="DELETE",
headers={
"Authorization": "Bearer " + os.environ["KAIZENA_TOKEN"],
},
)
with urllib.request.urlopen(request) as response:
answer = json.load(response)List an endpoint's deliveries
GET https://kaizenaflow.com/api/admin/v1/webhooks/{id}/deliveries
The endpoint's latest deliveries (kept 30 days), newest first, with how each went.
Operation:
webhooks.deliveriesScope:
webhooks:writeAnswers:
200, the answer underdata.
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string (uuid) | yes | The thing's id in this store. |
Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
limit | integer, 1 to 100 | no | Rows a page holds, at most 100; 50 when left out. A larger number gives 100. |
Answer
| Field | Type | Description |
|---|---|---|
data | list of objects | |
data[].id | string (uuid) | |
data[].topic | string | |
data[].status | one of pending, delivered, failed | |
data[].attempts | integer | |
data[].last_status | integer or null | The receiver's last HTTP status. |
data[].last_error | string or null | |
data[].created_at | string (date-time) | |
data[].next_attempt_at | string (date-time) |
Errors
| Status | Code | When |
|---|---|---|
| 401 | unauthorized | No valid token in Authorization: Bearer kf_…, or one that was revoked. |
| 403 | forbidden | The token does not hold the scope the operation needs, or its owner does not hold the staff permission it needs in the store now (a store that is not open, as in the admin, keeps open only its orders, customers, reports and the owner's own pages such as its webhooks; its products, discounts, website and settings, read or changed, are refused); the message names which. |
| 404 | not_found | No such route, or nothing with that id in the token's store (another store's ids are simply not found). |
| 422 | invalid | Nothing was done: a body, query or cursor that is not as described, or a check of the screen it goes through; the message says what. |
| 429 | rate_limited | More calls than the budget allows; Retry-After says how many seconds to wait. |
| 500 | failed | Something went wrong on our side; nothing more was done. It is safe to try again. |
Example request
curl
curl 'https://kaizenaflow.com/api/admin/v1/webhooks/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f/deliveries' \
-H "Authorization: Bearer $KAIZENA_TOKEN"JavaScript
const response = await fetch("https://kaizenaflow.com/api/admin/v1/webhooks/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f/deliveries", {
headers: {
Authorization: `Bearer ${process.env.KAIZENA_TOKEN}`,
},
});
const answer = await response.json();Python
import json
import os
import urllib.request
request = urllib.request.Request(
"https://kaizenaflow.com/api/admin/v1/webhooks/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f/deliveries",
headers={
"Authorization": "Bearer " + os.environ["KAIZENA_TOKEN"],
},
)
with urllib.request.urlopen(request) as response:
answer = json.load(response)Send a delivery again
POST https://kaizenaflow.com/api/admin/v1/webhooks/{id}/deliveries/{delivery_id}/resend
Sends a delivery that ended (failed or delivered) again, with the same payload and id, to an endpoint that is on.
Operation:
webhooks.resendScope:
webhooks:writeAnswers:
200, the answer underdata.Once only: with an
Idempotency-Keyheader.
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string (uuid) | yes | The thing's id in this store. |
delivery_id | string (uuid) | yes | The delivery. |
Body
JSON, with Content-Type: application/json.
| Field | Type | Required | Description |
|---|---|---|---|
body | object | yes | Nothing: send {} or no body. |
Answer
| Field | Type | Description |
|---|---|---|
data | object | |
data.queued | true |
Errors
| Status | Code | When |
|---|---|---|
| 401 | unauthorized | No valid token in Authorization: Bearer kf_…, or one that was revoked. |
| 403 | forbidden | The token does not hold the scope the operation needs, or its owner does not hold the staff permission it needs in the store now (a store that is not open, as in the admin, keeps open only its orders, customers, reports and the owner's own pages such as its webhooks; its products, discounts, website and settings, read or changed, are refused); the message names which. |
| 404 | not_found | No such route, or nothing with that id in the token's store (another store's ids are simply not found). |
| 409 | conflict | Nothing was done: it clashes with how things are now (nothing left to send), or an Idempotency-Key is in use or was used for another request. |
| 422 | invalid | Nothing was done: a body, query or cursor that is not as described, or a check of the screen it goes through; the message says what. |
| 429 | rate_limited | More calls than the budget allows; Retry-After says how many seconds to wait. |
| 500 | failed | Something went wrong on our side; nothing more was done. It is safe to try again. |
Example request
curl
curl -X POST 'https://kaizenaflow.com/api/admin/v1/webhooks/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f/deliveries/e583bf4d-ab8b-4f0a-b95e-482664f6a6ed/resend' \
-H "Authorization: Bearer $KAIZENA_TOKEN" \
-H "Content-Type: application/json" \
-d '{}'JavaScript
const response = await fetch("https://kaizenaflow.com/api/admin/v1/webhooks/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f/deliveries/e583bf4d-ab8b-4f0a-b95e-482664f6a6ed/resend", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.KAIZENA_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({}),
});
const answer = await response.json();Python
import json
import os
import urllib.request
request = urllib.request.Request(
"https://kaizenaflow.com/api/admin/v1/webhooks/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f/deliveries/e583bf4d-ab8b-4f0a-b95e-482664f6a6ed/resend",
method="POST",
headers={
"Authorization": "Bearer " + os.environ["KAIZENA_TOKEN"],
"Content-Type": "application/json",
},
data=json.dumps({}).encode(),
)
with urllib.request.urlopen(request) as response:
answer = json.load(response)