Skip to content

inventory.updated ​

Type: Webhook
Method: POST

Tags: Catalog

Summary ​

Inventory updated

Description ​

Fires when stock changes: stock in or out, a reset, a manual adjustment, a reservation when an order is placed, a reduction when a shipment is created, a restore on cancellation, a released reservation, and a sync from the inventory provider.

TypeScript Definition ​

typescript
"inventory-updated": {
        parameters: {
            query?: never;
            header: {
                /** @description Event name; equals the body `event`. */
                "X-CE-Event": components["parameters"]["WebhookEventHeader"];
                /** @description `sha256=` followed by the hex HMAC-SHA256 of the raw request body, keyed with the webhook secret. Verify with a constant-time comparison before processing. */
                "X-CE-Signature": components["parameters"]["WebhookSignatureHeader"];
                /** @description Equals the body `event_id`. Stable across retries — use as the idempotency key. */
                "X-CE-Event-ID": components["parameters"]["WebhookEventIdHeader"];
                /** @description Equals the body `delivery_id`. Unique per delivery attempt. */
                "X-CE-Delivery-ID": components["parameters"]["WebhookDeliveryIdHeader"];
            };
            path?: never;
            cookie?: never;
        };
        requestBody: {
            content: {
                "application/json": components["schemas"]["WebhookEnvelope"] & {
                    /** @enum {string} */
                    event?: "inventory.updated";
                    payload?: {
                        /** @enum {string} */
                        event?: "inventory.updated";
                        /** @description The item's stock after the change, with what the change did to it (`activities`). An item with stock settings carries them, a line per warehouse and batch and its marketplace listings, as the inventory API returns them; an item without stock settings, and a marketplace store's item, carries its quantities summed. */
                        properties?: ({
                            /** @description The item's listings on the marketplaces the store sells through. */
                            marketplace_listing: components["schemas"]["ItemMarketplaceListing"][];
                            /** @description What the change did to the stock, each activity once, in order. */
                            activities: components["schemas"]["StockActivity"][];
                        } & WithRequired<components["schemas"]["ProductInventory"], "product_id" | "product_name" | "variant_id" | "variant_name" | "track_quantity" | "allow_backorder" | "track_lot_batch" | "low_stock_threshold" | "stock_available" | "stock">) | components["schemas"]["ItemStockTotals"];
                        product_id: string;
                        /** @description The variant, when the stock is a variant's. */
                        variant_id?: string;
                    };
                };
            };
        };
        responses: {
            200: components["responses"]["WebhookAccepted"];
            400: components["responses"]["BadRequest"];
            401: components["responses"]["Unauthorized"];
            410: components["responses"]["WebhookGone"];
            "2XX": components["responses"]["WebhookAccepted"];
            "5XX": components["responses"]["WebhookServerError"];
        };
    };

Component References ​

ReferenceResolves To
components["parameters"]["WebhookEventHeader"]WebhookEventHeader
components["parameters"]["WebhookSignatureHeader"]WebhookSignatureHeader
components["parameters"]["WebhookEventIdHeader"]WebhookEventIdHeader
components["parameters"]["WebhookDeliveryIdHeader"]WebhookDeliveryIdHeader
components["schemas"]["WebhookEnvelope"]WebhookEnvelope
components["schemas"]["ItemMarketplaceListing"]ItemMarketplaceListing
components["schemas"]["StockActivity"]StockActivity
components["schemas"]["ProductInventory"]ProductInventory
components["schemas"]["ItemStockTotals"]ItemStockTotals
components["responses"]["WebhookAccepted"]WebhookAccepted
components["responses"]["BadRequest"]BadRequest
components["responses"]["Unauthorized"]Unauthorized
components["responses"]["WebhookGone"]WebhookGone
components["responses"]["WebhookServerError"]WebhookServerError

Webhook Payload ​

Content Types: application/json

Expected Responses ​

200 ​

400 ​

Bad request

401 ​

Not authorized for given operation on the Resource

410 ​

2XX ​

5XX ​

OpenAPI Definition ​

json
{
  "tags": [
    "Catalog"
  ],
  "operationId": "inventory-updated",
  "summary": "Inventory updated",
  "description": "Fires when stock changes: stock in or out, a reset, a manual adjustment, a reservation when an order is placed, a reduction when a shipment is created, a restore on cancellation, a released reservation, and a sync from the inventory provider.",
  "parameters": [
    {
      "$ref": "#/components/parameters/WebhookEventHeader"
    },
    {
      "$ref": "#/components/parameters/WebhookSignatureHeader"
    },
    {
      "$ref": "#/components/parameters/WebhookEventIdHeader"
    },
    {
      "$ref": "#/components/parameters/WebhookDeliveryIdHeader"
    }
  ],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "allOf": [
            {
              "$ref": "#/components/schemas/WebhookEnvelope"
            },
            {
              "type": "object",
              "properties": {
                "event": {
                  "type": "string",
                  "enum": [
                    "inventory.updated"
                  ]
                },
                "payload": {
                  "type": "object",
                  "properties": {
                    "event": {
                      "type": "string",
                      "enum": [
                        "inventory.updated"
                      ]
                    },
                    "properties": {
                      "description": "The item's stock after the change, with what the change did to it (`activities`). An item with stock settings carries them, a line per warehouse and batch and its marketplace listings, as the inventory API returns them; an item without stock settings, and a marketplace store's item, carries its quantities summed.",
                      "oneOf": [
                        {
                          "title": "ItemStockWithSettings",
                          "allOf": [
                            {
                              "$ref": "#/components/schemas/ProductInventory"
                            }
                          ],
                          "type": "object",
                          "properties": {
                            "marketplace_listing": {
                              "description": "The item's listings on the marketplaces the store sells through.",
                              "type": "array",
                              "items": {
                                "$ref": "#/components/schemas/ItemMarketplaceListing"
                              }
                            },
                            "activities": {
                              "description": "What the change did to the stock, each activity once, in order.",
                              "type": "array",
                              "items": {
                                "$ref": "#/components/schemas/StockActivity"
                              }
                            }
                          },
                          "required": [
                            "product_id",
                            "product_name",
                            "variant_id",
                            "variant_name",
                            "track_quantity",
                            "allow_backorder",
                            "track_lot_batch",
                            "low_stock_threshold",
                            "stock_available",
                            "stock",
                            "marketplace_listing",
                            "activities"
                          ]
                        },
                        {
                          "$ref": "#/components/schemas/ItemStockTotals"
                        }
                      ]
                    },
                    "product_id": {
                      "type": "string"
                    },
                    "variant_id": {
                      "description": "The variant, when the stock is a variant's.",
                      "type": "string"
                    }
                  },
                  "required": [
                    "product_id"
                  ]
                }
              }
            }
          ]
        }
      }
    }
  },
  "responses": {
    "200": {
      "$ref": "#/components/responses/WebhookAccepted"
    },
    "400": {
      "$ref": "#/components/responses/BadRequest"
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    },
    "410": {
      "$ref": "#/components/responses/WebhookGone"
    },
    "2XX": {
      "$ref": "#/components/responses/WebhookAccepted"
    },
    "5XX": {
      "$ref": "#/components/responses/WebhookServerError"
    }
  }
}

Auto-generated from OpenAPI spec and TypeScript definitions

Last updated: