---
title: "Get Next Po Number"
method: GET
path: "/api/v1/materials/next-po-number"
tags: ["v1", "Materials"]
---

# Get Next Po Number

`GET /api/v1/materials/next-po-number`

## 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/next-po-number`
- Auth: none declared

Return the next sequential PO number, minted from the right counter.

Scope decides which counter, because Jeevy has two and they must not be
crossed: a project's `<project_number>-P<seq>` and the shop's
`INY-YYMMDD-P<seq>` for facility stock.

- project_id given  -> next_vendor_po_number(project_id)
- project_id absent -> next_shop_inventory_po_number(session shop)

project_id became optional when the sign-off gate started routing facility
restocks to qs_state='approval'. Approving one has to mint a number, and
there is no project to mint from — the approve path used to hard-fail with
"no project context for this item", stranding the order permanently.

The shop comes from the SESSION, never a parameter: it is an identity, and
accepting it from the caller would let one shop spend another's sequence.

Both RPCs atomically increment and never reuse, so consuming this endpoint
is intentional — the caller is expected to store what it gets back.

## Query parameters

- `project_id` integer, nullable

## 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)
