107 lines
2.4 KiB
Markdown
107 lines
2.4 KiB
Markdown
# `POST /quote`
|
|
|
|
Protected. Requires a valid session cookie (`credentials: 'include'`).
|
|
|
|
Create quote
|
|
|
|
Creates a quote with header and lines in one transaction.
|
|
`date` is the document date (valid-until).
|
|
`entityId` must be a company customer (not Lieferanten), or null.
|
|
Each line requires `sku` or `name`, `amount`, `net`, and `taxrate` (rate); `pu` defaults to `1`; `rebate` defaults to `0`.
|
|
|
|
|
|
## Body (JSON)
|
|
|
|
| Field | Required | Type | Description |
|
|
|-------|----------|------|-------------|
|
|
| `number` | yes | string | |
|
|
| `date` | yes | string | Document date / valid-until |
|
|
| `entityId` | no | integer | Customer entity (manifest.entity_id) |
|
|
| `externalNumber` | no | string | External customer reference number (manifest.external_number) |
|
|
| `lines` | yes | ManifestLineInput[] | |
|
|
|
|
```json
|
|
{
|
|
"number": "Q-2026-001",
|
|
"date": "2026-08-31",
|
|
"entityId": 1,
|
|
"lines": [
|
|
{
|
|
"sku": "1",
|
|
"name": "Sample Article",
|
|
"pu": 1,
|
|
"amount": 10,
|
|
"net": 99.5,
|
|
"taxrate": 19
|
|
}
|
|
]
|
|
}
|
|
```
|
|
|
|
## Response `201`
|
|
|
|
Created quote
|
|
|
|
```json
|
|
{
|
|
"quote": {
|
|
"id": 1,
|
|
"number": "…",
|
|
"type": "quote",
|
|
"entityId": 1,
|
|
"externalNumber": "…",
|
|
"date": "2026-08-10T00:00:00.000Z",
|
|
"createdAt": "2026-08-10T00:00:00.000Z",
|
|
"positions": 1,
|
|
"grossTotal": 1,
|
|
"totalQuantity": 1,
|
|
"customerName": "…",
|
|
"lines": [
|
|
{
|
|
"id": 1,
|
|
"sku": "…",
|
|
"name": "…",
|
|
"pu": 1,
|
|
"amount": 1,
|
|
"net": 1,
|
|
"rebate": 1,
|
|
"taxrate": 1,
|
|
"comment": "…",
|
|
"shippable": true
|
|
}
|
|
],
|
|
"files": [
|
|
{
|
|
"id": 1,
|
|
"manifestId": 1,
|
|
"fileId": 1,
|
|
"sort": 1,
|
|
"hash": "…",
|
|
"mimetype": "…",
|
|
"name": "…",
|
|
"size": 1,
|
|
"created": "2026-08-10T00:00:00.000Z",
|
|
"modified": "2026-08-10T00:00:00.000Z",
|
|
"skeledash": "…",
|
|
"thumbx": 1,
|
|
"thumby": 1,
|
|
"meta": {}
|
|
}
|
|
]
|
|
}
|
|
}
|
|
```
|
|
|
|
## Errors
|
|
|
|
| Status | Description |
|
|
|--------|-------------|
|
|
| 400 | Invalid quote, invalid lines, or no company selected — `{"error":"…"}` |
|
|
| 401 | Unauthorized — `{"error":"…"}` |
|
|
| 403 | Not authorized — `{"error":"…"}` |
|
|
| 404 | Company, entity, or article not found — `{"error":"…"}` |
|
|
|
|
---
|
|
|
|
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._
|