Files
2026-10-09 19:02:15 +02:00

55 lines
1.0 KiB
Markdown

# `POST /warehouse`
Protected. Requires a valid session cookie (`credentials: 'include'`).
Create warehouse
Creates a new warehouse for the selected company.
Sort order will be automatically appended if omitted.
## Body (JSON)
| Field | Required | Type | Description |
|-------|----------|------|-------------|
| `name` | yes | string | |
| `sort` | no | integer | Optional sort order (defaults to auto-increment) |
```json
{
"name": "…",
"sort": 1
}
```
## Signals
On success, emits SSE signal: `warehouse` (see [`GET /events`](../events.md)).
## Response `201`
Created warehouse
```json
{
"warehouse": {
"id": 1,
"name": "…",
"sort": 1
}
}
```
## Errors
| Status | Description |
|--------|-------------|
| 400 | Invalid input or missing fields — `{"error":"…"}` |
| 401 | Unauthorized — `{"error":"…"}` |
| 403 | Not authorized — `{"error":"…"}` |
| 409 | Warehouse already exists — `{"error":"…"}` |
---
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._