> ## Documentation Index
> Fetch the complete documentation index at: https://developer.comstruct.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Dispatch supplier order

> JSON webhook comstruct posts when an API order is sent to a supplier

## Overview

When a customer dispatches an order to a supplier API, comstruct-logic `POST`s the JSON below to the supplier's `https://` URL. This is not a call to `api.comstruct.com`, and comstruct does not send an `x-api-key`.

The order contact must be **exactly one** `https://` URL. An email address on the same contact sends the order by email instead.

> [!NOTE]
>
> `context.status` is the status before this dispatch. Read the resulting status from `change_type`. After a successful response, `PLACE_ORDER` and `EDIT_ORDER` become `ORDERED`, and `CANCEL_ORDER` becomes `CANCELLED`.

## When the webhook is sent

| `change_type` | Meaning | `changes` |
| - | - | - |
| `PLACE_ORDER` | New order | Empty object `{}` |
| `EDIT_ORDER` | The customer changed fields | Only the fields that changed |
| `CANCEL_ORDER` | Cancellation | Empty object `{}` |

`COMPLETE_ORDER` (goods received on site) is not sent to the supplier API.

## Headers

| Header | Value |
| - | - |
| `Content-Type` | `application/json` |
| `Accept` | `application/json` |

## Fields

| Field | Type | Description |
| - | - | - |
| `order_id` | `uuid` | Order id in comstruct |
| `supplier_order_number` | `string` or `null` | Supplier order number already stored, if any |
| `change_type` | `string` | `PLACE_ORDER`, `EDIT_ORDER`, or `CANCEL_ORDER` |
| `comment` | `string` | Not set on API dispatch. The stored order comment is `context.comment` |
| `context` | `object` | Order snapshot, see below |
| `changes` | `object` | Edits for `EDIT_ORDER`, otherwise `{}` |
| `attachments` | `array` | Specification files as base64. Omitted when the order has none |

### `context`

| Field | Type | Description |
| - | - | - |
| `project` | `object` | `id`, `title`, `project_number`, `region`, `address` (`address`, `zip`, `city`) |
| `supplier` | `object` | `id`, `title` |
| `customer` | `object` | `id`, `title`, `features` (informational feature flags — do not depend on flag names) |
| `status` | `string` | Status before dispatch |
| `user` | `object` | Sender: `id`, `email`, `name`, `phone` |
| `comment` | `string` or `null` | Stored order comment |
| `items` | `array` | Line items. `type` is normalized |
| `properties` | `object` | Extra fields such as `delivery_location`, `vehicle_type`, `concrete_type`, `mobile_crane_required` |
| `planned_delivery_time` | `string` | `Europe/Berlin` local time, `YYYY-MM-DDTHH:mm`, no offset |
| `orders_components` | `array` | Components with `project_component.title` and `project_component.type` |
| `order_component_description` | `string` | Component titles, comma-separated |
| `contract_number` | `string` | Linked contract / purchase-order number |

### Line item (`items[]` and `changes.items[]`)

| Field | Type | Description |
| - | - | - |
| `title` | `string` | Title |
| `quantity` | `number` | Quantity |
| `unit` | `string` | Unit (`m3`, `t`, `kg`, `stk`, `h`, `pau`, …) |
| `description` | `string` | Longer description |
| `product_number` | `string` | Product number |
| `type` | `string` | Normalized type, for example `CONCRETE`, `EARTH_MATERIALS`, `STEEL_REINFORCEMENT`, `WASTE_REMOVAL`, `UNKNOWN` |
| `delivery_date` | `string` | Line-level delivery date, when it differs |
| `marked` | `boolean` | Line item has been checked |

Older type keys are rewritten before send, including `REINFORCEMENT` → `STEEL_REINFORCEMENT` and `BULK_GOODS` → `EARTH_MATERIALS`.

### Attachments (`attachments[]`)

| Field | Type | Description |
| - | - | - |
| `name` | `string` | File name, for example `Spezifikation_EL-100A.pdf`, `Anhang_EL-100A.pdf`, or `EL-100A.abs` |
| `content` | `string` | Base64-encoded file |
| `type` | `string` | MIME type. Omitted for PDF; `text/plain` for `.abs` |
| `specification` | `object` | List metadata: `id`, `specification_number`, `version`, `title`, `product_type`, `positions`, `weight`, `weight_unit`, `status` |

### `changes` (`EDIT_ORDER` only)

| Field | Type | Description |
| - | - | - |
| `supplier_order_number` | `string` | New supplier order number |
| `planned_delivery_time` | `string` | New delivery time, same Berlin format as `context` |
| `comment` | `string` | New stored order comment |
| `properties` | `object` | Changed extra fields |
| `items` | `array` | Replaces the line-item list |

## Response

Reply with JSON. comstruct does **not** check the HTTP status.

| Field | Type | Description |
| - | - | - |
| `success` | `boolean` | `true` accepts the order. Any other value leaves the order unchanged |
| `message` | `string` | Shown to the user when `success` is not `true` |
| `supplier_order_number` | `string` | Stored as the supplier order number when `success` is `true` |

```json theme={null}
{
  "success": true,
  "message": "Order accepted",
  "supplier_order_number": "SUP-2026-0001"
}
```

> [!NOTE]
>
> When a contact has email addresses and one extra `https://` URL, that URL receives the same shape as a copy of the email. There, `context` already includes the new status and the applied field changes, and `comment` can carry the action note. HTTP 2xx counts as success. `supplier_order_number` is stored only when `success` is not `false` and the number is a non-empty string.

The return path — supplier confirm, decline, and edit — is [Update supplier order](https://developer.comstruct.com/en/api-reference/supplier-orders-patch.md).


## OpenAPI

````yaml api-reference/supplier-order-dispatch.openapi.yaml webhook supplierOrderDispatch
openapi: 3.1.0
info:
  title: comstruct supplier order dispatch
  description: >
    Outbound webhook that comstruct posts when a customer dispatches an order to
    a supplier API endpoint.

    The request is sent by comstruct-logic to the supplier's HTTPS URL. It is
    not a call to `api.comstruct.com`.
  version: 1.0.0
  license:
    name: Proprietary
    url: https://comstruct.com
  contact:
    name: comstruct ICT GmbH
    url: https://comstruct.com
    email: support@comstruct.com
servers:
  - url: https://orders.supplier.invalid/orders
    description: >
      Platzhalter. comstruct sendet den Webhook an die https-URL, die als
      Bestelladresse des Lieferanten hinterlegt ist.
security: []
paths: {}

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.