openapi: 3.0.3 info: title: Pick-Face Replenishment API version: 1.0.0 description: | The WMS-tier owner of forward pick-face replenishment in the warehouse-systems platform (ADR 0001, ADR 0002). It watches the stock level of every forward pick face against an explicit **min/max policy** per site and SKU, and when the projected level reaches the minimum it raises a **replenishment request**: move a quantity of the SKU from a reserve bin to the forward bin, never more than the policy maximum. Policy `MIN_MAX` is the only v1 policy; the source bin policy is `fullest-reserve-bin-v1` (the reserve bin of the same site with the most usable stock). This service moves no stock and creates no floor work. A request is published as `ReplenishmentRequested`; wes-work-planning plans it as `REPLENISH` work, fulfillment-execution runs it with an operator and inventory-storage records the relocation (reason `REPLENISHMENT`). The resulting `StockRelocated` comes back and completes the request. A request is cancelled when the operator says so, when a newer approved slot plan no longer assigns the SKU to that forward bin, or when its policy is removed. Stock levels, forward assignments and locations are read from local copies fed by events (ADR 0003); this API never calls a sibling context. Events are published as CloudEvents on `warehouse.pick-face-replenishment.events` through a transactional outbox (see `apis/asyncapi.yaml`). Errors are RFC 7807 problem documents with `type = https://errors.pick-face-replenishment.warehouse-systems.dev/`. There is no authentication layer (fleet decision 2026-09-11). contact: name: pick-face-replenishment maintainers url: https://github.com/IQVO/pick-face-replenishment license: name: UNLICENSED servers: - url: http://localhost:8080 description: Local development - url: http://localhost:8000/api/pick-face-replenishment description: Local kind cluster through Kong tags: - name: Policies description: Declare, read and remove the min/max policy of a site and SKU. - name: Pick faces description: The replenishment status of every forward pick face. - name: Replenishments description: Replenishment requests, raised by detection or by an operator. - name: Sites description: Site-wide commands. - name: Reports description: | The analytics read side (ADR 0008), served read-only by the separate pfr-reports binary (Service `-reports`). - name: Health description: Liveness and readiness probes. paths: /policies: get: operationId: listPolicies summary: List replenishment policies description: | Lists the declared policies ordered by site and SKU, a page at a time. `cursor` is the opaque `nextCursor` of the previous page; a response without `nextCursor` is the last page. `siteId` and `sku` narrow the list. `limit` and `cursor` are single-valued; an empty or repeated `limit`, a repeated `cursor` and any undeclared query parameter are 400. tags: [Policies] parameters: - $ref: "#/components/parameters/Limit" - $ref: "#/components/parameters/Cursor" - name: siteId in: query description: Only policies of this site. schema: type: string - name: sku in: query description: Only policies of this SKU. schema: type: string responses: "200": description: One page of policies. content: application/json: schema: $ref: "#/components/schemas/PolicyPage" example: items: - siteId: SITE-1 sku: SKU-1 minQty: 10 maxQty: 60 multiple: 6 source: DECLARED stale: false version: 2 declaredAt: "2026-10-17T09:00:00Z" nextCursor: U0lURS0xL1NLVS0x "400": $ref: "#/components/responses/BadRequest" "500": $ref: "#/components/responses/InternalError" /policies/{siteId}/{sku}: parameters: - $ref: "#/components/parameters/SiteId" - $ref: "#/components/parameters/Sku" put: operationId: declarePolicy summary: Declare or change a replenishment policy description: | Declares the `MIN_MAX` policy of a site and SKU. Without `If-Match` it creates the policy at version 1 and answers 409 `policy-already-exists` when one exists. With `If-Match: ` it replaces the policy only when that is the current version (the new version is current + 1); a stale value is a 409 `concurrent-modification`. The values must satisfy `0 <= minQty < maxQty` and `multiple >= 1` (`multiple` defaults to 1). A request quantity is always rounded down to a multiple of `multiple`. With `source: PACK_DERIVED` the multiple is not sent: it is taken from the SKU's active CASE pack level (units per case) in the local copy of product-master's pack levels, and re-derived when that level is superseded; a SKU with no active CASE level is a 422 `no-active-case-level`. Publishes `ReplenishmentPolicyDeclared` on the analytics topic. The response carries the new version as `ETag`. tags: [Policies] parameters: - $ref: "#/components/parameters/IfMatch" requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/DeclarePolicyRequest" example: minQty: 10 maxQty: 60 multiple: 6 responses: "200": description: The policy is declared (created at version 1, or replaced). headers: ETag: description: The policy version after this change. schema: type: string content: application/json: schema: $ref: "#/components/schemas/Policy" example: siteId: SITE-1 sku: SKU-1 minQty: 10 maxQty: 60 multiple: 6 source: DECLARED stale: false version: 1 declaredAt: "2026-10-17T09:00:00Z" "400": $ref: "#/components/responses/BadRequest" "409": $ref: "#/components/responses/Conflict" "422": $ref: "#/components/responses/UnprocessableEntity" "500": $ref: "#/components/responses/InternalError" get: operationId: getPolicy summary: Get a replenishment policy description: Returns the declared policy of a site and SKU, with its current version also as `ETag`. tags: [Policies] responses: "200": description: The policy. headers: ETag: description: The current policy version. schema: type: string content: application/json: schema: $ref: "#/components/schemas/Policy" "400": $ref: "#/components/responses/BadRequest" "404": $ref: "#/components/responses/NotFound" "500": $ref: "#/components/responses/InternalError" delete: operationId: removePolicy summary: Remove a replenishment policy description: | Removes the policy of a site and SKU, given `If-Match: ` (a stale value is a 409 `concurrent-modification`). Every open request of that site and SKU is cancelled with reason `POLICY_REMOVED` in the same transaction. Without a policy the pick face reports `NO_POLICY` and raises no request. tags: [Policies] parameters: - $ref: "#/components/parameters/IfMatch" responses: "204": description: The policy was removed. "400": $ref: "#/components/responses/BadRequest" "404": $ref: "#/components/responses/NotFound" "409": $ref: "#/components/responses/Conflict" "500": $ref: "#/components/responses/InternalError" /pick-faces: get: operationId: listPickFaces summary: List pick faces and their replenishment status description: | One entry per forward pick face of the site (a forward bin assigned to a SKU by the site's latest approved slot plan), ordered by forward bin. `available = onHand - reserved`. `status` is `BELOW_MIN` when the projected level (available plus the open request, if any) is at or below the policy minimum, `OK` otherwise, `NO_POLICY` when no policy is declared, and `NO_SOURCE` when the level is low but nothing can be moved: no reserve bin holds usable stock, or less than one `multiple` fits. Read from the event-fed local copies (ADR 0003). tags: [Pick faces] parameters: - name: siteId in: query required: true description: The site. schema: type: string - name: status in: query description: Only pick faces with this status. schema: $ref: "#/components/schemas/PickFaceStatus" - $ref: "#/components/parameters/Limit" - $ref: "#/components/parameters/Cursor" responses: "200": description: One page of pick faces. content: application/json: schema: $ref: "#/components/schemas/PickFacePage" example: items: - siteId: SITE-1 forwardBin: WH1-FWD-A01-01-01-A sku: SKU-1 onHand: 8 reserved: 3 available: 5 minQty: 10 maxQty: 60 openRequestId: repl-3b0e8d2a-7c41-4f6a-9d15-2a8b6c4e1f07 status: BELOW_MIN - siteId: SITE-1 forwardBin: WH1-FWD-A01-01-02-A sku: SKU-2 onHand: 40 reserved: 0 available: 40 minQty: 10 maxQty: 60 status: OK "400": $ref: "#/components/responses/BadRequest" "500": $ref: "#/components/responses/InternalError" /replenishments: post: operationId: requestReplenishment summary: Raise a replenishment request by hand description: | Raises a request for a SKU of a site outside the periodic detection. The forward bin is the one the site's latest approved slot plan assigns to the SKU (422 `no-forward-assignment` when there is none). Without `quantity` the detector rules size it from the current levels (a request is then raised only when the pick face is at or below its minimum, otherwise 422 `nothing-to-replenish`; 422 `no-source-stock` when the face is low but nothing can be moved); with `quantity` the same invariants apply: at least 1, the projected level plus the quantity at most the policy maximum (so a policy is required, 422 `no-policy`), at most the source bin's usable stock (422 `no-source-stock`). At most one request is open per forward bin and SKU (409 `replenishment-already-open`). Publishes `ReplenishmentRequested`. Requires an `Idempotency-Key`; replaying the same key and request returns the original answer with `Idempotency-Replayed: true`. tags: [Replenishments] parameters: - $ref: "#/components/parameters/IdempotencyKey" requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/RequestReplenishmentRequest" example: siteId: SITE-1 sku: SKU-1 quantity: 24 responses: "201": description: The request was raised. headers: Location: description: Path of the new request. schema: type: string Idempotency-Replayed: $ref: "#/components/headers/IdempotencyReplayed" content: application/json: schema: $ref: "#/components/schemas/ReplenishmentRequest" example: requestId: repl-3b0e8d2a-7c41-4f6a-9d15-2a8b6c4e1f07 siteId: SITE-1 sku: SKU-1 forwardBin: WH1-FWD-A01-01-01-A sourceBin: WH1-RSV-A07-03-02-B quantity: 24 priority: NORMAL state: Requested policyMin: 10 policyMax: 60 requestedAt: "2026-10-17T09:30:00Z" version: 1 "400": $ref: "#/components/responses/BadRequest" "409": $ref: "#/components/responses/Conflict" "422": $ref: "#/components/responses/UnprocessableEntity" "500": $ref: "#/components/responses/InternalError" get: operationId: listReplenishments summary: List replenishment requests description: | Lists requests newest first, a page at a time. `cursor` is the opaque `nextCursor` of the previous page; a response without `nextCursor` is the last page. Optional filters narrow by site, SKU and state. tags: [Replenishments] parameters: - $ref: "#/components/parameters/Limit" - $ref: "#/components/parameters/Cursor" - name: siteId in: query description: Only requests of this site. schema: type: string - name: sku in: query description: Only requests of this SKU. schema: type: string - name: state in: query description: Only requests in this state. schema: $ref: "#/components/schemas/RequestState" responses: "200": description: One page of requests. content: application/json: schema: $ref: "#/components/schemas/ReplenishmentPage" example: items: - requestId: repl-3b0e8d2a-7c41-4f6a-9d15-2a8b6c4e1f07 siteId: SITE-1 sku: SKU-1 forwardBin: WH1-FWD-A01-01-01-A sourceBin: WH1-RSV-A07-03-02-B quantity: 24 movedQuantity: 24 priority: NORMAL state: Completed policyMin: 10 policyMax: 60 requestedAt: "2026-10-17T09:30:00Z" completedAt: "2026-10-17T10:05:00Z" version: 2 nextCursor: cmVwbC0z "400": $ref: "#/components/responses/BadRequest" "500": $ref: "#/components/responses/InternalError" /replenishments/{requestId}: parameters: - $ref: "#/components/parameters/RequestId" get: operationId: getReplenishment summary: Get a replenishment request description: Returns the request with its state and timestamps, including how many units the relocation moved once it is `Completed`. tags: [Replenishments] responses: "200": description: The request. content: application/json: schema: $ref: "#/components/schemas/ReplenishmentRequest" "400": $ref: "#/components/responses/BadRequest" "404": $ref: "#/components/responses/NotFound" "500": $ref: "#/components/responses/InternalError" /replenishments/{requestId}/cancellations: parameters: - $ref: "#/components/parameters/RequestId" post: operationId: cancelReplenishment summary: Cancel an open replenishment request description: | Moves a `Requested` request to `Cancelled` with reason `OPERATOR` and publishes `ReplenishmentCancelled`. Cancelling a request that is already `Completed` or `Cancelled` is a 409 `replenishment-not-open`. Requires an `Idempotency-Key`. A request already planned or released as floor work is not recalled by this service; the downstream work completes or is cancelled by its own context. tags: [Replenishments] parameters: - $ref: "#/components/parameters/IdempotencyKey" responses: "200": description: The request is now Cancelled. headers: Idempotency-Replayed: $ref: "#/components/headers/IdempotencyReplayed" content: application/json: schema: $ref: "#/components/schemas/ReplenishmentRequest" "400": $ref: "#/components/responses/BadRequest" "404": $ref: "#/components/responses/NotFound" "409": $ref: "#/components/responses/Conflict" "500": $ref: "#/components/responses/InternalError" /sites/{siteId}/evaluations: parameters: - $ref: "#/components/parameters/SiteId" post: operationId: evaluateSite summary: Re-run detection for a site description: | Runs the detector over every forward pick face of the site now and raises the requests it finds. It is a sweep that converges: a pick face that already has an open request is reported as `alreadyOpen` and left alone, so running it twice raises nothing the second time. Requires an `Idempotency-Key`; replaying the same key returns the original summary with `Idempotency-Replayed: true`. tags: [Sites] parameters: - $ref: "#/components/parameters/IdempotencyKey" responses: "200": description: The sweep finished. headers: Idempotency-Replayed: $ref: "#/components/headers/IdempotencyReplayed" content: application/json: schema: $ref: "#/components/schemas/EvaluationSummary" example: siteId: SITE-1 evaluatedAt: "2026-10-17T09:45:00Z" evaluated: 5 raised: 1 healthy: 2 alreadyOpen: 1 noPolicy: 1 noSource: 0 requestIds: - repl-3b0e8d2a-7c41-4f6a-9d15-2a8b6c4e1f07 "400": $ref: "#/components/responses/BadRequest" "409": $ref: "#/components/responses/Conflict" "500": $ref: "#/components/responses/InternalError" /healthz: get: operationId: healthz summary: Liveness probe description: 200 while the process is running. tags: [Health] responses: "200": description: Alive. content: application/json: schema: $ref: "#/components/schemas/Status" /readyz: get: operationId: readyz summary: Readiness probe description: 200 when the service can serve traffic. 503 while draining for shutdown (`{"status":"not_ready"}`) or while Postgres or the Kafka broker is unreachable (problem `dependency-unavailable`). Kafka readiness is reachability only (a broker answers a metadata request); a missing topic never makes the service unready, the broker auto-creates topics on first write. The dependency verdict is cached for a few seconds. tags: [Health] responses: "200": description: Ready. content: application/json: schema: $ref: "#/components/schemas/Status" "503": description: Not ready. content: application/json: schema: $ref: "#/components/schemas/Status" application/problem+json: schema: $ref: "#/components/schemas/Problem" example: type: https://errors.pick-face-replenishment.warehouse-systems.dev/dependency-unavailable title: A runtime dependency is unavailable status: 503 detail: "not ready: kafka" instance: /readyz /reports/replenishment-funnel: servers: - url: http://localhost:8092 description: pfr-reports (cluster-internal Service -reports) get: operationId: getReplenishmentFunnel summary: The replenishment funnel per day tags: [Reports] description: | How does replenishment flow at the site? `days[]` has one row per UTC calendar day intersecting `[from, to)` (zeros included); a day's counts cover the part of the day inside the range. `requests_raised`, `requests_completed` and `requests_cancelled` count the events whose `time` fell in the window, and `units_requested` / `units_replenished` sum their quantity. `completion_latency` is the requested-to-completed time of the requests completed in the window whose request the projection also saw; a request completed without a seen request counts in `requests_completed` but has no latency. `p50_seconds` / `p95_seconds` are linear-interpolated percentiles and are null when `count` is 0. `policies_declared` counts the policy versions declared in the window (the analytics-only `ReplenishmentPolicyDeclared`). `siteId` narrows every counter to one site (omitted = every site); `granularity` is `day` (the only bucket; the default). The data is as fresh as `GET /reports/freshness` says. parameters: - $ref: "#/components/parameters/ReportFrom" - $ref: "#/components/parameters/ReportTo" - name: siteId in: query required: false description: Narrows every counter to one site. Omitted = every site. schema: type: string example: SITE-1 - name: granularity in: query required: false description: The time-bucket resolution; only `day` exists (the default). schema: type: string enum: [day] example: day responses: "200": description: The funnel for the effective range. content: application/json: schema: $ref: "#/components/schemas/ReplenishmentFunnelReport" example: from: "2026-10-05T00:00:00Z" to: "2026-10-07T00:00:00Z" site_id: "SITE-1" granularity: day days: - day: "2026-10-05" requests_raised: 12 units_requested: 288 requests_completed: 9 units_replenished: 216 requests_cancelled: 1 completion_latency: { count: 9, p50_seconds: 1800, p95_seconds: 5400 } policies_declared: 2 - day: "2026-10-06" requests_raised: 0 units_requested: 0 requests_completed: 0 units_replenished: 0 requests_cancelled: 0 completion_latency: { count: 0, p50_seconds: null, p95_seconds: null } policies_declared: 0 "400": description: "`from` / `to` are not RFC 3339, empty or inverted, span more than 366 days, or `granularity` is not `day`." content: application/problem+json: schema: $ref: "#/components/schemas/Problem" examples: invalidRange: summary: from and to are not a valid range value: type: https://errors.pick-face-replenishment.warehouse-systems.dev/invalid-report-range title: from and to must form a valid RFC 3339 range of at most 366 days status: 400 detail: from must be strictly before to instance: /reports/replenishment-funnel invalidGranularity: summary: granularity is not day value: type: https://errors.pick-face-replenishment.warehouse-systems.dev/invalid-report-granularity title: granularity must be "day" status: 400 detail: 'granularity must be "day", got "hour"' instance: /reports/replenishment-funnel "500": $ref: "#/components/responses/ReportStoreError" /reports/freshness: servers: - url: http://localhost:8092 description: pfr-reports (cluster-internal Service -reports) get: operationId: getReportsFreshness summary: How far the analytics projection is behind tags: [Reports] description: | The freshness lag of the projection the report reads: `as_of` is the CloudEvents time of the newest event the projector has applied and `lag_seconds` is now minus `as_of` (never negative). Both are null until the first event is applied. A growing lag means the projector is down or behind, not that the report is wrong: it catches up when the projector does. responses: "200": description: The freshness (null fields while nothing was projected). content: application/json: schema: $ref: "#/components/schemas/ReportsFreshness" example: as_of: "2026-10-07T11:59:55Z" lag_seconds: 4.2 "500": $ref: "#/components/responses/ReportStoreError" components: parameters: SiteId: name: siteId in: path required: true description: The site id (the facility site code). schema: type: string minLength: 1 maxLength: 64 pattern: '\S' example: SITE-1 Sku: name: sku in: path required: true description: The SKU. schema: type: string minLength: 1 maxLength: 64 pattern: '\S' example: SKU-1 RequestId: name: requestId in: path required: true description: The request id (`repl-` followed by a unique suffix, at most 64 characters). schema: type: string minLength: 6 maxLength: 64 pattern: "^repl-[^\\s/]+$" example: repl-3b0e8d2a-7c41-4f6a-9d15-2a8b6c4e1f07 IfMatch: name: If-Match in: header required: false description: | The policy version the caller read (the `ETag` of a previous response, with or without the double quotes). Omit it to create a policy; send it to replace or remove one. A value that is not the current version is a 409 `concurrent-modification`. schema: type: string pattern: '^"?[0-9]+"?$' example: '"1"' Limit: name: limit in: query description: Page size, 1 to 500 (default 100). schema: type: integer format: int32 minimum: 1 maximum: 500 default: 100 Cursor: name: cursor in: query description: The `nextCursor` value from the previous page. schema: type: string IdempotencyKey: name: Idempotency-Key in: header required: true description: | Caller-generated unique key (a UUID per logical submit) that makes a retried request safe. The service always runs on Postgres, so it is required on every deployment and answered with 400 `idempotency-key-required` when absent; a replay with the same key and the same request (method, path and body) returns the original response with the header `Idempotency-Replayed: true`, while the same key with a different request is 409 `idempotency-key-reused`. A key longer than 128 characters is also 400 `idempotency-key-required`. A 2xx answer is stored and replayed. Of the refusals, every problem type has one replay class (ADR 0014): a FINAL one (the request-shaped 400s, 404 `replenishment-not-found`, 409 `replenishment-not-open`) is stored and replayed like a success; a RETRYABLE one (`concurrent-modification`, `replenishment-already-open`, `no-forward-assignment`, `no-policy`, `no-source-stock`, `nothing-to-replenish`, `quantity-exceeds-max`) is not stored and its key is released, so the same key may be sent again once the cause changed, and a different body under it is a new request; a 5xx is never stored. schema: type: string minLength: 1 maxLength: 128 ReportFrom: name: from in: query required: false description: RFC 3339 instant, inclusive. Defaults to `to` minus 30 days. schema: type: string format: date-time example: "2026-10-05T00:00:00Z" ReportTo: name: to in: query required: false description: RFC 3339 instant, exclusive. Defaults to now. At most 366 days after `from`. schema: type: string format: date-time example: "2026-10-07T00:00:00Z" headers: IdempotencyReplayed: description: >- `true` when this response is the stored answer of an earlier request with the same `Idempotency-Key` and the same method, path and body (the handler did not run again). Absent on the first execution. schema: type: string enum: ["true"] responses: BadRequest: description: Malformed JSON body, an unknown field, or an invalid path, query or header parameter. content: application/problem+json: schema: $ref: "#/components/schemas/Problem" examples: malformedBody: summary: Malformed JSON body or unknown field value: type: https://errors.pick-face-replenishment.warehouse-systems.dev/malformed-request title: Malformed request status: 400 detail: request body is not valid JSON for this operation instance: /replenishments invalidPolicy: summary: Policy bounds out of range value: type: https://errors.pick-face-replenishment.warehouse-systems.dev/invalid-policy title: Policy is invalid status: 400 detail: minQty must be at least 0 and below maxQty, and multiple at least 1 instance: /policies/SITE-1/SKU-1 invalidQuantity: summary: Quantity below 1 value: type: https://errors.pick-face-replenishment.warehouse-systems.dev/invalid-quantity title: Quantity is invalid status: 400 detail: quantity must be at least 1 instance: /replenishments invalidSite: summary: Blank site id value: type: https://errors.pick-face-replenishment.warehouse-systems.dev/invalid-site-id title: Site id is invalid status: 400 detail: siteId must not be blank instance: /pick-faces invalidSku: summary: Blank SKU value: type: https://errors.pick-face-replenishment.warehouse-systems.dev/invalid-sku title: SKU is invalid status: 400 detail: sku must not be blank instance: /policies/SITE-1/%20 invalidRequestId: summary: Invalid request id value: type: https://errors.pick-face-replenishment.warehouse-systems.dev/invalid-request-id title: Request id is invalid status: 400 detail: "request id must start with repl- and have no whitespace, control characters or '/'" instance: /replenishments/nope invalidIfMatch: summary: If-Match is not a version value: type: https://errors.pick-face-replenishment.warehouse-systems.dev/invalid-if-match title: If-Match is invalid status: 400 detail: If-Match must be a policy version, a non-negative integer instance: /policies/SITE-1/SKU-1 invalidState: summary: Unknown request state filter value: type: https://errors.pick-face-replenishment.warehouse-systems.dev/invalid-state title: State is invalid status: 400 detail: "state must be one of Requested, Completed, Cancelled" instance: /replenishments invalidStatus: summary: Unknown pick-face status filter value: type: https://errors.pick-face-replenishment.warehouse-systems.dev/invalid-status title: Status is invalid status: 400 detail: "status must be one of BELOW_MIN, OK, NO_SOURCE, NO_POLICY" instance: /pick-faces invalidLimit: summary: Invalid limit value: type: https://errors.pick-face-replenishment.warehouse-systems.dev/invalid-limit title: Limit is invalid status: 400 detail: limit must be a single integer between 1 and 500 instance: /replenishments invalidCursor: summary: Invalid cursor value: type: https://errors.pick-face-replenishment.warehouse-systems.dev/invalid-cursor title: Cursor is invalid status: 400 detail: cursor is not a value returned by this API instance: /replenishments unknownQueryParameter: summary: Undeclared query parameter on a paged list value: type: https://errors.pick-face-replenishment.warehouse-systems.dev/unknown-query-parameter title: Unknown query parameter status: 400 detail: "unknown query parameter: offset" instance: /replenishments idempotencyKeyRequired: summary: Missing Idempotency-Key value: type: https://errors.pick-face-replenishment.warehouse-systems.dev/idempotency-key-required title: Idempotency-Key header is required status: 400 detail: send an Idempotency-Key header with a unique value per logical request instance: /replenishments NotFound: description: No policy or request has this identity. content: application/problem+json: schema: $ref: "#/components/schemas/Problem" examples: policyNotFound: summary: No policy for this site and SKU value: type: https://errors.pick-face-replenishment.warehouse-systems.dev/policy-not-found title: Replenishment policy not found status: 404 detail: replenishment policy not found instance: /policies/SITE-1/SKU-9 replenishmentNotFound: summary: No request has this id value: type: https://errors.pick-face-replenishment.warehouse-systems.dev/replenishment-not-found title: Replenishment request not found status: 404 detail: replenishment request not found instance: /replenishments/repl-unknown Conflict: description: The resource is in the wrong state for the command, another request changed it first, or the Idempotency-Key was already used with a different request (`idempotency-key-reused`). content: application/problem+json: schema: $ref: "#/components/schemas/Problem" examples: policyAlreadyExists: summary: A policy exists and no If-Match was sent value: type: https://errors.pick-face-replenishment.warehouse-systems.dev/policy-already-exists title: A policy already exists for this site and SKU status: 409 detail: send If-Match with the current policy version to replace it instance: /policies/SITE-1/SKU-1 replenishmentAlreadyOpen: summary: The forward bin already has an open request for this SKU value: type: https://errors.pick-face-replenishment.warehouse-systems.dev/replenishment-already-open title: A replenishment request is already open for this pick face status: 409 detail: request repl-3b0e8d2a-7c41-4f6a-9d15-2a8b6c4e1f07 is open for this forward bin and SKU instance: /replenishments replenishmentNotOpen: summary: Only a Requested request can be cancelled value: type: https://errors.pick-face-replenishment.warehouse-systems.dev/replenishment-not-open title: Only a Requested replenishment can be cancelled status: 409 detail: replenishment request is not Requested instance: /replenishments/repl-1/cancellations concurrentModification: summary: Stale If-Match or concurrent write value: type: https://errors.pick-face-replenishment.warehouse-systems.dev/concurrent-modification title: The resource was modified by another request; re-fetch the latest version and retry status: 409 detail: concurrent modification instance: /policies/SITE-1/SKU-1 idempotencyKeyReused: summary: The Idempotency-Key was used with a different request value: type: https://errors.pick-face-replenishment.warehouse-systems.dev/idempotency-key-reused title: Idempotency-Key was already used with a different request status: 409 detail: the Idempotency-Key was used with a different request (method, path or body) instance: /replenishments UnprocessableEntity: description: The request is well-formed but the current state does not allow it. content: application/problem+json: schema: $ref: "#/components/schemas/Problem" examples: noActiveCaseLevel: summary: PACK_DERIVED policy for a SKU with no active CASE pack level value: type: https://errors.pick-face-replenishment.warehouse-systems.dev/no-active-case-level title: The SKU has no active CASE pack level status: 422 detail: product-master has declared no CASE level in force for this SKU; declare one there, or declare the policy with source DECLARED instance: /policies/SITE-1/SKU-1 noForwardAssignment: summary: The SKU has no forward bin value: type: https://errors.pick-face-replenishment.warehouse-systems.dev/no-forward-assignment title: The SKU has no forward pick face at this site status: 422 detail: the site's approved slot plan assigns no forward bin to this SKU instance: /replenishments noPolicy: summary: The SKU has no policy value: type: https://errors.pick-face-replenishment.warehouse-systems.dev/no-policy title: The SKU has no replenishment policy at this site status: 422 detail: declare a policy with PUT /policies/{siteId}/{sku} first instance: /replenishments noSourceStock: summary: No reserve bin can supply the quantity value: type: https://errors.pick-face-replenishment.warehouse-systems.dev/no-source-stock title: No reserve bin can supply this quantity status: 422 detail: no reserve bin of the site holds usable stock of this SKU for the requested quantity instance: /replenishments nothingToReplenish: summary: The pick face is above its minimum and no quantity was given value: type: https://errors.pick-face-replenishment.warehouse-systems.dev/nothing-to-replenish title: The pick face does not need replenishment status: 422 detail: the pick face is above its minimum; send a quantity to replenish it anyway instance: /replenishments quantityExceedsMax: summary: The quantity would overfill the pick face value: type: https://errors.pick-face-replenishment.warehouse-systems.dev/quantity-exceeds-max title: The quantity would exceed the policy maximum status: 422 detail: projected level plus quantity must not exceed maxQty instance: /replenishments InternalError: description: Unexpected server error. content: application/problem+json: schema: $ref: "#/components/schemas/Problem" example: type: https://errors.pick-face-replenishment.warehouse-systems.dev/internal-error title: Internal server error status: 500 detail: an unexpected error occurred instance: /replenishments ReportStoreError: description: The analytical database query failed (pfr-reports only). content: application/problem+json: schema: $ref: "#/components/schemas/Problem" example: type: https://errors.pick-face-replenishment.warehouse-systems.dev/report-store-error title: The report could not be served status: 500 detail: the analytical database query failed instance: /reports/replenishment-funnel schemas: RequestState: type: string description: Lifecycle state of a request. `Completed` and `Cancelled` are final. enum: [Requested, Completed, Cancelled] Priority: type: string description: "`URGENT` when the pick face had nothing available (`onHand - reserved <= 0`) at detection, else `NORMAL`." enum: [NORMAL, URGENT] CancelReason: type: string description: | `OPERATOR`: cancelled through this API. `ASSIGNMENT_CHANGED`: a newer approved slot plan no longer assigns the SKU to the forward bin. `POLICY_REMOVED`: the policy was removed. enum: [OPERATOR, ASSIGNMENT_CHANGED, POLICY_REMOVED] PickFaceStatus: type: string description: | `BELOW_MIN`: the projected level is at or below the minimum. `OK`: above it. `NO_POLICY`: no policy declared. `NO_SOURCE`: low, but nothing can be moved (no reserve bin holds usable stock, or less than one `multiple` fits). enum: [BELOW_MIN, OK, NO_SOURCE, NO_POLICY] DeclarePolicyRequest: type: object additionalProperties: false required: [minQty, maxQty] properties: minQty: type: integer format: int64 minimum: 0 description: Replenish when the projected level is at or below this. maxQty: type: integer format: int64 minimum: 1 description: Never fill beyond this; must be greater than `minQty`. multiple: type: integer format: int64 minimum: 1 default: 1 description: >- A request quantity is rounded down to a multiple of this (a case or inner-pack size). Must be omitted when `source` is `PACK_DERIVED`. source: type: string enum: [DECLARED, PACK_DERIVED] default: DECLARED description: >- DECLARED keeps the multiple as sent. PACK_DERIVED takes it from the SKU's active CASE pack level (units per case) and re-derives it when that level is superseded. RequestReplenishmentRequest: type: object additionalProperties: false required: [siteId, sku] properties: siteId: type: string minLength: 1 maxLength: 64 pattern: '\S' description: The site of the pick face. sku: type: string minLength: 1 maxLength: 64 pattern: '\S' description: The SKU to replenish. quantity: type: integer format: int64 minimum: 1 description: Units to move; sized by the detector rules when omitted. Policy: type: object required: [siteId, sku, minQty, maxQty, multiple, source, stale, version, declaredAt] properties: siteId: { type: string } sku: { type: string } minQty: { type: integer, format: int64, minimum: 0 } maxQty: { type: integer, format: int64, minimum: 1 } multiple: { type: integer, format: int64, minimum: 1 } source: { type: string, enum: [DECLARED, PACK_DERIVED], description: "Where `multiple` comes from." } stale: { type: boolean, description: "PACK_DERIVED only: the CASE level it was derived from is gone and no other is in force; the last multiple still applies." } version: { type: integer, format: int64, minimum: 1, description: "Starts at 1, +1 per accepted change." } declaredAt: { type: string, format: date-time } PolicyPage: type: object required: [items] properties: items: type: array items: { $ref: "#/components/schemas/Policy" } nextCursor: type: string description: Opaque cursor for the next page; absent on the last page. PickFace: type: object required: [siteId, forwardBin, sku, onHand, reserved, available, status] properties: siteId: { type: string } forwardBin: { type: string, description: The facility-layout location code of the forward bin. } sku: { type: string } onHand: { type: integer, format: int64, minimum: 0 } reserved: { type: integer, format: int64, minimum: 0 } available: { type: integer, format: int64, description: "`onHand - reserved`; can be negative when reservations exceed the bin." } minQty: { type: integer, format: int64, minimum: 0, description: Absent when the face has no policy. } maxQty: { type: integer, format: int64, minimum: 1, description: Absent when the face has no policy. } openRequestId: { type: string, description: The open request of this face; absent when none. } status: { $ref: "#/components/schemas/PickFaceStatus" } PickFacePage: type: object required: [items] properties: items: type: array items: { $ref: "#/components/schemas/PickFace" } nextCursor: type: string description: Opaque cursor for the next page; absent on the last page. ReplenishmentRequest: type: object required: [requestId, siteId, sku, forwardBin, sourceBin, quantity, priority, state, policyMin, policyMax, requestedAt, version] properties: requestId: { type: string, example: repl-3b0e8d2a-7c41-4f6a-9d15-2a8b6c4e1f07 } siteId: { type: string } sku: { type: string } forwardBin: { type: string, description: The pick face to fill. } sourceBin: { type: string, description: The reserve bin the stock comes from. } quantity: { type: integer, format: int64, minimum: 1, description: Units planned to move. } movedQuantity: { type: integer, format: int64, minimum: 1, description: Units the relocation moved; present once Completed. } priority: { $ref: "#/components/schemas/Priority" } state: { $ref: "#/components/schemas/RequestState" } policyMin: { type: integer, format: int64, minimum: 0, description: The policy minimum at detection. } policyMax: { type: integer, format: int64, minimum: 1, description: The policy maximum at detection. } requestedAt: { type: string, format: date-time } completedAt: { type: string, format: date-time } cancelledAt: { type: string, format: date-time } cancelReason: { $ref: "#/components/schemas/CancelReason" } version: { type: integer, format: int64, minimum: 1, description: "Starts at 1, +1 per accepted transition." } ReplenishmentPage: type: object required: [items] properties: items: type: array items: { $ref: "#/components/schemas/ReplenishmentRequest" } nextCursor: type: string description: Opaque cursor for the next page; absent on the last page. EvaluationSummary: type: object required: [siteId, evaluatedAt, evaluated, raised, healthy, alreadyOpen, noPolicy, noSource, requestIds] properties: siteId: { type: string } evaluatedAt: { type: string, format: date-time } evaluated: { type: integer, format: int32, minimum: 0, description: Pick faces examined. } raised: { type: integer, format: int32, minimum: 0, description: Requests raised by this sweep. } healthy: { type: integer, format: int32, minimum: 0, description: Faces above their minimum. } alreadyOpen: { type: integer, format: int32, minimum: 0, description: Faces that already have an open request. } noPolicy: { type: integer, format: int32, minimum: 0, description: Faces without a policy. } noSource: { type: integer, format: int32, minimum: 0, description: "Low faces where nothing can be moved: no usable reserve stock, or less than one multiple fits." } requestIds: type: array description: The requests raised, in forward-bin order. items: { type: string } CompletionLatencyTiming: type: object description: The requested-to-completed durations of one day's completed requests (linear-interpolated percentiles). required: [count, p50_seconds, p95_seconds] properties: count: { type: integer, minimum: 0 } p50_seconds: { type: number, format: double, nullable: true, minimum: 0, description: Null when count is 0. } p95_seconds: { type: number, format: double, nullable: true, minimum: 0, description: Null when count is 0. } ReplenishmentFunnelDay: type: object required: [day, requests_raised, units_requested, requests_completed, units_replenished, requests_cancelled, completion_latency, policies_declared] properties: day: { type: string, format: date, description: The UTC calendar day. } requests_raised: { type: integer, minimum: 0, description: ReplenishmentRequested events that fell in the day's window. } units_requested: { type: integer, format: int64, minimum: 0, description: Total quantity of those requests. } requests_completed: { type: integer, minimum: 0, description: ReplenishmentCompleted events that fell in the day's window. } units_replenished: { type: integer, format: int64, minimum: 0, description: Total quantity moved by those completions. } requests_cancelled: { type: integer, minimum: 0, description: ReplenishmentCancelled events that fell in the day's window. } completion_latency: { $ref: "#/components/schemas/CompletionLatencyTiming" } policies_declared: { type: integer, minimum: 0, description: Policy versions declared (ReplenishmentPolicyDeclared) in the day's window. } ReplenishmentFunnelReport: type: object required: [from, to, granularity, days] properties: from: { type: string, format: date-time, description: The effective range start (inclusive). } to: { type: string, format: date-time, description: The effective range end (exclusive). } site_id: { type: string, description: The site scope; omitted when the report covers every site. } granularity: { type: string, enum: [day] } days: type: array description: One dense row per UTC calendar day intersecting the range, zeros included. items: { $ref: "#/components/schemas/ReplenishmentFunnelDay" } ReportsFreshness: type: object required: [as_of, lag_seconds] properties: as_of: { type: string, format: date-time, nullable: true, description: The CloudEvents time of the newest applied event; null until the first. } lag_seconds: { type: number, format: double, nullable: true, minimum: 0, description: "now - as_of, never negative; null until the first event." } Problem: type: object description: RFC 7807 problem document used for every non-2xx response. required: [type, title, status, detail, instance] properties: type: { type: string, format: uri } title: { type: string } status: { type: integer, format: int32 } detail: { type: string } instance: { type: string } Status: type: object required: [status] properties: status: { type: string, example: ok }