Create a task and place it in the pool
POST/tasks
Puts a new unit of Pick, Pack, or SLAM work into the pending pool. The task is not assigned to any station at creation time — PULL dispatch (POST /stations/{stationId}/task-claims) is the only way a task becomes claimed, consistent with this service's rule that work is never pushed to a named station in advance. cpt (Critical Pull Time) drives dispatch priority: claimNext always selects the earliest-CPT pending task a station is equipped for.
Idempotent per Idempotency-Key (ADR-0028). Send a caller-chosen Idempotency-Key header on every call. The first request with a given key creates the task; a retry with the same key and the same body replays the stored response verbatim (same status, headers and task id — including a cached 4xx) instead of creating a duplicate. Reusing a key with a different body is rejected with 409 idempotency-key-reused; omitting the header is 400 idempotency-key-required. Postgres is the only runtime, so the check is on in every deployment. Without a repeated key every call creates a new task with a fresh, server-generated id.
Request
Responses
- 201
- 400
- 409
- 422
- 500
Task created and placed in the pending pool (or, on a retry with a repeated Idempotency-Key and identical body, the original response replayed).
Response Headers
Present, with the value true, ONLY when this answer is the stored replay of an earlier request that used the same Idempotency-Key (the handler did not run again). The first execution never carries it.
Path of the newly created task, e.g. /tasks/{id}.
The Idempotency-Key header is missing (idempotency-key-required), or the request body is malformed JSON, a required field is missing or empty, or a field value is invalid (e.g. a task type outside the TaskType enum) (invalid-request).
The Idempotency-Key was already used with a different method, path or body (idempotency-key-reused). Use a new key for a genuinely different request. Distinguished from a business conflict by the problem type.
invalid-deadline when cpt is present but the zero time (0001-01-01T00:00:00Z): a valid date-time, but no task can be due at the zero instant. An absent cpt is a 400.
An unexpected server-side failure (e.g. a repository or event-publisher error).