## Record an order from snapshots (tenant:trade:sales:write)

`POST /api/trade/v1/orders`

Module: Trade · operationId: `createIssuedOrder` · Tag: Issued documents · Auth: access token (`Authorization: Bearer <accessToken>`)

Stores an `ORDER` with status `open`. Publishes `trade.order.created`.

### Request body

`application/json` (required)

- `addressId` (string (uuid)): Masterdata address of the customer.
- `addressSnapshot` (AddressSnapshot): Frozen copy of the partner address (GoBD).
- `articleSnapshots` (array of object): Lines as sent. Recognised keys: `articleNumber`, `name`, `description`, `quantity` (default 1), `unit`, `unitPriceNet` (or `price`), `discountPercent`, `taxRate`; the entry is kept as sent.
- `orderNumber` (string): Number of the order.

Example:

```json
{
  "addressId": "3c5e7a91-2b4d-4f6a-8c1e-5d7f9a0b1c05",
  "addressSnapshot": {
    "city": "Neutraubling",
    "companyName": "Donau Maschinenbau AG",
    "country": "DE",
    "street": "Werkstraße 100",
    "zip": "93073"
  },
  "articleSnapshots": [
    {
      "articleNumber": "HW-1002",
      "name": "Notebook EliteBook 860 G11, i7, 32 GB, 1 TB SSD",
      "quantity": 4,
      "taxRate": 19,
      "unitPriceNet": 1699
    },
    {
      "articleNumber": "HW-1004",
      "name": "USB-C Dockingstation 100 W",
      "quantity": 4,
      "taxRate": 19,
      "unitPriceNet": 189
    }
  ],
  "orderNumber": "AB-2026-0144"
}
```

### Responses

- **201** Recorded (`application/json`)
- **400** Error (`application/json`)
- **401** No valid session or bearer token (no body).

Fields of the 201 answer:

- `addressId` (string): Masterdata address of the customer.
- `addressSnapshot` (AddressSnapshot): Frozen copy of the partner address (GoBD).
- `articleSnapshots` (array of object): Lines as sent. Recognised keys: `articleNumber`, `name`, `description`, `quantity` (default 1), `unit`, `unitPriceNet` (or `price`), `discountPercent`, `taxRate`; the entry is kept as sent.
- `createdAt` (string (date-time)): When the order was created.
- `customerNo` (string): Customer number of the tenant.
- `id` (string (uuid)): Id of the order.
- `orderNumber` (string): Number of the order.
- `status` (string): Status of the order.
- `tenantName` (string): Name of the tenant.

Example 201 answer:

```json
{
  "addressId": "3c5e7a91-2b4d-4f6a-8c1e-5d7f9a0b1c05",
  "addressSnapshot": {
    "city": "Neutraubling",
    "companyName": "Donau Maschinenbau AG",
    "country": "DE",
    "street": "Werkstraße 100",
    "zip": "93073"
  },
  "articleSnapshots": [
    {
      "articleNumber": "HW-1002",
      "name": "Notebook EliteBook 860 G11, i7, 32 GB, 1 TB SSD",
      "quantity": 4,
      "taxRate": 19,
      "unitPriceNet": 1699
    },
    {
      "articleNumber": "HW-1004",
      "name": "USB-C Dockingstation 100 W",
      "quantity": 4,
      "taxRate": 19,
      "unitPriceNet": 189
    }
  ],
  "createdAt": "2026-11-19T08:10:00Z",
  "customerNo": "99999",
  "id": "6d9e0f1a-2b3c-4d4e-8f5a-7b8c9d0e1f03",
  "orderNumber": "AB-2026-0144",
  "status": "open",
  "tenantName": "DEMO"
}
```

### Example request

```bash
curl -X POST 'https://api.mbcom.cloud/api/trade/v1/orders' \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H 'Content-Type: application/json' \
  --data '{"addressId":"3c5e7a91-2b4d-4f6a-8c1e-5d7f9a0b1c05","addressSnapshot":{"city":"Neutraubling","companyName":"Donau Maschinenbau AG","country":"DE","street":"Werkstraße 100","zip":"93073"},"articleSnapshots":[{"articleNumber":"HW-1002","name":"Notebook EliteBook 860 G11, i7, 32 GB, 1 TB SSD","quantity":4,"taxRate":19,"unitPriceNet":1699},{"articleNumber":"HW-1004","name":"USB-C Dockingstation 100 W","quantity":4,"taxRate":19,"unitPriceNet":189}],"orderNumber":"AB-2026-0144"}'
```
