---
title: "Cancel Po Group Remainder"
method: POST
path: "/api/v1/materials/po-groups/{po_number}/cancel-remainder"
tags: ["v1", "Materials"]
---

# Cancel Po Group Remainder

`POST /api/v1/materials/po-groups/{po_number}/cancel-remainder`

## Request

- Base URL: `https://api.jeevyfabrication.com` (the document declares no server; this is the origin it was published from)
- URL: `https://api.jeevyfabrication.com/api/v1/materials/po-groups/{po_number}/cancel-remainder`
- Auth: none declared

Cancel the un-received remainder of an already-raised PO group.

Safety invariant: this endpoint only ever touches quantity that has NEVER been
received (no receiving_log entry covers it) — regardless of QC status. It never
edits or removes anything with a receiving_log entry, so partially or fully
QC'd / inventoried units are structurally impossible to disturb here.

Per real (non-misc) item at po_number, by total_received vs. quantity:
  - total_received <= 0            -> revert to qs_state='sel', clear po_number and
                                      delivery dates. vendor_opts / selected_vendor /
                                      unit_price / quantity are kept intact so the user
                                      can re-raise without re-entering anything.
  - 0 < total_received < quantity   -> shrink this item in place to quantity=total_received,
                                       qs_state='purch' (keeps receiving_log/qc_log/po_number
                                       untouched). The un-received delta is dropped with no
                                       shell row.
  - total_received >= quantity      -> untouched (already fully received, nothing to cancel)

Misc expense items (shipping/tax — no nickname) ride along with a specific PO and
have no purpose once nothing from that PO survives: they are deleted, but ONLY when
every real item is deleted too (nothing received anywhere in the group). If any real
item keeps a received/kept portion, misc costs legitimately incurred for those goods
are left alone.

404 if the PO number has no open (po/purch) items. 400 if every real item is
already fully received — there is nothing left to cancel.

## Path parameters

- `po_number` string, required

## Request body

- object

## Response `200`

Successful Response

- object

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/jeevyfabrication/apis/bom-generation-api.md) - [All operations](https://skmtc.dev/jeevyfabrication/apis/bom-generation-api/llms.txt) - [OpenAPI document](https://skmtc.dev/jeevyfabrication/apis/bom-generation-api/revisions/ad9a01abeac9?raw)
