> For the complete documentation index, see [llms.txt](https://docs.flowretail.com/api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.flowretail.com/api/introduction/webhooks.md).

# Webhooks

Flow Retail can send webhooks to your system when specific events occur, allowing you to process updates in real time — for example when an order is settled, a product is updated, or stock changes.

## How webhooks are delivered

* **Event triggered** → Flow Retail sends an \`HTTP POST\` request to your registered webhook endpoint.
* **Timeout** → If your endpoint does not respond within **10 seconds**, we consider it a timeout.
* **Retries** → On timeout or \`5xx\` response, Flow Retail retries the webhook up to **10 times** with exponential backoff.
* **No retries on 4xx** → Any \`4xx\` status code (including \`429\`) marks the webhook as failed and **will not** be retried.

## Status codes — quick reference

| Status                  | When to use                                          | Will retry? |
| ----------------------- | ---------------------------------------------------- | ----------- |
| `200 OK`                | Event processed successfully                         | **No**      |
| `202 Accepted`          | Event accepted for asynchronous processing           | **No**      |
| `400 Bad Request`       | Invalid payload (validation error, etc.)             | **No**      |
| `401/403`               | Invalid or missing authentication                    | **No**      |
| `404`                   | Endpoint not found / wrong route                     | **No**      |
| `429 Too Many Requests` | Temporary overload — not ready to receive more calls | **No**      |
| `5xx`                   | Temporary server error                               | **Yes**     |
| Timeout > 10s           | No response within 10 seconds                        | **Yes**     |

## All available webhooks

Below is the full list of webhook `action` values you can subscribe to.

<table><thead><tr><th width="286.046875">Action</th><th>Description</th></tr></thead><tbody><tr><td><code>PRODUCT_CREATE</code></td><td>A new product was created</td></tr><tr><td><code>PRODUCT_UPDATE</code></td><td>An existing product was updated</td></tr><tr><td><code>PRODUCT_DELETE</code></td><td>A product was deleted</td></tr><tr><td><code>CUSTOMER_CREATE</code></td><td>A new customer was created</td></tr><tr><td><code>CUSTOMER_UPDATE</code></td><td>An existing customer was updated</td></tr><tr><td><code>CUSTOMER_DELETE</code></td><td>A customer was deleted</td></tr><tr><td><code>ORDER_SETTLED</code></td><td>A new order was settled (fully paid)</td></tr><tr><td><code>ORDER_RECEIPT_SETTLED</code></td><td>A receipt was settled</td></tr><tr><td><code>ORDER_DELIVERED</code></td><td>An existing order was delivered in full</td></tr><tr><td><code>ORDER_HANDLING_STATE_CHANGED</code></td><td>An order handling state was changed</td></tr><tr><td><code>TILL_CLOSED</code></td><td>A till was counted and closed</td></tr><tr><td><code>TILL_OPEN</code></td><td>A till was opened</td></tr><tr><td><code>PRICE_CREATE</code></td><td>A new price was created</td></tr><tr><td><code>PRICE_UPDATE</code></td><td>A price was updated</td></tr><tr><td><code>PRICE_DELETE</code></td><td>A price was deleted</td></tr><tr><td><code>STOCK_CHANGE</code></td><td>Stock changed for a product in a specific warehouse</td></tr><tr><td><code>PRODUCT_MEDIA_CHANGE</code></td><td>Product media was created, updated, or deleted</td></tr><tr><td><code>PURCHASE_RECEIVED</code></td><td>A purchase order was fully received</td></tr></tbody></table>

## Response examples

Flow Retail sends a webhook as an `HTTP POST` and waits up to **10 seconds** for a response.

Your endpoint should return the appropriate HTTP status code depending on whether you successfully received and processed the event.

#### The table below shows how Flow Retail interprets your response:

<table><thead><tr><th width="183.21484375">Response</th><th width="420.6171875">Meaning</th><th>Retries?</th></tr></thead><tbody><tr><td><code>200 OK</code></td><td>Event processed successfully — remove it from the queue</td><td>No</td></tr><tr><td><code>202 Accepted</code></td><td>Event accepted for async processing — remove it from the queue</td><td>No</td></tr><tr><td>Any <code>4xx</code></td><td>Permanent error (invalid payload, auth error, etc.) — remove it from the queue</td><td>No</td></tr><tr><td><code>5xx</code></td><td>Temporary server error — retry later</td><td>Yes</td></tr><tr><td>Timeout > 10s</td><td>No response within 10 seconds — retry later</td><td>Yes</td></tr></tbody></table>

#### 200 OK — synchronous processing

```http
HTTP/1.1 200 OK
Content-Type: application/json

{"status":"ok"}
```

#### 202 Accepted — asynchronous processing

```http
HTTP/1.1 202 Accepted
Content-Type: application/json

{"status":"queued"}
```

#### 400 Bad Request — do not retry

```http
HTTP/1.1 400 Bad Request
Content-Type: application/json

{"error":"invalid payload format"}
```

#### 500 Internal Server Error — retry

```http
HTTP/1.1 500 Internal Server Error
Content-Type: application/json

{"error":"temporary failure"}
```

## Example webhook payloads

All payloads are sent as application/json in the request body.

Fields may be added over time — always parse only what you need.

### PRODUCT\_CREATE

```json
{
  "action": "PRODUCT_CREATE",
  "occurredAt": "2025-08-15T07:32:41Z",
  "attempt": 1,
  "tenant": {
    "id": 7,
    "uid": "7"
  },
  "product": {
    "id": 123,
    "uid": "PRD-123",
    "sku": "KF100",
    "name": "Kos Sweater",
    "active": true
  }
}
```

### ORDER\_SETTLED

```json
{
  "action": "ORDER_SETTLED",
  "occurredAt": "2025-08-15T07:34:12Z",
  "attempt": 1,
  "tenant": {
    "id": 7,
    "uid": "7"
  },
  "store": {
    "id": 1,
    "uid": "70"
  },
  "order": {
    "id": 7123,
    "uid": "700",
    "orderNumber": "100045",
    "status": "SETTLED",
    "totals": {
      "gross": 129900,
      "net": 103920,
      "vat": 25980,
      "currency": "NOK"
    }
  }
}
```

### STOCK\_CHANGE

```json
{
  "action": "STOCK_CHANGE",
  "occurredAt": "2025-08-15T07:36:05Z",
  "attempt": 1,
  "tenant": {
    "id": 7,
    "uid": "7"
  },
  "warehouse": {
    "id": 12,
    "uid": "WH-01"
  },
  "product": {
    "id": 123,
    "uid": "PRD-123",
    "sku": "KF100"
  },
  "quantityChange": -2,
  "quantityAfter": 8
}
```

## Best practices for webhook receivers

* **Respond fast** — Do not do heavy processing inside the webhook handler; enqueue work instead.
* **Idempotency** — Make sure your processing logic can handle duplicate events.
* **Logging** — Log incoming webhooks for troubleshooting.
* **Security** — Verify the request is from Flow Retail (via IP allowlisting or signing).
* **Error handling** — Return a 5xx if you want Flow Retail to retry.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.flowretail.com/api/introduction/webhooks.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
