Skip to main content

Create Webhook

Creates a webhook. Whenever one of the selected events happens, the store sends a POST request to your URL.

HTTP Request​

  • URL: /webhook/create
  • Method: POST
  • Headers:
    • accessToken: Required. Your API access token.
    • Content-Type: application/json
  • Required scope: READ_WRITE_WEBHOOK

Request Body​

The request body is a JSON object with the following fields:

FieldTypeRequiredDescription
nameStringYesName of the webhook.
urlStringYesURL that receives the webhook requests.
eventsArrayYesEvent codes to subscribe to. See Events.
descriptionStringNoDescription of the webhook.
activeBooleanNoWhether the webhook is active. Default is true.

cURL Example​

curl --location '<BASE_URL>/webhook/create' \
--header 'accessToken: <ACCESS_TOKEN>' \
--header 'Content-Type: application/json' \
--data '{
"name": "ERP order sync",
"url": "https://erp.example.com/hooks/axim",
"description": "Sends new and updated orders to the ERP.",
"events": ["order.create", "order.update", "order.fulfill"],
"active": true
}'

Response​

  • 200 OK: The webhook was created successfully.
  • 400 Bad Request: The access token is missing or invalid, the token does not have the required scope, or a required field is missing.

Sample JSON Response​

{
"success": true,
"message": "WebHook added Successfully",
"data": "66e2b7c1a4f3d2e1c0b9a876"
}

Response Details​

FieldTypeDescription
successBooleanWhether the request was successful.
messageStringConfirmation message.
dataStringID of the new webhook.

Events​

Event CodeTriggered Whendata Contains
product.create, product.update, product.deleteA product is created, updated or deleted in the admin panel.id of the product.
category.create, category.update, category.deleteA category is created, updated or deleted in the admin panel.id of the category.
productGroup.create, productGroup.update, productGroup.deleteA product group is created, updated or deleted.id of the product group.
productFilter.updateA product filter is updated.id of the product filter.
productZone.create, productZone.update, productZone.deleteA product zone is created, updated or deleted.id of the product zone.
review.create, review.update, review.deleteA shopper adds, edits or deletes a product review.The product review.
customer.create, customer.update, customer.deleteA customer is created, updated or deleted.id of the customer (ids for bulk changes), or the customer when the change is made on the storefront.
registrationA shopper registers on the storefront.The customer.
role.create, role.update, role.deleteA customer role is created, updated or deleted.id of the role.
company.create, company.update, company.deleteA company is created, updated or deleted.id of the company (ids for bulk changes), or the company when the change is made on the storefront.
corporate.update, corporate.deleteA corporate account is updated or deleted.id of the corporate account.
companyGroup.create, companyGroup.update, companyGroup.deleteA company group is created, updated or deleted.id of the company group.
salesRep.create, salesRep.update, salesRep.deleteA sales rep is created, updated or deleted.id of the sales rep.
shippingAddress.create, shippingAddress.update, shippingAddress.deleteA shipping address is created, updated or deleted.id of the address, or the address when the change is made on the storefront. When an order's shipping address is changed, id is the order ID.
order.createAn order is placed.id of the order, or the order when it is placed on the storefront.
order.updateAn order is updated or approved.id of the order.
order.fulfillAn order is fulfilled.id of the order.
payment.updateAn order's payment is updated.id of the order.
refund.updateAn order is refunded.id of the order.
invoice.create, invoice.update, invoice.delete, invoice.voidAn invoice is created, updated, deleted or voided.id of the invoice.
quote.create, quote.update, quote.deleteA quote is created, updated or deleted.id of the quote, or the quote when the change is made on the storefront or through the API.
shoppingList.create, shoppingList.update, shoppingList.deleteA shopping list is created, updated or deleted.id of the shopping list, or the shopping list when the change is made on the storefront.
cart.create, cart.update, cart.deleteA shopper's cart is created, updated or deleted.The cart.
webPage.create, webPage.update, webPage.deleteA CMS page is created, updated or deleted.id of the page.
webPageBlock.create, webPageBlock.update, webPageBlock.deleteA CMS block is created, updated or deleted.id of the block.
cmsTemplate.create, cmsTemplate.update, cmsTemplate.deleteA CMS template is created, updated or deleted.id and name of the template.
module.updateA store module's settings are updated.id of the module settings.

Webhook Request​

When an event happens, each active webhook subscribed to it receives a request like this:

  • Method: POST
  • Headers: Content-Type: application/json, plus any authentication headers set up for the webhook in the admin panel (Bearer token, Basic, API key, OAuth 1.0 or OAuth 2.0, and custom headers).
{
"data": { "id": "6703d9a1c2b4e5f6a7b8c9d0" },
"store": "axim-store-1024",
"code": "order.update"
}
FieldTypeDescription
dataObjectDetails of the event. See Events.
storeStringYour store's ID.
codeStringThe event code.

Notes​

  • Respond to webhook requests quickly with a 2xx status code.
  • Use the id in data to fetch the latest details of the record through the API.
  • Authentication for webhook requests is set up in the admin panel.