Files
dashback/docs/api/routes/delivery/create.md
2026-09-30 19:29:13 +02:00

3.0 KiB

POST /delivery

Protected. Requires a valid session cookie (credentials: 'include').

Create delivery

Creates a goods receipt with header and lines in one transaction. The manifest number is allocated automatically via nextNumber('delivery'); the user-supplied reference is stored as externalNumber. 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
externalNumber yes string User-supplied reference number
date yes string
supplierId no integer
lines yes DeliveryLineInput[]
files no DeliveryFileInput[] Attached documents (pdf or txt) stored with the delivery and returned in files on every delivery response. Thumbnails (AVIF) are generated server-side.
{
  "externalNumber": "DHL-123",
  "date": "2026-08-10",
  "supplierId": 1,
  "lines": [
    {
      "sku": "1",
      "name": "Sample Article",
      "pu": 1,
      "amount": 10,
      "net": 99.5,
      "taxrate": 19
    }
  ],
  "files": [
    {
      "mimetype": "application/pdf",
      "name": "delivery-note.pdf",
      "content": "<base64 encoded content>"
    }
  ]
}

Body (multipart/form-data)

Field Required Type Description
data yes string JSON string containing manifest header and line items ({ externalNumber, date, supplierId, lines, filesMeta? }).
files no file Raw binary PDF or text files attached natively via standard HTTP multipart upload.

Response 201

Created delivery

{
  "delivery": {
    "id": 1,
    "number": "…",
    "type": "delivery",
    "supplierId": 1,
    "externalNumber": "…",
    "date": "2026-08-10T00:00:00.000Z",
    "createdAt": "2026-08-10T00:00:00.000Z",
    "ledger": {
      "totalPositions": 1,
      "completelyOnLedgerPositions": 1
    },
    "lines": [
      {
        "id": 1,
        "sku": "…",
        "name": "…",
        "pu": 1,
        "amount": 1,
        "net": 1,
        "rebate": 1,
        "taxrate": 1,
        "comment": "…"
      }
    ],
    "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",
        "thumbavif": "…",
        "thumbx": 1,
        "thumby": 1,
        "meta": {}
      }
    ]
  }
}

Errors

Status Description
400 Invalid delivery, invalid lines or files, or no company selected — {"error":"…"}
401 Unauthorized — {"error":"…"}
403 Not authorized — {"error":"…"}
404 Company or supplier not found — {"error":"…"}

Generated from @openapi JSDoc. Do not edit by hand — run npm run docs:api.