Skip to main content
Documentation

Inventory

inventory.purchase_order

Get one purchase order — every roll ordered, and what landed
Read-onlyRead budget

REST

Shipping
POST /api/v1/inventory/purchase_order

MCP tool

Live
inventory.purchase_order

Exposed on: REST API · Shop MCP server · Claude connector · Dash (in-app copilot) · Zapier. Part of the Inventory domain.

Operating contract

ONE ORDER IN FULL: the vendor, every line with what was ordered against what has actually been received, and the money — subtotal, shipping, tax and total.

received_quantity AGAINST quantity IS THE WHOLE READ. A line short by two rolls is stock the shop is counting on and does not have, and it is invisible from any total. outstanding is that gap per line, already worked out.

derived_status IS COMPUTED FROM THE LINES, and it can disagree with status, which is the stored column. When they differ, the lines are the truth — the stored status is what somebody last set, and a part-received order that still reads sent is exactly the case worth flagging.

MONEY IS THE ORDER'S OWN. Do not re-add the lines and report the sum as the cost: shipping and tax are on the order, not on its lines, and the landed cost of a roll is line cost plus its share of both.

A ROLL LINE MEASURES IN FEET, not units. unit says which, and quoting '3' for something ordered in feet is a shop ordering three feet of film instead of three rolls.

One order and its lines, entirely returned, so nothing is truncated.

RAISING, SENDING AND RECEIVING AN ORDER ARE NOT HERE. Sending one commits the shop's money with a supplier, and receiving one mints roll codes against physical stock somebody has to be standing next to.

Who may call it

Permission
inventory.accessThe caller must hold Inventory at the ACT level. A read-only dashboard grant on the same section is refused.
Plan
Every planNo plan gate. Available on every Service VIN plan.
Retries
naturalNaturally idempotent — running it twice leaves the same world as running it once. A retrying integration needs no key.
Rate class
readCounted against the read budget — the widest of the four.

Input

FieldTypeDescription
roll_idrequiredstringuuid

The purchase order's id, as returned by inventory.purchase_orders. (Inventory ids are spelled roll_id across this domain.)

Output

FieldTypeDescription
idstring

numbernumber

vendorstring

vendor_emailstring | null

statusstring

derived_statusstring

expected_onstring | null

sent_atstring | null

received_atstring | null

notesstring | null

subtotalnumber

shippingnumber

taxnumber

totalnumber

linesobject[]

lines[].idstring

lines[].descriptionstring

lines[].sku_idstring | null

lines[].quantitynumber

lines[].received_quantitynumber

lines[].outstandingnumber

lines[].unit_costnumber

lines[].line_totalnumber

fully_receivedboolean

Examples

Built from this capability's own schema — required fields and the ones carrying a default, and nothing invented. Paste one and it validates.

curl
export SERVICEVIN_API_KEY=svk_live_…

curl -X POST https://www.servicevin.com/api/v1/inventory/purchase_order \
  -H "Authorization: Bearer $SERVICEVIN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"roll_id":"9b2f1c6e-4a77-4d2b-9f31-0f1c9a8e5d20"}'

TypeScript (fetch)
const res = await fetch("https://www.servicevin.com/api/v1/inventory/purchase_order", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.SERVICEVIN_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "roll_id": "9b2f1c6e-4a77-4d2b-9f31-0f1c9a8e5d20"
  }),
});

// Success and failure are both envelopes. Switch on error.code, never
// on error.message — the codes are stable, the messages are for people.
const payload = await res.json();
if (!res.ok) throw new Error(payload.error.code);
const data = payload.data;

Python (requests)
import os, requests

res = requests.post(
    "https://www.servicevin.com/api/v1/inventory/purchase_order",
    headers={"Authorization": f"Bearer {os.environ['SERVICEVIN_API_KEY']}"},
    json={
    "roll_id": "9b2f1c6e-4a77-4d2b-9f31-0f1c9a8e5d20"
},
    timeout=30,
)
payload = res.json()
if not res.ok:
    raise RuntimeError(payload["error"]["code"])
data = payload["data"]

MCP tools/call — https://www.servicevin.com/api/mcp
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "inventory.purchase_order",
    "arguments": {
      "roll_id": "9b2f1c6e-4a77-4d2b-9f31-0f1c9a8e5d20"
    }
  }
}

Refusals

The four gates run in this order on every surface, and the order is not arbitrary — see Authentication.

StatusCodeWhen
404not_foundThe id is unknown, or the feature is not enabled for this account. Deliberately the same answer for both.
403forbiddenThis login does not hold inventory.access.
422validation_errorAn argument was wrong. The message names the field.
429rate_limitedToo many read calls. Back off and retry.
500internal_errorSomething failed on our side. Nothing was changed.