---
title: Product Stock Availability Changed
slug: devdocs/product-stock-availability-changed
docTags: 
createdAt: 2026-10-16T12:03:51.096Z
---

Products become available or unavailable at a location.

## Set the webhook (sandbox)

Send this mutation with your `urlPath`. Expressoft then sends a message to `urlPath` each time products become available or unavailable in the location with `locationKey`.

**Query**

```graphql
mutation ProductStockAvailabilityChanged($urlPath: String!, $locationKey: Guid!) {
  miscellaneous {
    webHooks {
      post_ProductStockAvailabilityChanged (
        payload: {
          urlPath:$urlPath
          locationKey: $locationKey
          availableProducts: []
          unavailableProducts: []
        }
      )
    }
  }
}
```

**Variables**

```json
{
  "urlPath": "<your callback URL>",
  "locationKey": "<locationKey>"
}
```

**cURL**

```bash
curl --location 'https://sandbox.expressoft.eu/connect/api/interopgql' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <token>' \
--data '{"query": "mutation ProductStockAvailabilityChanged($urlPath: String!, $locationKey: Guid!) { miscellaneous { webHooks { post_ProductStockAvailabilityChanged ( payload: { urlPath:$urlPath locationKey: $locationKey availableProducts: [] unavailableProducts: [] } ) } } }", "variables": {"urlPath": "<your callback URL>", "locationKey": "<locationKey>"}}'
```

**Response**

```json
{
  "data": {
    "miscellaneous": {
      "webHooks": {
        "post_ProductStockAvailabilityChanged": "<string>"
      }
    }
  }
}
```

The mutation returns a `String` (the type is confirmed by the schema). Your callback URL is called later, when the event happens.

## Payload sent to your URL

Expressoft sends a `POST` request with this JSON body:

```json
{
  "available_products": [
    "00000000-0000-0000-0000-000000000081"
  ],
  "unavailable_products": [
    "00000000-0000-0000-0000-000000000071",
    "00000000-0000-0000-0000-000000000072"
  ],
  "location_key": "00000000-0000-0000-0000-000000000051"
}
```

| Field                  | Type                  | Description                                                                    |
| ---------------------- | --------------------- | ------------------------------------------------------------------------------ |
| `available_products`   | array of GUID or null | The keys of the products that became available. `null` when nothing changed.   |
| `unavailable_products` | array of GUID or null | The keys of the products that became unavailable. `null` when nothing changed. |
| `location_key`         | GUID                  | The `publicKey` of the location.                                               |

:::BlockQuote
ℹ️ **INFO**
The mutation requires both `availableProducts` and `unavailableProducts`. Send an empty list when no product changed in that direction.
:::

:::BlockQuote
ℹ️ **INFO**
In production, Expressoft configures this webhook for you. Contact `support@expressoft.ro`.
:::
