# PULPO WMS Integration Guide — complete knowledge base This file contains the full content of the PULPO WMS integration guide and a condensed API reference (spec version 4.4.0). It is generated from the guide's source pages and the OpenAPI spec, so it matches the website. How to read this file: - The guide is written for two kinds of integrators. A **3PL fulfiller** runs a warehouse for many merchants; `merchant_id` and `merchant_channel_id` matter and must match across records. A **single merchant** connects one shop; those ids are optional. Text that applies to only one of them is marked "Only for 3PL fulfillers" or "Only for single merchants". - Every page starts with its website path, for example `/guide/outgoing`. Links inside the text such as `/guide/glossary` point to the page with that path in this file. - `{{baseUrl}}` in code samples is the API base URL. Production EU: `https://eu.pulpo.co/api/v1`. Production Americas: `https://am.pulpo.co/api/v1`. Onboarding / Staging: `https://eu-show.pulpo.co/api/v1` (demo data is volatile, for integration testing only). - Endpoints are written as `METHOD /path` and their operationId; the API reference at the end lists every endpoint with its parameters, request body fields and responses. ## Contents - Getting started: Overview, Quickstart, Integration paths, Initial considerations, Entity & data model, Process overview - Happy paths: Products, Incoming process, Outgoing process, Returns, Stock transfer, POS orders, Kitting, Stock changes, Loading units - Reference material: Best practices, Order states & lifecycles, Webhooks, Receiving webhooks, Idempotency & retries, Errors & troubleshooting, Glossary - Shipping Label Provider: Overview, Packing webhooks, Shipment tracking & labels, Returns - API reference ## Getting started ### Overview Path: `/` Integrate with PULPO WMS. Everything you need to self-integrate: the narrative happy paths woven together with a live, spec-driven API reference. Whether you run a warehouse for many customers (3PL fulfiller) or connect a single shop (single merchant), this guide adapts to you. Main topics: initial considerations (authenticate, read your user, list warehouses, subscribe to webhooks); the entity & data model (Tenant, Merchant, Channel, Warehouse); incoming & outgoing happy paths (purchase orders, sales orders, picking, packing, shipping); the Shipping Label Provider integration; returns & stock transfers; webhooks & best practices (events, pagination, filtering, rate limits). The model in one glance — 3PL: a Tenant (the fulfiller) serves multiple Merchants (their customers). Each Merchant sells through one or more Channels (Shopify, Amazon…) and stores goods across the Tenant's Warehouses. Master data (Products and Third Parties) lives at the Tenant level, while Purchase Orders and Sales Orders are always tied to a Warehouse. You set and match merchant & channel on every write. The model in one glance — single merchant: your Tenant has one default Merchant and Channel, so every order maps to the same place and you rarely touch `merchant_id`. Master data (Products and Third Parties) lives at the Tenant level, while Purchase Orders and Sales Orders are always tied to a Warehouse. ### Quickstart Path: `/guide/quickstart` Summary: From zero to your first fulfilled order — one runnable walkthrough This is the fastest path from nothing to a **fulfilled order** — the four setup calls, then the outgoing happy path, glued into a single runnable script. Every request below targets the environment selected in the header, so switch to **Onboarding / Staging** before you run it. > **TIP: Prefer a client?** > > Import the [Postman collection](/pulpo-wms.postman_collection.json) — it ships every > endpoint with the `{{baseUrl}}` and `{{token}}` variables already wired up. Set those two > collection variables and you can fire the calls below without writing any code. #### What you need first - Credentials for a PULPO WMS user (you receive these during onboarding). - One `warehouse_id` — you will read it in step 2. - (3PL fulfillers: Your `merchant_id` and `merchant_channel_id`. As a 3PL these must match the product and customer on every order. / single merchants: Nothing extra — as a single merchant everything resolves to your default merchant and channel.) #### 1. Authenticate Exchange credentials for a bearer token. It is valid for **60 minutes** — store it and reuse it; do not re-authenticate per call. **Endpoint: Authenticate or refresh an access token** — `POST /auth` (operationId: authenticate) **Example (cURL):** ```bash curl -X POST {{baseUrl}}/auth \ -H "Content-Type: application/json" \ -d '{ "grant_type": "password", "username": "you@example.com", "password": "••••••••" }' ``` **Example (Node.js):** ```js const BASE = "{{baseUrl}}"; async function authenticate() { const res = await fetch(BASE + "/auth", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ grant_type: "password", username: process.env.PULPO_USER, password: process.env.PULPO_PASSWORD, }), }); if (!res.ok) throw new Error("auth failed: " + res.status); const { access_token } = await res.json(); return access_token; } ``` **Example (Python):** ```python import os, requests BASE = "{{baseUrl}}" def authenticate(): res = requests.post(f"{BASE}/auth", json={ "grant_type": "password", "username": os.environ["PULPO_USER"], "password": os.environ["PULPO_PASSWORD"], }) res.raise_for_status() return res.json()["access_token"] ``` #### 2. Read your user and warehouses Your user determines the Tenant you belong to and the Merchants you can manage. Warehouses give you the `warehouse_id` every order is tied to. **Endpoint: Get current user information** — `GET /iam/users/me` (operationId: getCurrentUser) **Endpoint: List all warehouses** — `GET /warehouses/` (operationId: listWarehouses) **Example (Node.js):** ```js async function bootstrap(token) { const auth = { Authorization: "Bearer " + token }; const me = await fetch(BASE + "/iam/users/me", { headers: auth }).then((r) => r.json()); const { warehouses } = await fetch(BASE + "/warehouses?limit=100&sort_by=id:asc", { headers: auth }).then((r) => r.json()); const warehouseId = warehouses[0].id; return { me, warehouseId }; } ``` **Example (Python):** ```python def bootstrap(token): auth = {"Authorization": f"Bearer {token}"} me = requests.get(f"{BASE}/iam/users/me", headers=auth).json() warehouses = requests.get(f"{BASE}/warehouses", params={"limit": 100, "sort_by": "id:asc"}, headers=auth).json()["warehouses"] return me, warehouses[0]["id"] ``` #### 3. Subscribe to the events you care about Register your HTTPS receiver once. For the outgoing flow, `packing_order_finished` (PIC) and `sales_order_finished` (PGI) are the two that matter. See [receiving webhooks](/guide/receiving-webhooks) for how to build the receiver correctly. **Endpoint: Subscribe to webhook events** — `POST /webhook/` (operationId: subscribeWebhook) **Example (cURL):** ```bash curl -X POST {{baseUrl}}/webhook/ \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d '{ "url": "https://your-domain.com/webhooks/pulpo", "method": "POST", "warehouse_id": 140, "allowed_types": ["sales_order_created", "packing_order_finished", "sales_order_finished"] }' ``` #### 4. Create the customer, then the sales order `third_party_id` is required — create the customer (`type: "C"`) first, then use the returned `id` on the order. `priority` is also required; send `1` if you don't have a use case for it. **Endpoint: Create third parties in bulk** — `POST /iam/bulk/third_parties` (operationId: bulkCreateThirdParties) **Endpoint: Create sales orders in bulk** — `POST /sales/bulk/orders` (operationId: bulkCreateSalesOrders) **Example (Node.js):** ```js async function createOrder(token, warehouseId) { const auth = { Authorization: "Bearer " + token, "Content-Type": "application/json" }; const [customer] = await fetch(BASE + "/iam/bulk/third_parties", { method: "POST", headers: auth, body: JSON.stringify([{ active: true, name: "Ada Lovelace", identifier_number: "SO-QUICKSTART-001-CUST", identifier_type: "ID", third_type: "C", // 3PL: also send merchant_id (+ merchant_channel_id) here. }]), }).then((r) => r.json()).then((body) => body.created); const res = await fetch(BASE + "/sales/bulk/orders", { method: "POST", headers: auth, body: JSON.stringify([{ order_num: "SO-QUICKSTART-001", warehouse_id: warehouseId, third_party_id: customer.id, priority: 1, // 3PL: also send merchant_id + merchant_channel_id here. ship_to: { name: "Ada Lovelace", address: { street: "1 Analytical Way", city: "London", country_code: "826" } }, items: [{ product_sku: "YOUR-SKU", quantity: 1 }], }]), }); if (!res.ok) throw new Error("create failed: " + res.status + " " + (await res.text())); return res.json(); } ``` **Example (Python):** ```python def create_order(token, warehouse_id): auth = {"Authorization": f"Bearer {token}"} customer_res = requests.post(f"{BASE}/iam/bulk/third_parties", headers=auth, json=[{ "active": True, "name": "Ada Lovelace", "identifier_number": "SO-QUICKSTART-001-CUST", "identifier_type": "ID", "third_type": "C", # 3PL: also send merchant_id (+ merchant_channel_id) here. }]) customer_res.raise_for_status() customer_id = customer_res.json()["created"][0]["id"] res = requests.post(f"{BASE}/sales/bulk/orders", headers=auth, json=[{ "order_num": "SO-QUICKSTART-001", "warehouse_id": warehouse_id, "third_party_id": customer_id, "priority": 1, # 3PL: also send merchant_id + merchant_channel_id here. "ship_to": {"name": "Ada Lovelace", "address": {"street": "1 Analytical Way", "city": "London", "country_code": "826"}}, "items": [{"product_sku": "YOUR-SKU", "quantity": 1}], }]) res.raise_for_status() return res.json() ``` > **NOTE: Response shape** > > Bulk create/update endpoints return `{"created": [{"id": ..., "order_num": ...}], "errors": {}}` > (or `"updated"` for update endpoints) — not the full order. Fetch the full record with > `GET /sales/orders/{id}` if you need it. > **WARNING: order_num must be unique** > > Reusing an `order_num` is rejected. Derive it from your source system's order id so a > safe retry sends the same value and never creates a duplicate — see > [idempotency & retries](/guide/idempotency). #### 5. Follow it to completion The warehouse picks and packs on the Android app. You will receive `packing_order_finished` (PIC), then `sales_order_finished` (PGI) — at which point the order is fulfilled. If you are not yet receiving webhooks, poll instead: **Endpoint: Search sales orders** — `GET /sales/orders` (operationId: searchSalesOrders) **Example (cURL):** ```bash # Poll until state = ended (PGI) curl "{{baseUrl}}/sales/orders?order_num=contains:SO-QUICKSTART-001&view_attributes=id,order_num,state" \ -H "Authorization: Bearer $TOKEN" ``` The `state` field walks `queue → picking → packing → shipping → ended`. The full picture — including where the `paused` state actually lives — is on [order states & lifecycles](/guide/order-states). > **SUCCESS: That's the loop** > > Auth → warehouse → subscribe → create → observe. Every other flow (incoming, returns, > transfers, kitting) is a variation on the same shape. Continue to the > [incoming](/guide/incoming) and [outgoing](/guide/outgoing) happy paths for the details, > and keep [best practices](/guide/best-practices) open while you build. ### Integration paths Path: `/guide/paths` Summary: 3PL fulfiller vs single merchant — which applies to you Pulpo WMS serves two kinds of integrators. The API is the same for both — the difference is whether you juggle **multiple merchants** or just one. Pick your path with the toggle in the top bar; the guide adapts its guidance (especially around `merchant_id` and `merchant_channel_id`) to match. ##### 3PL fulfiller You store and ship goods for several customers. Each customer is a **Merchant**, each with its own **Channels**. You must set and match `merchant_id` / `merchant_channel_id` on products, third parties and orders. ##### Single merchant You connect one system (a shop, ERP or OMS) for your own goods. Everything maps to a single default Merchant and Channel — you rarely need to think about them at all. #### Your setup at a glance *Diagram — Single merchant: one sales channel, one default merchant, one warehouse; no routing to think about. 3PL: many channels (e.g. Shopify, Billbee, PlentyMarkets) feed several Merchants (the 3PL's customers), all fulfilled from the Tenant's warehouses.* #### What actually changes > **Only for 3PL fulfillers:** > > > **WARNING: You are in 3PL mode** > > > > Merchant and Channel are load-bearing. On a **Purchase Order**, the Merchant of > > the product and of the supplier must match the PO's Merchant. On a **Sales Order**, > > the Merchant + Channel of the product, the customer and the order must all agree. Most > > rejected records come from a mismatch here. > **Only for single merchants:** > > > **SUCCESS: You are in single-merchant mode** > > > > All your orders relate to the **same** Merchant and Channel — the default ones on > > your account. You generally don't need to send `merchant_id` or > > `merchant_channel_id`; where an endpoint accepts them, they resolve to your single > > default. The rest of the flows are identical to 3PL. | Concern | 3PL fulfiller | Single merchant | | ----------------------- | -------------------------------- | ------------------------------ | | Merchants | Many — you manage them | One default | | Channels | Several per merchant | One default | | `merchant_id` on writes | Required & must match | Optional (resolves to default) | | `merchant_channel_id` | Used to route (e.g. only Amazon) | Same default everywhere | | Everything else | Identical | Identical | > **NOTE** > > You can switch modes at any time with the toggle in the header — the pages you're reading will > update in place. Continue to [initial considerations](/guide/start) to start integrating. ### Initial considerations — how to start Path: `/guide/start` Summary: Auth, logged user, warehouses, subscribing to webhooks This guide supports the self-onboarding process for a fulfiller using Pulpo's 3PL functionality. It focuses on the minimum requirements for a fast, reliable integration with the systems your customers use — middleware, ERPs, OMSs or marketplaces — along the "happy path". > **NOTE: Base URLs** > > Production: `https://eu.pulpo.co/api/v1` (EU) · `https://am.pulpo.co/api/v1` (Americas). > Onboarding / staging: `https://eu-show.pulpo.co/api/v1`. All paths in this guide are relative to `/api/v1`. #### 1. Authenticate Authentication uses the OAuth 2.0 password grant. Tokens expire after **60 minutes** — store and reuse them rather than requesting a new one on every call. **Endpoint: Authenticate or refresh an access token** — `POST /auth` (operationId: authenticate) Exchange your credentials for a bearer token, then send it as `Authorization: Bearer ` on every subsequent request. **Example (cURL):** ```bash curl -X POST https://eu.pulpo.co/api/v1/auth \ -H "Content-Type: application/json" \ -d '{ "grant_type": "password", "username": "you@example.com", "password": "••••••••" }' ``` **Example (JavaScript):** ```js const res = await fetch("https://eu.pulpo.co/api/v1/auth", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ grant_type: "password", username: "you@example.com", password: process.env.PULPO_PASSWORD, }), }); const { access_token } = await res.json(); ``` **Example (Python):** ```python import requests res = requests.post( "https://eu.pulpo.co/api/v1/auth", json={ "grant_type": "password", "username": "you@example.com", "password": PULPO_PASSWORD, }, ) access_token = res.json()["access_token"] ``` > **TIP: Store the token** > > The token is valid for 60 minutes. Request a new one only after \~59 minutes — there is > no reason to authenticate on every call, and doing so eats into your rate limit. #### 2. Read your logged-in user Your user implicitly determines the Tenant you belong to, and which Merchants you can manage. The stored user payload carries more than the obvious fields — read the payload, not an assumed shape. **Endpoint: Get current user information** — `GET /iam/users/me` (operationId: getCurrentUser) #### 3. List your warehouses Purchase Orders and Sales Orders are always tied to a specific Warehouse, so you will need their ids early. The warehouse layout is defined together with Pulpo's onboarding team using the WMS wizard. **Endpoint: List all warehouses** — `GET /warehouses/` (operationId: listWarehouses) #### 4. Subscribe to webhooks Most state transitions in Pulpo are surfaced as webhooks. Subscribe to the events your integration needs — you will see the relevant ones called out on each process page. **Endpoint: Subscribe to webhook events** — `POST /webhook/` (operationId: subscribeWebhook) Register a URL to receive event callbacks. See the [webhook catalog](/guide/webhooks) for the full list of event types and sample payloads. > **SUCCESS: You are ready** > > With a token, your warehouse ids and webhook subscriptions in place, continue to the > [entity & data model](/guide/data-model) to understand how everything relates — then work > through the [incoming](/guide/incoming) and [outgoing](/guide/outgoing) happy paths. ### Entity & data model Path: `/guide/data-model` Summary: Tenant, Merchant, Channel, Warehouse and how they relate The main entity is the **Tenant** — the customer of Pulpo WMS. Typically there is one `tenant_id` per instance. (3PL fulfillers: A Tenant acting as a fulfiller serves multiple **Merchants** (its customers); each Merchant sells through one or more **Channels**. / single merchants: Your Tenant has a single default **Merchant** with one default **Channel** — so the merchant/channel layer stays out of your way.) Here is how the core entities relate: *Diagram — how the core entities relate. Master data hangs off the Tenant; orders are tied to a Warehouse. Tenant 1:n Users, Products, Third Parties, Warehouses. Warehouse 1:n Purchase Orders, Sales Orders, Fulfillment Orders. Orders reference a merchant and a channel.* Select an entity to see its role and the endpoints that touch it: *Diagram — entity model: Tenant → Merchant → Channel; Tenant → Warehouse; Tenant holds Products and Third Parties (master data); Purchase Orders, Sales Orders and Fulfillment Orders are tied to a Warehouse and carry merchant/channel.* #### How they relate - A **Tenant** has multiple **Users**. When you log in, the user implicitly indicates the Tenant it belongs to, and which Merchants it may manage. - A **Tenant** has **Products** and **Third Parties** — master data available across all warehouses. Products belong to a Merchant and can carry one or multiple **SKUs** (bounded by that Merchant's Channels). A SKU always points to the same physical product. - **Third Parties** come in two types: **suppliers** (`type = S`, who deliver goods to increase stock) and **customers** (`type = C`, the recipients of sales orders). If you manage them yourself, account for the `third_party_id` Pulpo generates on each new entry. - A **Tenant** has one or multiple **Warehouses**. Purchase Orders and Sales Orders are always tied to a specific Warehouse; Products and Third Parties are available for all of them. > **Only for 3PL fulfillers:** > > > **WARNING: Merchant & Channel must match (3PL)** > > > > On a **Purchase Order**, the Merchant of the product and the Merchant of the supplier must > > match the Merchant on the PO. On a **Sales Order**, the Merchant + Channel of the product, > > the customer, and the order must all agree. Mismatches are the most common source of > > rejected records. > **Only for single merchants:** > > > **SUCCESS: One merchant, one channel** > > > > As a single merchant you have one default Merchant and Channel, so there is nothing to match — > > every product, third party and order resolves to the same pair. You can usually omit > > `merchant_id` and `merchant_channel_id` entirely. #### Sales Orders and Fulfillment Orders A **Sales Order** can be split internally into multiple **Fulfillment Orders** based on Tenant settings. In any case, one Sales Order always has **at least one** Fulfillment Order — and the picking / packing / shipping workflow state lives on the Fulfillment Order, not the Sales Order header. > **TIP** > > Need the raw shapes? Every entity here links into the full > [API Reference](/reference). Continue to the > [process overview](/guide/process) to see how these entities move through the warehouse. ### Standard process overview Path: `/guide/process` Summary: The standard warehouse cycle end to end Before diving into individual flows, here is the full warehouse cycle end to end. Goods come in against a Purchase Order, are put away, picked, packed, shipped — and may come back as returns. *Diagram — the warehouse cycle: Purchase Order → Goods Receipt → Replenishment (put-away into storage) → Sales Order → Picking → Packing → Shipping → and goods may come back as returns.* **Flow: The standard Pulpo WMS warehouse cycle. Click a stage for detail.** 1. **PO** — Incoming goods are announced by a Purchase Order. Endpoint: `POST /reception/bulk/purchase_orders` 2. **Incoming / GR** — Goods are received against the PO (Goods Receipt). Receiving happens in the warehouse app. 3. **Replenishment** — Stock is moved from reception into storage locations. 4. **SO** — A Sales Order requests fulfillment from a warehouse. Endpoint: `POST /sales/bulk/orders` 5. **Picking** — Items are picked from storage. Endpoint: `GET /picking/orders` 6. **Packing** — Items are packed into boxes; labels are attached. Endpoint: `GET /packing/orders` 7. **Shipping** — Boxes are shipped and the order is closed (PGI). 8. **Return** — Optionally, goods return from the customer. Endpoint: `POST /reception/bulk/purchase_orders` #### The flows in this guide Each flow below is documented with its narrative, an interactive diagram, the endpoints to consume (in sequence), and the webhooks you can subscribe to. - **[Incoming process](/guide/incoming)** — purchase orders and goods receipt. - **[Outgoing process](/guide/outgoing)** — sales orders through picking, packing, shipping. - **[Returns](/guide/returns)** — from a customer, or back to a supplier. - **[Stock transfer](/guide/stock-transfer)** — move stock between warehouses. - **[POS orders](/guide/pos-orders)** — stock-only orders with no picking/packing. - **[Kitting](/guide/kitting)** — build new products from sets of components. - **[Stock changes](/guide/stock-changes)** — how stock updates surface. > **NOTE: Where receiving happens** > > Pulpo exposes REST endpoints to *create* orders. The physical receiving of goods > against a PO happens in the warehouse Android app; backend state transitions are surfaced > to you via webhooks such as `purchase_order_finished`. ## Happy paths ### Products Path: `/guide/products` Summary: Create and update your product master data Products are master data. Create them first — every purchase order, sales order, and kit definition references a product by `sku` or `id`. #### Endpoints **Endpoint: Create products in bulk** — `POST /inventory/bulk/products` (operationId: bulkCreateProducts) Create products in bulk. Required fields include `sku`, `name`, `management_type`, `cost_price`, and `barcodes`. (3PL fulfillers: As a 3PL, `merchant_id` is required — it determines who owns the product. / single merchants: As a single merchant, `merchant_id` is optional and resolves to your default.) **Endpoint: Update products in bulk** — `PUT /inventory/bulk/products` (operationId: bulkUpdateProducts) Update existing products, identified by `sku` or `id`. This is a partial update — send only the fields you want to change — except `barcodes`, which must always be included even when unchanged. **Endpoint: Search products** — `GET /inventory/products` (operationId: searchProducts) Look up products by `sku`, `barcode`, `management_type`, stock presence, and more. `sku`/`name` support a `contains:` prefix for substring search; most other filters are exact match only. > **TIP: Deactivating a product** > > Set `active: false` to deactivate a product without losing its order history. #### Tags What the PULPO apps call **tags** is called **`product_categories`** in the API. It's the same thing under two names. A tag can be put on products, users and warehouse locations. 1. Create the tag once for your tenant and note its `id`. 2. Assign it by `id`: send `product_categories: [16902]` when you create or update the product. The list replaces the product's tags; `[]` removes them all, leaving the field out keeps them. > **WARNING: Tag ids, not codes** > > Send tag ids only. Codes like `"cold"` are rejected, and a field named `tags` is silently > ignored — the product is saved without tags. **Endpoint: Search tags (product_categories)** — `GET /inventory/products/categories` (operationId: searchTags) Find a tag's `id` by its `code`. Codes are case-sensitive. **Endpoint: Create a tag (product_category)** — `POST /inventory/products/categories` (operationId: createTag) Create a tag. `code`, `name` and `tenant_id` are required. **Endpoint: Update a tag** — `PUT /inventory/products/categories/{id}` (operationId: updateTag) Rename a tag. Everything that has it keeps it. **Endpoint: Set a user's tags** — `POST /iam/users/{id}/categories` (operationId: setUserTags) Set a user's tags. Locations and more details: see the User & Tenant section of the reference. ### Happy path: incoming process Path: `/guide/incoming` Incoming goods are based on **Purchase Orders** (`type = purchase_order`) or deliveries. It is possible to record an unplanned `incoming_goods` receipt without a PO — via the warehouse app or the API (`document_type: none`) — but the general expectation is to have a Purchase Order first. **Requirements:** [Products](/guide/products) and Third Parties (suppliers) already exist in Pulpo WMS. **Flow: Incoming: PO → goods receipt → replenishment into storage.** 1. **PO** — Create the purchase order in bulk. Endpoint: `POST /reception/bulk/purchase_orders` 2. **Incoming Orders** — Goods arrive and are received against the PO in the warehouse app. 3. **Replenishment** — Received stock is moved from reception to storage. 4. **GR** — Goods Receipt complete — stock is available. Signalled by purchase_order_finished. #### Endpoints to consume These are the supplier and order endpoints, created in sequence. They are bulk endpoints, so you can create multiple elements in one call. See [Products](/guide/products) for loading master data first. **Endpoint: Create third parties in bulk** — `POST /iam/bulk/third_parties` (operationId: bulkCreateThirdParties)Create the suppliers (`type = S`) that deliver the goods. **Endpoint: Create purchase orders in bulk** — `POST /reception/bulk/purchase_orders` (operationId: bulkCreatePurchaseOrders) Create the purchase order (`type = purchase_order`). (3PL fulfillers: Requires a Merchant; the Merchant of the product and of the supplier must match the PO. / single merchants: Your single default Merchant is used automatically — no matching to worry about.) **Endpoint: List purchase orders** — `GET /reception/purchase_orders` (operationId: listPurchaseOrders) Look up purchase orders by `id`, `order_num`, `warehouse_id`, `state`, `product_sku`, and more. **Endpoint: Record a receiving event** — `POST /reception/incoming_goods` (operationId: createIncomingGood) Normally the warehouse app records receiving against the PO, but this lets you do it via API instead — including unplanned receipts with `document_type: none` and no PO. **Endpoint: List incoming-goods (receiving) records** — `GET /reception/incoming_goods` (operationId: listIncomingGoods) Look up what's actually been booked in at the warehouse — one record per receiving event, filterable by `purchase_order_id`, `warehouse_id`, `document_type`, and more. #### Events you can subscribe to **Webhook event: **`purchase_order_updated` Fired whenever a field on the PO changes — a note, delivery date, an item, etc. `state` reflects whatever it was at the time; this alone doesn't mean anything was received. Sample payload: ```json { "data": { "id": 282362, "type": "purchase_order", "state": "queue", "order_num": "test_delivery_009", "warehouse_id": 2236, "merchant_id": 1053, "merchant_channel_id": null, "delivery_date": "2026-09-17T12:13:13", "notes": "this is a test note", "number_finished_early_events": null, "third_party": { "id": 3733699, "name": "supplier 1", "third_type": "S", "identifier_number": "43740000_supplier_1", "identifier_type": "DNI", "merchant_id": 1053, "merchant_channel_id": 1068 }, "items": [ { "id": 104526, "state": "pending", "product_id": 9169276, "requested_quantity": 133, "checked_quantity": 0, "product": { "id": 9169276, "sku": "NP0001", "name": "T-Shirt 1", "management_type": "none" } }, { "id": 104528, "state": "pending", "product_id": 9169280, "requested_quantity": 146, "checked_quantity": 0, "product": { "id": 9169280, "sku": "LP0002", "name": "Drink 2", "management_type": "lot" } } ] }, "id": "6b2dcc50-dddd-4f69-8cb9-c1316eb74ba4", "status": "triggered", "type": "purchase_order_updated", "retry": false, "inserted_at": "2026-09-17T12:14:40", "updated_at": "2026-09-17T12:14:40", "warehouse_id": 2236, "merchant_id": 1053, "merchant_channel_id": 1068, "webhook_id": null, "merchant_channel_name": "default", "merchant_name": "default", "warehouse_name": "simon_warehouse_1" } ``` **Webhook event: **`incoming_good_created` Fired when the warehouse checks items in at the dock against the PO. Each item gets its own `state` — `accepted` or `rejected` — and rejected items carry `reason_codes` and often a photo attachment. Sample payload: ```json { "data": { "id": 18559, "document_type": "purchase_order", "sequence_number": "IG-0000017", "warehouse_id": 2236, "start_date": "2026-09-17T13:12:18", "end_date": "2026-09-17T13:14:47", "owner": { "id": 4625, "username": "simon_user1", "first_name": "Lilyan", "last_name": "Rogahn" }, "purchase_order": { "id": 282447, "order_num": "test_delivery_0010", "state": "queue" }, "items": [ { "id": 66667, "state": "accepted", "product_id": 9169277, "quantity": 10, "destination_location_id": 987070, "batch": null, "notes": null, "product": { "id": 9169277, "sku": "NP0002", "name": "T-Shirt 2", "management_type": "none" } }, { "id": 66668, "state": "rejected", "product_id": 9169277, "quantity": 3, "destination_location_id": 987072, "batch": null, "notes": "packaging_damaged", "attachments": [ { "type": "photo", "url": "https://s3.eu-central-1.amazonaws.com/pulpo-wms-eu-show-attachments/uploads/2314ea75-15d1-4bf2-9c04-a0660583b86c.jpg" } ], "reason_codes": [ { "id": 198, "code": "pulpo_0000001", "name": "return" } ], "product": { "id": 9169277, "sku": "NP0002", "name": "T-Shirt 2", "management_type": "none" } }, { "id": 66669, "state": "accepted", "product_id": 9169281, "quantity": 21, "destination_location_id": 987070, "batch": { "id": 210521, "type": "lot", "number": "654654", "expiration_date": "2028-09-17" }, "notes": null, "product": { "id": 9169281, "sku": "LP0003", "name": "Drink 3", "management_type": "lot" } } ] }, "id": "62fdf462-e2a4-4aa0-a7c3-4fafc4bcfc0d", "status": "triggered", "type": "incoming_good_created", "retry": false, "inserted_at": "2026-09-17T13:14:46", "updated_at": "2026-09-17T13:14:46", "warehouse_id": 2236, "merchant_id": 1053, "merchant_channel_id": 1068, "webhook_id": null, "merchant_channel_name": "default", "merchant_name": "default", "warehouse_name": "simon_warehouse_1" } ``` **Webhook event: **`purchase_order_finished_early` Fired when the warehouse closes the PO early, before every line is fully received — `state: "finished_partially"`. Compare `checked_quantity` against `requested_quantity` per item to see what's short. Sample payload: ```json { "data": { "id": 282362, "type": "purchase_order", "state": "finished_partially", "order_num": "test_delivery_009", "warehouse_id": 2236, "merchant_id": 1053, "merchant_channel_id": null, "delivery_date": "2026-09-17T12:13:13", "notes": "this is a test note", "number_finished_early_events": 1, "third_party": { "id": 3733699, "name": "supplier 1", "third_type": "S", "identifier_number": "43740000_supplier_1", "identifier_type": "DNI", "merchant_id": 1053, "merchant_channel_id": 1068 }, "items": [ { "id": 104526, "state": "pending", "product_id": 9169276, "requested_quantity": 133, "checked_quantity": 34, "product": { "id": 9169276, "sku": "NP0001", "name": "T-Shirt 1", "management_type": "none" } }, { "id": 104528, "state": "pending", "product_id": 9169280, "requested_quantity": 146, "checked_quantity": 36, "product": { "id": 9169280, "sku": "LP0002", "name": "Drink 2", "management_type": "lot" } } ] }, "id": "4b6a63b0-e944-4347-bbfe-08ef8a5686d8", "status": "triggered", "type": "purchase_order_finished_early", "retry": false, "inserted_at": "2026-09-17T12:19:21", "updated_at": "2026-09-17T12:19:21", "warehouse_id": 2236, "merchant_id": 1053, "merchant_channel_id": 1068, "webhook_id": null, "merchant_channel_name": "default", "merchant_name": "default", "warehouse_name": "simon_warehouse_1" } ``` **Webhook event: **`purchase_order_finished` Equivalent to a **Goods Receipt** — every item was fully received and `state` is `closed`. Sample payload: ```json { "data": { "id": 282362, "type": "purchase_order", "state": "closed", "order_num": "test_delivery_009", "warehouse_id": 2236, "merchant_id": 1053, "merchant_channel_id": null, "delivery_date": "2026-09-17T12:13:13", "notes": "this is a test note", "number_finished_early_events": 1, "third_party": { "id": 3733699, "name": "supplier 1", "third_type": "S", "identifier_number": "43740000_supplier_1", "identifier_type": "DNI", "merchant_id": 1053, "merchant_channel_id": 1068 }, "items": [ { "id": 104526, "state": "received", "product_id": 9169276, "requested_quantity": 133, "checked_quantity": 133, "product": { "id": 9169276, "sku": "NP0001", "name": "T-Shirt 1", "management_type": "none" } }, { "id": 104528, "state": "received", "product_id": 9169280, "requested_quantity": 146, "checked_quantity": 146, "product": { "id": 9169280, "sku": "LP0002", "name": "Drink 2", "management_type": "lot" } } ] }, "id": "62294de8-760b-438c-ad6b-3b2b66bab917", "status": "triggered", "type": "purchase_order_finished", "retry": false, "inserted_at": "2026-09-17T12:21:32", "updated_at": "2026-09-17T12:21:32", "warehouse_id": 2236, "merchant_id": 1053, "merchant_channel_id": 1068, "webhook_id": null, "merchant_channel_name": "default", "merchant_name": "default", "warehouse_name": "simon_warehouse_1" } ``` **Webhook event: **`replenishment_order_created` Fired when accepted stock starts moving from reception into storage. Each item shows the origin and destination location; `confirmed_quantity` starts at `0`. Sample payload: ```json { "data": { "id": 47715, "type": "incoming_goods", "state": "queue", "sequence_number": "RE-0000024", "warehouse_id": 2236, "start_date": null, "end_date": null, "items": [ { "id": 68073, "product_id": 9169277, "requested_quantity": 10, "confirmed_quantity": 0, "origin_location_id": 987070, "origin_location_type": { "name": "Reception Location Type" }, "destination_location_id": 986963, "destination_location_type": { "name": "Storage Location Type" }, "batches": [], "product": { "id": 9169277, "sku": "NP0002", "name": "T-Shirt 2", "management_type": "none" } }, { "id": 68074, "product_id": 9169281, "requested_quantity": 121, "confirmed_quantity": 0, "origin_location_id": 987070, "origin_location_type": { "name": "Reception Location Type" }, "destination_location_id": 986950, "destination_location_type": { "name": "Storage Location Type" }, "batches": [], "product": { "id": 9169281, "sku": "LP0003", "name": "Drink 3", "management_type": "lot" } } ] }, "id": "7a919633-5ce0-44b8-9498-f1c4ec40438d", "status": "triggered", "type": "replenishment_order_created", "retry": false, "inserted_at": "2026-09-17T13:14:46", "updated_at": "2026-09-17T13:14:46", "warehouse_id": 2236, "merchant_id": 1053, "merchant_channel_id": 1068, "webhook_id": null, "merchant_channel_name": "default", "merchant_name": "default", "warehouse_name": "simon_warehouse_1" } ``` **Webhook event: **`replenishment_order_finished` Fired once the stock has landed in storage — `state: "ended"` and `confirmed_quantity` matches `requested_quantity` on every item. Lot/serial items list which batch they went into. Sample payload: ```json { "data": { "id": 47715, "type": "incoming_goods", "state": "ended", "sequence_number": "RE-0000024", "warehouse_id": 2236, "start_date": "2026-09-17T13:19:19", "end_date": "2026-09-17T13:21:05", "owner": { "id": 4625, "username": "simon_user1", "first_name": "Lilyan", "last_name": "Rogahn" }, "items": [ { "id": 68073, "product_id": 9169277, "requested_quantity": 10, "confirmed_quantity": 10, "origin_location_id": 987070, "origin_location_type": { "name": "Reception Location Type" }, "destination_location_id": 986963, "destination_location_type": { "name": "Storage Location Type" }, "batches": [ { "id": 29067, "quantity": 10, "batch_id": null, "batch": null } ], "product": { "id": 9169277, "sku": "NP0002", "name": "T-Shirt 2", "management_type": "none" } }, { "id": 68074, "product_id": 9169281, "requested_quantity": 121, "confirmed_quantity": 121, "origin_location_id": 987070, "origin_location_type": { "name": "Reception Location Type" }, "destination_location_id": 986950, "destination_location_type": { "name": "Storage Location Type" }, "batches": [ { "id": 29065, "quantity": 100, "batch_id": 210522, "batch": { "id": 210522, "number": "6548960548", "expiration_date": "2028-09-17" } }, { "id": 29066, "quantity": 21, "batch_id": 210521, "batch": { "id": 210521, "number": "654654", "expiration_date": "2028-09-17" } } ], "product": { "id": 9169281, "sku": "LP0003", "name": "Drink 3", "management_type": "lot" } } ] }, "id": "ead08350-d502-4eae-b573-08b1e179256c", "status": "triggered", "type": "replenishment_order_finished", "retry": false, "inserted_at": "2026-09-17T13:21:05", "updated_at": "2026-09-17T13:21:05", "warehouse_id": 2236, "merchant_id": 1053, "merchant_channel_id": 1068, "webhook_id": null, "merchant_channel_name": "default", "merchant_name": "default", "warehouse_name": "simon_warehouse_1" } ``` > **WARNING: Creating a PO ≠ receiving it** > > `POST /reception/bulk/purchase_orders` only *announces* incoming goods. > The actual receipt happens in the warehouse; watch `purchase_order_finished` to > know when stock has truly arrived. ### Happy path: outgoing process Path: `/guide/outgoing` The outgoing process starts with a **Sales Order** (`type = sales_order`) that is fulfilled in a specific Warehouse. [Products](/guide/products) and the customer (`type = C` Third Party) must already exist — `third_party_id` is required on the Sales Order. So must the shipping method, if you assign one. **Flow: Outgoing: SO → picking → packing → shipping → truck loading (PGI).** 1. **SO** — Create the sales order in bulk. Endpoint: `POST /sales/bulk/orders` 2. **Outgoing Orders** — The SO is split into one or more Fulfillment Orders. 3. **Picking** — Items are picked from storage. Endpoint: `GET /picking/orders` 4. **Packing** — Items are packed into boxes. Endpoint: `GET /packing/orders` 5. **Shipping** — Boxes are shipped. 6. **PIC / PGI** — Post goods issue — the order is fulfilled. Signalled by sales_order_finished. #### Before you start: shipping methods A **shipping method** (carrier + service, e.g. "DHL Standard") must exist before you can assign it to a sales order via `shipping_method_id`. Set your methods up once and keep their ids(3PL fulfillers: , per merchant / single merchants: (nothing)). > **WARNING: Always send merchant_id and merchant_channel_id in the bulk call** > > Otherwise new methods are created without a merchant and can't be found or deleted > afterwards. **Endpoint: Search shipping methods** — `GET /shipping/shipping_methods` (operationId: searchShippingMethods) Look up the `id` to send as `shipping_method_id`. **Endpoint: Get shipping method by ID** — `GET /shipping/shipping_methods/{id}` (operationId: getShippingMethod) Fetch one shipping method by id. **Endpoint: Create a shipping method** — `POST /shipping/shipping_methods` (operationId: createShippingMethod) Create one shipping method. **Endpoint: Bulk create or update shipping methods** — `PUT /shipping/bulk/shipping_methods` (operationId: bulkUpsertShippingMethods) Create or update several methods at once, matched by `name`. **Endpoint: Delete a shipping method** — `DELETE /shipping/shipping_methods/{id}` (operationId: deleteShippingMethod) Delete a method that was never used on an order. #### Endpoints to consume **Endpoint: Create third parties in bulk** — `POST /iam/bulk/third_parties` (operationId: bulkCreateThirdParties) Create the customer (`type = C`) before creating the order — its `id` becomes `third_party_id` below. **Endpoint: Create sales orders in bulk** — `POST /sales/bulk/orders` (operationId: bulkCreateSalesOrders) Create the sales order. Requires `order_num`, `third_party_id`, `priority`, and `ship_to`. (3PL fulfillers: As a 3PL, you must send the correct `merchant_id` and `merchant_channel_id` — they must match the product and customer. / single merchants: As a single merchant, `merchant_channel_id` is optional and resolves to your default channel.) > **Only for single merchants:** > > > **SUCCESS: Simpler for you** > > > > You can omit `merchant_id` / `merchant_channel_id` — Pulpo assigns your single default. **Endpoint: Search sales orders** — `GET /sales/orders` (operationId: searchSalesOrders) Track orders. Supports `delivery_date`, `inserted_at`, `updated_at` filters with `between:`, `gte:`, `lte:` prefixes. **Endpoint: Attach a file to a sales order** — `POST /sales/orders/{id}/attach` (operationId: attachFileToSalesOrder) Attach a file such as a **delivery note** to the sales order: `type = document`, `document_type = delivery_note`. One file per call. **Endpoint: Delete a sales order attachment** — `DELETE /sales/orders/{id}/attachments/{attachment_id}` (operationId: deleteSalesOrderAttachment) Remove an attachment again, by its `attachments[].id`. ##### Create picklists Picklists are created from **fulfillment orders** (`fulfillment_orders[].id` on the sales order), not from sales orders. Pick the call that matches your picking type: | Picking type | Picklists | Call | | ------------------------ | -------------------------------- | ----------------------------------------- | | **Standard** | One per order | `POST /picking/bulk/orders` | | **Batch** | One for all orders | `POST /picking/orders` with `cart: false` | | **Cart** | One for all orders, cart mode | `POST /picking/orders` with `cart: true` | | **Turbo label standard** | One per order, labels first | `POST /picking/bulk/orders/turbo` | | **Turbo label batch** | One for all orders, labels first | `POST /picking/orders/turbo` | Batch and cart are all or nothing: if one order can't be picked, no picklist is created. Standard handles each order on its own, so check both `created` and `errors`. > **NOTE: Turbo label picking is asynchronous** > > The turbo calls answer `204` right away. Labels are then fetched from the carrier in the > background, which can take a while. Poll the orders with `GET /sales/orders/fulfillments` > until `process_information.status` is `turbo_label_created` (done) or > `error_creating_picking` (see `errors`, the order can be sent again). Only trust a status > whose `attributes.request_id` matches the `x-request-id` header of your call. **Endpoint: Create standard picklists (one per order)** — `POST /picking/bulk/orders` (operationId: bulkCreatePickingOrders) Standard picking. Optionally assign `pickers`. **Endpoint: Create a batch or cart picklist** — `POST /picking/orders` (operationId: createPickingOrder) Batch or cart picking. **Endpoint: Create turbo label standard picklists (asynchronous)** — `POST /picking/bulk/orders/turbo` (operationId: bulkCreateTurboPickingOrders) Turbo label standard picking. One label per unit, or per order with `turbo_label_per_order`. **Endpoint: Create a turbo label batch picklist (asynchronous)** — `POST /picking/orders/turbo` (operationId: createTurboPickingOrder) Turbo label batch picking. Cart mode is not supported. **Endpoint: Search fulfillment orders** — `GET /sales/orders/fulfillments` (operationId: searchFulfillmentOrders) Find fulfillment order ids and check the turbo label progress. **Endpoint: Delete picklists in bulk** — `DELETE /picking/bulk/orders` (operationId: bulkDeletePickingOrders) Delete picklists. The orders go back to `queue` and can be picked again, turbo labels are removed. #### Events you can subscribe to **Webhook event: **`sales_order_created` Fired right after the order is created, before picking starts. `fulfillment_orders` lists the execution unit(s) the SO was split into. Sample payload: ```json { "data": { "id": 26167904, "order_num": "ORDER_587493", "type": "sales_order", "state": "queue", "priority": 2, "delivery_date": "2026-09-17T21:59:59", "notes": "This is an order note", "warehouse_id": 2236, "merchant_id": 1053, "merchant_channel_id": 1068, "third_party_id": 3733698, "shipping_method_id": 2832, "estimated_total_weight": 2952, "estimated_total_volume": 28, "attributes": { "manually_created": true }, "fulfillment_orders": [ { "id": 14262803, "state": "queue" } ], "creator": { "id": 4625, "username": "simon_user1", "first_name": "Lilyan", "last_name": "Rogahn" }, "inserted_at": "2026-09-17T13:23:35", "updated_at": "2026-09-17T13:23:35", "third_party": { "id": 3733698, "name": "customer 1", "third_type": "C", "identifier_number": "43740000_customer_1", "identifier_type": "DNI", "merchant_id": 1053, "merchant_channel_id": 1068 }, "ship_to": { "name": "Braun and Sons", "company_name": "Oberbrunner Inc", "phone_number": "(785) 703-7088", "address": { "street": "412 Willms Underpass", "street2": "Apt. 848", "city": "New Elyse", "post_number": "47290", "country": "Montenegro", "country_alpha2": "ME", "country_code": "499", "email": "reynold.cremin@herman.biz" } }, "items": [ { "id": 9871264, "product_id": 9169279, "quantity": 12, "fulfilled_quantity": null, "required_date": "2026-10-31T22:59:59", "notes": "this is a LOT product", "batches": [], "product": { "id": 9169279, "sku": "LP0001", "name": "Drink 1", "management_type": "lot" } }, { "id": 9871265, "product_id": 9169283, "quantity": 4, "fulfilled_quantity": null, "required_date": null, "notes": "this is a serial product with some suggested serials", "batches": [ { "id": 4372, "batch_id": 210493, "suggested_quantity": 1, "batch": { "id": 210493, "type": "serial", "number": "345345645" } }, { "id": 4373, "batch_id": 210494, "suggested_quantity": 1, "batch": { "id": 210494, "type": "serial", "number": "345354333" } } ], "product": { "id": 9169283, "sku": "SP0002", "name": "Television 2", "management_type": "serial" } } ] }, "id": "5ca7db75-9d0c-4eec-ad4e-e036614bbe32", "status": "triggered", "type": "sales_order_created", "retry": false, "inserted_at": "2026-09-17T13:23:35", "updated_at": "2026-09-17T13:23:35", "warehouse_id": 2236, "merchant_id": 1053, "merchant_channel_id": 1068, "webhook_id": null, "merchant_channel_name": "default", "merchant_name": "default", "warehouse_name": "simon_warehouse_1" } ``` **Webhook event: **`sales_order_updated` Fired when any field on the order changes. The only sales order event with `pre_event_data` — the order as it was right before the change — so you can diff it against `data` instead of guessing. Note that updating items replaces the full item list rather than editing lines in place. Sample payload: ```json { "data": { "id": 26167904, "order_num": "ORDER_587493", "state": "queue", "delivery_date": "2026-09-30T21:59:59", "notes": "This is a new order note", "estimated_total_weight": 3336, "estimated_total_volume": 40, "fulfillment_orders": [ { "id": 14262841, "state": "queue" } ], "updated_at": "2026-09-17T13:24:34", "items": [ { "id": 9871265, "product_id": 9169283, "quantity": 4, "notes": "this is a serial product with some suggested serials", "product": { "id": 9169283, "sku": "SP0002", "name": "Television 2", "management_type": "serial" } }, { "id": 9871310, "product_id": 9169279, "quantity": 12, "notes": "this is a LOT product", "product": { "id": 9169279, "sku": "LP0001", "name": "Drink 1", "management_type": "lot" } } ] }, "id": "f602d347-dee9-4a0f-8add-aabec9b2820e", "status": "triggered", "type": "sales_order_updated", "retry": false, "inserted_at": "2026-09-17T13:24:34", "updated_at": "2026-09-17T13:24:34", "warehouse_id": 2236, "merchant_id": 1053, "merchant_channel_id": 1068, "webhook_id": null, "merchant_channel_name": "default", "merchant_name": "default", "warehouse_name": "simon_warehouse_1", "pre_event_data": { "id": 26167904, "order_num": "ORDER_587493", "state": "queue", "delivery_date": "2026-09-17T21:59:59", "notes": "This is an order note", "estimated_total_weight": 2952, "estimated_total_volume": 28, "fulfillment_orders": [ { "id": 14262803, "state": "queue" } ], "updated_at": "2026-09-17T13:23:35", "items": [ { "id": 9871265, "product_id": 9169283, "quantity": 4, "notes": "this is a serial product with some suggested serials", "product": { "id": 9169283, "sku": "SP0002", "name": "Television 2", "management_type": "serial" } }, { "id": 9871264, "product_id": 9169279, "quantity": 12, "notes": "this is a LOT product", "product": { "id": 9169279, "sku": "LP0001", "name": "Drink 1", "management_type": "lot" } } ] } } ``` **Webhook event: **`sales_order_cancelled` Fired when the order is cancelled — `state` and `fulfillment_orders[0].state` both flip to `cancelled`. `state_transitions` gives the full history of state changes; for returns, `reason_codes` and `return_labels` may be populated too. Sample payload: ```json { "data": { "id": 24104938, "order_num": "batch_print_001_copy_03", "state": "cancelled", "delivery_date": "2026-08-03T00:00:00", "priority": 2, "warehouse_id": 2236, "merchant_id": 1053, "merchant_channel_id": 1068, "third_party_id": 4271360, "shipping_method_id": 2832, "updated_at": "2026-09-17T13:28:30", "fulfillment_orders": [ { "id": 13149181, "state": "cancelled" } ], "reason_codes": [ { "id": 198, "code": "pulpo_0000001", "name": "return" } ], "return_labels": [ { "id": 29673, "return_code": "PA-0000044-71898" } ], "state_transitions": [ { "id": 594236, "previous_state": "queue", "new_state": "picking", "updated_at": "2026-08-05T05:42:42", "performer_name": "simon_user1" }, { "id": 594385, "previous_state": "picking", "new_state": "queue", "updated_at": "2026-08-06T09:41:47", "performer_name": "simon_user1" }, { "id": 616036, "previous_state": "queue", "new_state": "cancelled", "updated_at": "2026-09-17T13:28:30", "performer_name": "simon_user1" } ], "items": [ { "id": 8553774, "product_id": 9169276, "quantity": 1, "product": { "id": 9169276, "sku": "NP0001", "name": "T-Shirt 1", "management_type": "none" } } ] }, "id": "e0b41228-3bbb-472b-b9a1-51c17150cccb", "status": "triggered", "type": "sales_order_cancelled", "retry": false, "inserted_at": "2026-09-17T13:28:30", "updated_at": "2026-09-17T13:28:30", "warehouse_id": 2236, "merchant_id": 1053, "merchant_channel_id": 1068, "webhook_id": null, "merchant_channel_name": "default", "merchant_name": "default", "warehouse_name": "simon_warehouse_1", "pre_event_data": null } ``` **Webhook event: **`picking_order_created` Fired when the warehouse task to pick a fulfillment order's items is created. Each item links back to `sales_order_id` and `fulfillment_order_id`; `picked_quantity` starts at `0`. Sample payload: ```json { "data": { "id": 76130, "type": "normal", "state": "queue", "sequence_number": "PI-0000069", "warehouse_id": 2236, "notes": "THIS IS A TEST PICKING NOTE", "start_date": null, "end_date": null, "creator": { "id": 4625, "username": "simon_user1", "first_name": "Lilyan", "last_name": "Rogahn" }, "inserted_at": "2026-09-17T13:31:45", "updated_at": "2026-09-17T13:31:45", "items": [ { "id": 290052, "sales_order_id": 26167904, "fulfillment_order_id": 14262841, "product_id": 9169276, "requested_quantity": 12, "picked_quantity": 0, "suggested_batches": [], "product": { "id": 9169276, "sku": "NP0001", "name": "T-Shirt 1", "management_type": "none" } }, { "id": 290055, "sales_order_id": 26167904, "fulfillment_order_id": 14262841, "product_id": 9169283, "requested_quantity": 4, "picked_quantity": 0, "suggested_batches": [ { "id": 1811, "quantity": 1, "batch_id": 210493, "batch": { "id": 210493, "type": "serial", "number": "345345645" } }, { "id": 1812, "quantity": 1, "batch_id": 210494, "batch": { "id": 210494, "type": "serial", "number": "345354333" } } ], "product": { "id": 9169283, "sku": "SP0002", "name": "Television 2", "management_type": "serial" } } ] }, "id": "0f8c39a6-3aac-466d-883b-13111f1ab959", "status": "triggered", "type": "picking_order_created", "retry": false, "inserted_at": "2026-09-17T13:31:45", "updated_at": "2026-09-17T13:31:45", "warehouse_id": 2236, "merchant_id": 1053, "merchant_channel_id": 1068, "webhook_id": null, "merchant_channel_name": "default", "merchant_name": "default", "warehouse_name": "simon_warehouse_1", "pre_event_data": null } ``` **Webhook event: **`picking_order_finished` Fired once picking is done — `state: "ended"` and `picked_quantity` matches `requested_quantity` on every item. `batches` now lists which batch/location each unit was actually picked from (`suggested_batches` was just the pre-pick suggestion). Sample payload: ```json { "data": { "id": 76130, "type": "normal", "state": "ended", "sequence_number": "PI-0000069", "warehouse_id": 2236, "notes": "THIS IS A TEST PICKING NOTE", "start_date": "2026-09-23T13:27:17", "end_date": "2026-09-23T13:28:11", "creator": { "id": 4625, "username": "simon_user1", "first_name": "Lilyan", "last_name": "Rogahn" }, "items": [ { "id": 290052, "sales_order_id": 26167904, "fulfillment_order_id": 14262841, "product_id": 9169276, "requested_quantity": 12, "picked_quantity": 12, "batches": [ { "id": 60590, "quantity": 12, "batch_id": null, "origin_location_id": 986900 } ], "product": { "id": 9169276, "sku": "NP0001", "name": "T-Shirt 1", "management_type": "none" } }, { "id": 290055, "sales_order_id": 26167904, "fulfillment_order_id": 14262841, "product_id": 9169283, "requested_quantity": 4, "picked_quantity": 4, "batches": [ { "id": 60589, "quantity": 1, "batch_id": 210504, "origin_location_id": 986915, "batch": { "id": 210504, "type": "serial", "number": "3453543" } }, { "id": 60591, "quantity": 1, "batch_id": 210520, "origin_location_id": 986901, "batch": { "id": 210520, "type": "serial", "number": "345345654" } } ], "product": { "id": 9169283, "sku": "SP0002", "name": "Television 2", "management_type": "serial" } } ] }, "id": "db1c40e5-19b5-4bb6-9f4b-80086d38098c", "status": "triggered", "type": "picking_order_finished", "params": { "skip_packing_enabled": false, "shipping_process_enabled": true, "shipping_location_id": null }, "retry": false, "inserted_at": "2026-09-23T13:28:11", "updated_at": "2026-09-23T13:28:11", "warehouse_id": 2236, "merchant_id": 1053, "merchant_channel_id": 1068, "webhook_id": null, "merchant_channel_name": "default", "merchant_name": "default", "warehouse_name": "simon_warehouse_1", "pre_event_data": null } ``` **Webhook event: **`packing_order_created` Fired when the packing task is created, right after picking finishes. Each item already carries the picked `batches` to pack; `packed_quantity` is `null` until packing starts. Sample payload: ```json { "data": { "id": 46093, "type": "normal", "state": "queue", "sequence_number": "PA-0000054", "warehouse_id": 2236, "fulfillment_order_id": 14262841, "sales_order_id": 26167904, "origin_location_id": 1065394, "destination_location_id": null, "start_date": null, "end_date": null, "inserted_at": "2026-09-23T13:28:10", "updated_at": "2026-09-23T13:28:10", "sales_order": { "order_num": "ORDER_587493", "third_party": { "id": 3733698, "name": "customer 1" } }, "fulfillment_order": { "sequence_number": "FO-0000071", "order_num": "ORDER_587493" }, "items": [ { "id": 66631, "product_id": 9169276, "requested_quantity": 12, "packed_quantity": null, "batches": [ { "id": 58999, "quantity": 12, "batch_id": null, "cart_box_id": null } ], "product": { "id": 9169276, "sku": "NP0001", "name": "T-Shirt 1", "management_type": "none" } }, { "id": 66634, "product_id": 9169283, "requested_quantity": 4, "packed_quantity": null, "batches": [ { "id": 59002, "quantity": 1, "batch_id": 210504, "cart_box_id": null, "batch": { "id": 210504, "type": "serial", "number": "3453543" } }, { "id": 59003, "quantity": 1, "batch_id": 210518, "cart_box_id": null, "batch": { "id": 210518, "type": "serial", "number": "5646234" } } ], "product": { "id": 9169283, "sku": "SP0002", "name": "Television 2", "management_type": "serial" } } ] }, "id": "5196ec1f-275f-43bc-91cf-b1ef8e058235", "status": "triggered", "type": "packing_order_created", "retry": false, "inserted_at": "2026-09-23T13:28:11", "updated_at": "2026-09-23T13:28:11", "warehouse_id": 2236, "merchant_id": 1053, "merchant_channel_id": 1068, "webhook_id": null, "merchant_channel_name": "default", "merchant_name": "default", "warehouse_name": "simon_warehouse_1", "pre_event_data": null } ``` **Webhook event: **`packing_order_finished` Fired once packing is done — `state: "ended"` and `packed_quantity` matches `requested_quantity` on every item. `packing_boxes` lists the closed boxes, each with its `shipment_tracking` status and, once a label was generated, an `attachments` entry for the label file. Sample payload: ```json { "data": { "id": 46093, "type": "normal", "state": "ended", "sequence_number": "PA-0000054", "warehouse_id": 2236, "fulfillment_order_id": 14262841, "sales_order_id": 26167904, "origin_location_id": 1065394, "start_date": "2026-09-23T13:36:19", "end_date": null, "inserted_at": "2026-09-23T13:28:10", "updated_at": "2026-09-23T13:39:19", "sales_order": { "order_num": "ORDER_587493", "third_party": { "id": 3733698, "name": "customer 1" } }, "fulfillment_order": { "sequence_number": "FO-0000071", "order_num": "ORDER_587493" }, "items": [ { "id": 66631, "product_id": 9169276, "requested_quantity": 12, "packed_quantity": 12, "batches": [ { "id": 58999, "quantity": 12, "batch_id": null, "cart_box_id": null } ], "product": { "id": 9169276, "sku": "NP0001", "name": "T-Shirt 1", "management_type": "none" } }, { "id": 66634, "product_id": 9169283, "requested_quantity": 4, "packed_quantity": 4, "batches": [ { "id": 59002, "quantity": 1, "batch_id": 210504, "cart_box_id": null, "batch": { "id": 210504, "type": "serial", "number": "3453543" } }, { "id": 59003, "quantity": 1, "batch_id": 210518, "cart_box_id": null, "batch": { "id": 210518, "type": "serial", "number": "5646234" } } ], "product": { "id": 9169283, "sku": "SP0002", "name": "Television 2", "management_type": "serial" } } ], "packing_boxes": [ { "id": 72384, "name": "BOX S", "state": "packed", "box_number": 1, "length": 20, "width": 15, "height": 10, "weight": 336.2, "attachments": [ { "id": "5cdee5d4-70bb-446b-a9eb-b9dbda0c5151", "type": "label", "extension": "pdf", "url": "https://s3.eu-central-1.amazonaws.com/pulpo-wms-eu-show-attachments/uploads/5cdee5d4-70bb-446b-a9eb-b9dbda0c5151.pdf" } ], "shipment_tracking": { "id": 63898, "status": "pulpowms_label_generated", "tracking_code": "PA-0000054-72384" } } ] }, "id": "23f5ddab-8189-491a-b814-71190b0272d7", "status": "triggered", "type": "packing_order_finished", "retry": false, "inserted_at": "2026-09-23T13:39:19", "updated_at": "2026-09-23T13:39:19", "warehouse_id": 2236, "merchant_id": 1053, "merchant_channel_id": 1068, "webhook_id": null, "merchant_channel_name": "default", "merchant_name": "default", "warehouse_name": "simon_warehouse_1", "pre_event_data": null } ``` **Webhook event: **`packing_order_closed` `packing_order_finished` and `packing_order_closed` mark different moments — `finished` fires while the warehouse user is still in the packing app (labels can still be attached for them to print); `closed` fires once the order has actually left that workflow and no one is on it anymore. `destination_location_id` and `params.shipping_location_id` are only populated here, once the box's next location is known. Sample payload: ```json { "data": { "id": 46093, "type": "normal", "state": "closed", "sequence_number": "PA-0000054", "warehouse_id": 2236, "fulfillment_order_id": 14262841, "sales_order_id": 26167904, "origin_location_id": 1065394, "destination_location_id": 987074, "start_date": "2026-09-23T13:36:19", "end_date": "2026-09-23T13:41:04", "inserted_at": "2026-09-23T13:28:10", "updated_at": "2026-09-23T13:41:04", "sales_order": { "order_num": "ORDER_587493", "third_party": { "id": 3733698, "name": "customer 1" } }, "fulfillment_order": { "sequence_number": "FO-0000071", "order_num": "ORDER_587493" }, "items": [ { "id": 66631, "product_id": 9169276, "requested_quantity": 12, "packed_quantity": 12, "product": { "id": 9169276, "sku": "NP0001", "name": "T-Shirt 1", "management_type": "none" } } ], "packing_boxes": [ { "id": 72384, "name": "BOX S", "state": "packed", "box_number": 1, "shipment_tracking": { "id": 63898, "status": "pulpowms_label_generated", "tracking_code": "PA-0000054-72384" } } ] }, "id": "c6917133-8f5c-4eea-932f-c1e25115dda1", "status": "triggered", "type": "packing_order_closed", "params": { "skip_packing_enabled": false, "shipping_process_enabled": true, "shipping_location_id": 987074 }, "retry": false, "inserted_at": "2026-09-23T13:41:04", "updated_at": "2026-09-23T13:41:04", "warehouse_id": 2236, "merchant_id": 1053, "merchant_channel_id": 1068, "webhook_id": null, "merchant_channel_name": "default", "merchant_name": "default", "warehouse_name": "simon_warehouse_1", "pre_event_data": null } ``` **Webhook event: **`sales_order_finished` Equivalent to **Post Goods Issue (PGI)** — `state: "ended"` and `fulfilled_quantity` matches `quantity` on every item. For lot/serial-managed items, `shipped_batches` lists exactly which batch/lot/serial units went out. `return_labels` may already carry a code if a return was pre-generated for this shipment. Sample payload: ```json { "data": { "id": 26167904, "order_num": "ORDER_587493", "state": "ended", "delivery_date": "2026-09-30T21:59:59", "notes": "This is a new order note", "warehouse_id": 2236, "merchant_id": 1053, "merchant_channel_id": 1068, "third_party_id": 3733698, "shipping_method_id": 2832, "fulfillment_orders": [ { "id": 14262841, "state": "ended" } ], "return_labels": [ { "id": 29896, "return_code": "PA-0000054-72384" } ], "state_transitions": [ { "id": 616037, "previous_state": "queue", "new_state": "picking", "updated_at": "2026-09-17T13:31:45", "performer_name": "simon_user1" }, { "id": 621559, "previous_state": "picking", "new_state": "packing", "updated_at": "2026-09-23T13:28:10", "performer_name": "simon_user1" }, { "id": 621564, "previous_state": "packing", "new_state": "shipping", "updated_at": "2026-09-23T13:41:03", "performer_name": "simon_user1" }, { "id": 621565, "previous_state": "shipping", "new_state": "ended", "updated_at": "2026-09-23T13:42:58", "performer_name": "simon_user1" } ], "items": [ { "id": 9871263, "product_id": 9169276, "quantity": 12, "fulfilled_quantity": 12, "shipped_batches": [], "product": { "id": 9169276, "sku": "NP0001", "name": "T-Shirt 1", "management_type": "none" } }, { "id": 9871265, "product_id": 9169283, "quantity": 4, "fulfilled_quantity": 4, "shipped_batches": [ { "quantity": 1, "batch_id": 210504, "batch_number": "3453543", "batch_type": "serial" }, { "quantity": 1, "batch_id": 210518, "batch_number": "5646234", "batch_type": "serial" } ], "product": { "id": 9169283, "sku": "SP0002", "name": "Television 2", "management_type": "serial" } } ] }, "id": "5653dfbd-c97f-4d7d-9203-232b022beba6", "status": "triggered", "type": "sales_order_finished", "retry": false, "inserted_at": "2026-09-23T13:42:58", "updated_at": "2026-09-23T13:42:58", "warehouse_id": 2236, "merchant_id": 1053, "merchant_channel_id": 1068, "webhook_id": null, "merchant_channel_name": "default", "merchant_name": "default", "warehouse_name": "simon_warehouse_1", "pre_event_data": null } ``` **Webhook event: **`fulfillment_order_finished` Fires at the **fulfillment order** level, alongside `sales_order_finished` — a sales order can have more than one fulfillment order (partial fulfillment, multi-warehouse), so watch this one if you need per-FO completion rather than whole-order. Each item links back to the sales order's line via `sales_item_id`; oddly, `fulfilled_quantity` stays `null` here even though `state` is `"ended"` — use `sales_order_finished`'s items if you need the actually-fulfilled quantities. Sample payload: ```json { "data": { "id": 14262841, "sequence_number": "FO-0000071", "order_num": "ORDER_587493", "state": "ended", "sales_order_id": 26167904, "warehouse_id": 2236, "merchant_id": 1053, "merchant_channel_id": 1068, "third_party_id": 3733698, "shipping_method_id": 2832, "packing_location_id": 1065394, "delivery_date": "2026-09-30T21:59:59", "notes": "This is a new order note", "inserted_at": "2026-09-17T13:24:34", "updated_at": "2026-09-23T13:42:58", "return_labels": [ { "id": 29896, "return_code": "PA-0000054-72384" } ], "items": [ { "id": 9887789, "sales_item_id": 9871263, "product_id": 9169276, "quantity": 12, "fulfilled_quantity": null, "product": { "id": 9169276, "sku": "NP0001", "name": "T-Shirt 1", "management_type": "none" } } ] }, "id": "a9890438-894c-48a8-bf89-66f45746a5d7", "status": "triggered", "type": "fulfillment_order_finished", "params": { "shipping_process_enabled": true, "shipping_location_id": 987074 }, "retry": false, "inserted_at": "2026-09-23T13:42:58", "updated_at": "2026-09-23T13:42:58", "warehouse_id": 2236, "merchant_id": 1053, "merchant_channel_id": 1068, "webhook_id": null, "merchant_channel_name": "default", "merchant_name": "default", "warehouse_name": "simon_warehouse_1", "pre_event_data": null } ``` > **TIP: Generating shipping labels?** > > If an external system produces your shipping labels, follow the dedicated > [Shipping Label Provider](/label-provider/overview) track — it covers the packing > webhooks, the shipment-tracking state machine and the attach endpoint end to end. ### Returns Path: `/guide/returns` Returns run in two directions: goods coming back **from a customer**, and goods going back **to a supplier**. #### From client / customer The process starts with a **Purchase Order** (`type = return`) received in a specific warehouse, referencing the original Sales Order (`sales_order_id`). A spontaneous return (without an incoming PO) is also possible directly in the warehouse app — the outgoing customer (`type = C`) is used as the supplier of the incoming replenishment. **Flow** 1. **Return from customer** — Goods come back referencing the original sales order. 2. **PO (type=return)** — Create a return purchase order. Endpoint: `POST /reception/bulk/purchase_orders` #### To supplier The process starts with a **Sales Order** (`type = return`) received in a specific warehouse, where the defined supplier for that product becomes the Third Party (`type = C`). Most customers reject the material in the incoming process within the app and readjust stock with a counting task, or send it to a cross-docking / return location and take it out following the normal Sales Order process. **Flow** 1. **Return to supplier** — Goods leave the warehouse back to the supplier. 2. **SO (type=return)** — Create a return sales order. Endpoint: `POST /sales/bulk/orders` #### Endpoints & events **Endpoint: Create purchase orders in bulk** — `POST /reception/bulk/purchase_orders` (operationId: bulkCreatePurchaseOrders)Return from customer — `type = return`. **Endpoint: Create sales orders in bulk** — `POST /sales/bulk/orders` (operationId: bulkCreateSalesOrders)Return to supplier — `type = return`. Subscribe to `sales_order_created` (`type = return`). > **TIP: Label providers** > > For the detailed return recipe with field-level requirements and batch resolution, see the > [Shipping Label Provider · Returns](/label-provider/returns) page. ### Stock transfer between warehouses Path: `/guide/stock-transfer` A stock transfer starts with a **Sales Order** (`type = warehouse_movement`) in the source warehouse. Pulpo automatically creates a matching **Purchase Order** (`type = warehouse_movement`) in the destination warehouse (`destination_warehouse_id` on the Sales Order), carrying the information needed for the incoming process there. **Flow: One transfer = an outgoing SO in the source + an auto-created incoming PO in the destination.** 1. **SO (warehouse_movement)** — Created in the source warehouse. Endpoint: `POST /sales/bulk/orders` 2. **Picking → Packing → Shipping** — Standard outgoing flow in the source. 3. **PGI** — Goods leave the source warehouse. 4. **PO (warehouse_movement)** — Auto-created in the destination warehouse. 5. **Incoming → GR** — Received into the destination. #### Endpoints & events **Endpoint: Create sales orders in bulk** — `POST /sales/bulk/orders` (operationId: bulkCreateSalesOrders) Create the transfer with `type = warehouse_movement` and a `destination_warehouse_id`. Subscribe to `sales_order_created` (`type = warehouse_movement`). ### POS orders — stock-only Path: `/guide/pos-orders` Sometimes you just need to reduce outgoing stock with an incoming sales order, without going through picking, packing and shipping, and without a specific customer. Use a generic template Third Party (`type = C`) and create a Sales Order with `type = POS_external`. The sales order changes its status directly to **finished** and is considered fully fulfilled for all purposes. **Flow** 1. **SO (POS_external)** — Created with a generic customer template. Endpoint: `POST /sales/bulk/orders` 2. **Shipping** — Skipped operationally — stock is simply issued. 3. **PGI (finished)** — Order is immediately considered fulfilled. #### Endpoints & events **Endpoint: Create sales orders in bulk** — `POST /sales/bulk/orders` (operationId: bulkCreateSalesOrders)Create with `type = POS_external`. Subscribe to `sales_order_finished` (`type = POS_external`). ### Kitting Path: `/guide/kitting` To create a new product as the result of a set of products (a kit), first create the new **Product** as normal master data. Then create the **Kit** — the template of what the product contains. The actual creation of the new product is triggered by executing a **Kitting Task**. **Flow: Create the kit product → define the kit template → run the kitting task.** 1. **Create product for the kit** — Master-data entry for the new product. Endpoint: `POST /inventory/bulk/products` 2. **Create kit template** — Define the components the product contains. Endpoint: `POST /inventory/kits` 3. **Create kitting task** — Execute to build the new product. Endpoint: `POST /kitting/tasks` 4. **Stocks update** — Components decrease; the new product's stock increases. #### Endpoints & events **Endpoint: Create products in bulk** — `POST /inventory/bulk/products` (operationId: bulkCreateProducts)Create the kit product (master data). **Endpoint: Create kit template** — `POST /inventory/kits` (operationId: createKit)Define the kit template. **Endpoint: Create kitting task** — `POST /kitting/tasks` (operationId: createKittingTask)Trigger the actual build. Events: - `replenishment_order_created` (`type = kit_move`) — components moved to the kitting area; the stock of the original products is decreased. - `replenishment_order_finished` (`type = kitting`) — task finished; products moved from the kitting area to storage. The stock of the new product is increased. ### Stock changes Path: `/guide/stock-changes` Beyond the order flows, you often need the current stock picture. Pulpo exposes both webhooks that include stock updates and endpoints to query stock per product and per location. #### Query endpoints **Endpoint: Get stock summary** — `GET /inventory/stocks/summary` (operationId: getStockSummary)Aggregated stock summary per product. **Endpoint: Get stock by product and location** — `POST /inventory/stocks/products/locations` (operationId: getStockByLocation)Stock per product and per location. **Endpoint: List stock records** — `GET /inventory/stocks` (operationId: listStocks)List stock records with filtering. #### Correcting stock **Endpoint: Correct stock at a location** — `POST /inventory/stocks/correct` (operationId: correctStock) Add or remove stock for a product at a location. `quantity` is signed — positive adds, negative removes. Not a `/bulk/` path, but you can still send multiple `items` in one request. For a plain product (not lot or serial managed), send `location_id`, `product_id`, and `quantity`: ```json { "warehouse_id": 140, "items": [ { "location_id": 229364, "product_id": 1957711, "quantity": 5 } ] } ``` For a lot or serial managed product, also include `item_batches` — one entry per batch affected. For a `serial` product each batch's `quantity` must be `1` (a serial is a single unique unit); for `lot` it can be any amount: ```json { "warehouse_id": 140, "items": [ { "location_id": 229364, "product_id": 1957712, "quantity": 5, "item_batches": [ { "batch_id": 45231, "quantity": 5 } ] } ] } ``` > **WARNING: Removing more than is available** > > A negative `quantity` larger than what's actually at that location is rejected with a > 422 (`not_enough_stock_to_remove_for_given_location_product_batch`), not silently > floored at zero. > **TIP: Recommended batch size** > > Up to 50 corrections (`items` entries) per request. #### Events Several webhooks carry stock update information — for example the incoming `replenishment_order_finished` (stock available), kitting stock movements, and counting/audit adjustments. Subscribe to the ones relevant to your reconciliation logic. **Webhook event: **`stock_correction_finished` Fired after a `correctStock` call completes. `items[].quantity` is the same signed delta you sent — negative here means stock was removed. `reason_codes` is only present if you sent one. Sample payload: ```json { "data": { "id": 55441, "sequence_number": "SC-0000022", "warehouse_id": 2236, "owner_id": 4625, "owner": { "id": 4625, "username": "simon_user1", "first_name": "Lilyan", "last_name": "Rogahn" }, "comment": null, "reason_codes": [ { "id": 198, "code": "pulpo_0000001", "name": "return" } ], "inserted_at": "2026-09-23T13:46:40", "items": [ { "id": 219246, "product_id": 9169276, "location_id": 986900, "quantity": -12, "batches": [], "loading_unit_location_id": null, "location": { "id": 986900, "code": "M-1-1-1-1-1", "warehouse_id": 2236 }, "product": { "id": 9169276, "sku": "NP0001", "name": "T-Shirt 1", "management_type": "none" } } ] }, "id": "587e93c6-8e90-416b-ab07-04aa88e48926", "status": "triggered", "type": "stock_correction_finished", "retry": false, "inserted_at": "2026-09-23T13:46:40", "updated_at": "2026-09-23T13:46:40", "warehouse_id": 2236, "merchant_id": 1053, "merchant_channel_id": 1068, "webhook_id": null, "merchant_channel_name": "default", "merchant_name": "default", "warehouse_name": "simon_warehouse_1", "pre_event_data": null } ``` **Webhook event: **`counting_task_closed` Fired when a counting/audit task for a location is closed. Per item, compare `quantity` (what the counter found) against `current_stock_quantity` (what the system had on record) to spot discrepancies — surplus, shortage, or a match. Batch-controlled products get one item per batch; `reason_codes` explains a counted discrepancy when the counter logged one. Sample payload: ```json { "data": { "id": 37194, "type": "location", "state": "closed", "sequence_number": "CT-0000012", "warehouse_id": 2236, "location_id": 986900, "location": { "id": 986900, "code": "M-1-1-1-1-1", "warehouse_id": 2236 }, "owner_id": 4625, "counter_id": 4625, "auditor_id": 4625, "auditor": { "id": 4625, "username": "simon_user1", "first_name": "Lilyan", "last_name": "Rogahn" }, "count_iteration": 1, "inserted_at": "2026-09-23T13:49:20", "iteration_started_at": "2026-09-23T13:49:39", "audited_at": "2026-09-23T13:51:28", "items": [ { "id": 69347, "product_id": 9169276, "location_id": 986900, "quantity": 400, "current_stock_quantity": 507, "batch_id": null, "is_valid": true, "reason_codes": [], "product": { "id": 9169276, "sku": "NP0001", "name": "T-Shirt 1", "management_type": "none" } }, { "id": 69349, "product_id": 10277019, "location_id": 986900, "quantity": 12, "current_stock_quantity": 0, "batch_id": null, "is_valid": true, "reason_codes": [ { "reason_type": "counter", "reason_code": { "id": 198, "code": "pulpo_0000001", "name": "return" } } ], "product": { "id": 10277019, "sku": "TEST-WNNUOK", "name": "Classic Wireless Mouse A5 WNNUOK", "management_type": "none" } }, { "id": 69351, "product_id": 9169279, "location_id": 986900, "quantity": 0, "current_stock_quantity": 100, "batch_id": 204317, "batch": { "id": 204317, "number": "432432", "expiration_date": "2029-07-09" }, "is_valid": true, "reason_codes": [], "product": { "id": 9169279, "sku": "LP0001", "name": "Drink 1", "management_type": "lot" } } ] }, "id": "14b9b1d9-4017-41c0-96d8-baeb291faad3", "status": "triggered", "type": "counting_task_closed", "retry": false, "inserted_at": "2026-09-23T13:51:28", "updated_at": "2026-09-23T13:51:28", "warehouse_id": 2236, "merchant_id": 1053, "merchant_channel_id": 1068, "webhook_id": null, "merchant_channel_name": "default", "merchant_name": "default", "warehouse_name": "simon_warehouse_1", "pre_event_data": null } ``` > **TIP: Reconcile efficiently** > > Prefer the aggregated summary endpoint for periodic reconciliation, and rely on webhooks for > near-real-time deltas. See [best practices](/guide/best-practices) for pagination and rate > limits. ### Loading units Path: `/guide/loading-units` Summary: Describe pallets, boxes, bags and mixed containers on a purchase order A purchase order can describe not only *what* is expected (`items`) but *how it physically arrives* — on pallets, in boxes, bags, bins, or mixed containers. These physical units are **loading units**, sent in the `packagings` array of the `POST /reception/bulk/purchase_orders` request body, alongside `items`. #### Create a purchase order with a loading unit The simplest case: each SKU arrives in its own box, sitting directly at the location (`packaging_level: 0`). **Endpoint: Create a PO with loading units** — `POST /reception/bulk/purchase_orders` (operationId: bulkCreatePurchaseOrders) | Field | Type | Required | Description | | ----------------------------------- | ---- | -------- | -------------------------------------------------------------------------------- | | packagings | | | Array of physical units — see field reference below. | | packagings\[].line_item_number | | yes | Must match a line_item_number in items. Ties the unit to one order line (SKU). | | packagings\[].barcode | | yes | Identifier of the physical unit. | | packagings\[].packaging_type | | yes | One of bag, bin, box, pallet, mix_container. | | packagings\[].packaging_level | | yes | Nesting depth. 0 = outermost unit, at the location. | | packagings\[].quantity_in_package | | yes | Units of that line's SKU in this unit. | ```json { "order_num": "PO-1LEVEL-001", "delivery_date": "2024-03-13 12:50:00", "third_party_id": 5393, "warehouse_id": 1686, "attributes": { "manually_created": true }, "items": [ { "line_item_number": "00010", "product_id": 30816, "sku": "product_none_1_sku", "requested_quantity": 20 }, { "line_item_number": "00020", "product_id": 30817, "sku": "product_none_2_sku", "requested_quantity": 40 } ], "packagings": [ { "line_item_number": "00010", "barcode": "BOX00010", "barcode_agency": "custom", "packaging_level": 0, "location_level_barcode": null, "quantity_in_package": 20, "packaging_type": "box", "dimensions_width": 30, "dimensions_height": 30, "dimensions_length": 30, "dimensions_weight": 30 }, { "line_item_number": "00020", "barcode": "BOX00020", "barcode_agency": "custom", "packaging_level": 0, "location_level_barcode": null, "quantity_in_package": 40, "packaging_type": "box", "dimensions_width": 30, "dimensions_height": 30, "dimensions_length": 30, "dimensions_weight": 30 } ] } ``` #### The model - Each entry in `packagings` is **one physical unit** (identified by `barcode`) that holds a quantity of exactly **one** order line's SKU — with the `mix_container` exception (see rule 4 below). - `packaging_level` expresses **nesting depth**. **Level `0` is the outermost unit**, sitting directly at a warehouse location. Nesting goes *inward* with increasing levels: a box on a pallet is level `1`, a bag inside that box would be level `2`, and so on. - `location_level_barcode` links a unit to its parent: it holds the `barcode` of the unit one level up (the same SKU's level `N-1` unit). It is `null` at level `0`. #### Field reference | Field | Type | Notes | | -------------------------------------------------------------- | -------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | | `line_item_number` | string | **Required.** Must match a `line_item_number` in `items`. Ties the unit to one order line (SKU). | | `barcode` | string | Identifier of the physical unit. Unique per unit — **except** a `mix_container`, which repeats the same `barcode` once per SKU it holds. | | `barcode_agency` | string \| null | Source of the barcode, e.g. `custom` for your own barcodes; `null` when not applicable. | | `packaging_type` | string (enum) | One of `bag`, `bin`, `box`, `pallet`, `mix_container`. | | `packaging_level` | integer | Nesting depth. `0` = outermost unit at the location; higher = nested inside. | | `location_level_barcode` | string \| null | `barcode` of the parent unit one level up (same SKU). `null` at level `0`. | | `quantity_in_package` | integer | Units of that line's SKU contained in this unit. A parent's quantity equals the sum of its children. | | `dimensions_width` / `dimensions_height` / `dimensions_length` | number | Dimensions of the unit. | | `dimensions_weight` | number | Weight of the unit (note: named with the `dimensions_` prefix). | #### Validation rules 1. **`line_item_number` is required on every packaging** and must exist in `items`. A `null` or unknown value is rejected with `line_item_numbers_not_found_in_any_purchase_items`. 2. **Levels are tracked per SKU and must be contiguous from `0`.** For a given `line_item_number`, if a unit exists at level `N`, units must also exist at every level `0 … N-1`, chained via `location_level_barcode`. A gap is rejected with `packaging_levels_must_be_contiguous`. In practice: every SKU must be rooted in its own level-`0` unit before it can be nested deeper. 3. **One SKU per `barcode` for every type except `mix_container`.** A `bag`, `bin`, `box`, or `pallet` row references a single `line_item_number`. 4. **A `mix_container` holds multiple SKUs** as several **level-`0` rows that share the same `barcode`**, one row per SKU (each with its own `line_item_number` and `quantity_in_package`). Because rule 2 requires each SKU to be rooted at level `0`, you **cannot** mix different SKUs by nesting them under a single parent belonging to another SKU — the mixed unit is expressed as repeated level-`0` rows instead. #### More examples ##### Two levels — pallet → box, per SKU Each SKU has a pallet (level `0`) with a box on it (level `1`). The box's `location_level_barcode` points at its pallet's `barcode`. **packagings** ```json [ { "line_item_number": "00010", "barcode": "PALLET0001", "barcode_agency": null, "packaging_level": 0, "location_level_barcode": null, "quantity_in_package": 20, "packaging_type": "pallet", "dimensions_width": 100, "dimensions_height": 100, "dimensions_length": 100, "dimensions_weight": 100 }, { "line_item_number": "00020", "barcode": "PALLET0002", "barcode_agency": null, "packaging_level": 0, "location_level_barcode": null, "quantity_in_package": 40, "packaging_type": "pallet", "dimensions_width": 100, "dimensions_height": 100, "dimensions_length": 100, "dimensions_weight": 100 }, { "line_item_number": "00010", "barcode": "BOX0001", "barcode_agency": "custom", "packaging_level": 1, "location_level_barcode": "PALLET0001", "quantity_in_package": 20, "packaging_type": "box", "dimensions_width": 30, "dimensions_height": 30, "dimensions_length": 30, "dimensions_weight": 30 }, { "line_item_number": "00020", "barcode": "BOX0002", "barcode_agency": "custom", "packaging_level": 1, "location_level_barcode": "PALLET0002", "quantity_in_package": 40, "packaging_type": "box", "dimensions_width": 30, "dimensions_height": 30, "dimensions_length": 30, "dimensions_weight": 30 } ] ``` ##### One SKU split across several boxes on a pallet A single SKU (60 units) on one pallet, split into three boxes of 20. The pallet's `quantity_in_package` equals the sum of its boxes. **packagings** ```json [ { "line_item_number": "00010", "barcode": "PALLET0001", "barcode_agency": null, "packaging_level": 0, "location_level_barcode": null, "quantity_in_package": 60, "packaging_type": "pallet" }, { "line_item_number": "00010", "barcode": "BOX0001", "barcode_agency": "custom", "packaging_level": 1, "location_level_barcode": "PALLET0001", "quantity_in_package": 20, "packaging_type": "box" }, { "line_item_number": "00010", "barcode": "BOX0002", "barcode_agency": "custom", "packaging_level": 1, "location_level_barcode": "PALLET0001", "quantity_in_package": 20, "packaging_type": "box" }, { "line_item_number": "00010", "barcode": "BOX0003", "barcode_agency": "custom", "packaging_level": 1, "location_level_barcode": "PALLET0001", "quantity_in_package": 20, "packaging_type": "box" } ] ``` ##### Mixed container — multiple SKUs in one unit One physical container holding three SKUs. It is a single `barcode` repeated once per SKU, all at level `0`. **packagings** ```json [ { "line_item_number": "00010", "barcode": "MIX0001", "barcode_agency": "custom", "packaging_level": 0, "location_level_barcode": null, "quantity_in_package": 15, "packaging_type": "mix_container", "dimensions_width": 120, "dimensions_height": 120, "dimensions_length": 120, "dimensions_weight": 120 }, { "line_item_number": "00020", "barcode": "MIX0001", "barcode_agency": "custom", "packaging_level": 0, "location_level_barcode": null, "quantity_in_package": 25, "packaging_type": "mix_container", "dimensions_width": 120, "dimensions_height": 120, "dimensions_length": 120, "dimensions_weight": 120 }, { "line_item_number": "00030", "barcode": "MIX0001", "barcode_agency": "custom", "packaging_level": 0, "location_level_barcode": null, "quantity_in_package": 10, "packaging_type": "mix_container", "dimensions_width": 120, "dimensions_height": 120, "dimensions_length": 120, "dimensions_weight": 120 } ] ``` ## Reference material ### Best practices Path: `/guide/best-practices` > **TIP: Prefer a client?** > > Import the [Postman collection](/pulpo-wms.postman_collection.json) — it ships every > endpoint in this reference with the `{{baseUrl}}` and `{{token}}` variables already > wired up. #### Pagination Pulpo uses **offset-based** pagination. The mandatory elements are `limit` and `offset`; this applies to almost all public endpoints. *Diagram — offset pagination with limit=100: request Page 1 (offset 0), Page 2 (offset 100), Page 3 (offset 200) … keep advancing the offset until a page returns fewer rows than the limit.* ``` GET /sales/orders?limit=100&offset=100&capped_limit=0&sort_by=id:asc ``` | Parameter | Details | | -------------- | -------------------------------------------------------------------------------------------------------------------- | | `limit` | 1–2000. Common values are 10 or 100. Larger pages mean bigger payloads and slower responses. Default 10. | | `offset` | Records to skip. Default 0. | | `sort_by` | Order by an incremental field (e.g. `id`, `inserted_at`) so rows don't shift between pages. | | `capped_limit` | Set to `0` to drop `total_results` and gain \~20% speed. You then paginate until you get fewer than `limit` records. | > **WARNING: Never silently cap results** > > Don't hardcode a single `limit` and assume you fetched everything. Paginate until the page > is short. With `capped_limit=0` and a stable `sort_by`, you also capture rows created during > the pagination run. #### Filtering & view attributes Filtering applies a boolean condition to reduce the collection server-side — fewer records, faster responses. - **`XXX_id`** — filter by an indexed id. For orders, always include `warehouse_id`: `GET /picking/orders?warehouse_id=121&limit=100&sort_by=id:asc`. - **Date ranges** — `delivery_date`, `inserted_at`, `updated_at` with `between:`, `gte:`, `lte:` and `YYYY-MM-DD hh:mm:ss` format. - **`state`** — e.g. `state=ended`, or a dynamic search with `__search` / `__or_search`. - **`view_attributes`** — restrict which root-level fields the response returns, so you don't pull the full element back. #### Rate limits & throttling Limits are **tenant-based** (not per user): the default tier ranges from **60** to **300** calls per minute. Internal calls from the Pulpo frontend, wizard or Android app do not count. **Endpoint: Handle 429 responses** — `HTTP/1.1 429 Too Many Requests` ```json { "message": "rate_limit_reached", "retry_after_seconds": 1.0 } ``` - **Store the token** — reuse it for its 60-minute life. - **Respect rate limits** — parallel requests won't speed things up; they burn your budget. - **Batch your requests** — prefer bulk endpoints (`POST /inventory/bulk/products`). Recommended batch size: up to 50 items per request. - **Check for misconfigurations** — avoid accidental loops or unnecessary requests. - **Cache** cross-reference lookups (external code → Pulpo id) locally. - **Queue** messages so a 429 pauses and retries after `retry_after_seconds` rather than losing requests. ### Order states & lifecycles Path: `/guide/order-states` Summary: The state machines you poll and interpret across every flow Every flow in PULPO is a state machine. Your integration's job is to **read the current state, wait for the transition that matters, and react** — usually via a webhook, sometimes by polling. This page is the reference for the state values you will see and what each one means. All values here are the exact strings the API returns. > **NOTE: Where workflow state lives** > > The picking / packing / shipping workflow state lives on the **fulfillment order**, not the > sales order header. A sales order always has at least one fulfillment order. Derive the > effective state as `fulfillment_orders[0].state || sales_order.state`. #### Sales order lifecycle A sales order (outgoing) walks a linear path from creation to Post Goods Issue: ``` queue ──→ picking ──→ packing ──→ shipping ──→ ended (PGI — fulfilled) │ ├──→ paused (on the fulfillment order) ──→ queue (on resume) │ └──→ cancelled (from queue; also from picking/packing while cancellable) ``` | State | Meaning | Terminal? | | ----------- | ------------------------------------------------------------------------ | --------- | | `queue` | Created, waiting to be picked | no | | `picking` | Items are being picked in the warehouse | no | | `packing` | Items are being packed into boxes | no | | `shipping` | Packed and ready for shipment | no | | `ended` | Fully fulfilled — Post Goods Issue (PGI) | **yes** | | `paused` | Temporarily held — set on the **fulfillment order**, not the sales order | no | | `cancelled` | Cancelled | **yes** | > **WARNING: Cancellation is state-dependent** > > An order in `ended` **cannot** be cancelled. An order in `picking` cannot be cancelled when > there are no available packing locations. Don't assume cancel always succeeds — check the > response. **Endpoint: Search sales orders** — `GET /sales/orders` (operationId: searchSalesOrders) Poll order state with `view_attributes=id,order_num,state` to keep responses small. Prefer the `sales_order_finished` webhook over polling when you can. ##### Priority levels Sales orders carry a numeric `priority`: `1` = Low, `2` = Normal, `3` = High, `4` = Top. #### Picking order lifecycle A picking task is one picker walking the floor. Picking operates on **fulfillment order IDs**, not sales order IDs. | State | Meaning | | ----------- | ------------------------------------ | | `queue` | Created, awaiting a picker | | `taken` | Claimed by a picker | | `ended` | All items picked | | `mixed` | Partially picked — some lines remain | | `cancelled` | Cancelled, items returned to stock | **Endpoint: List picking orders** — `GET /picking/orders` (operationId: listPickingOrders) #### Packing order lifecycle A packing task is created by the system after picking completes. Ownership is the tricky part — a user may own only **one** active (`taken` or `locked`) packing order at a time. ``` queue ─accept─→ taken ─lock─→ locked │ ↑ │ │ └──unlock────┘ (owner → taken; non-owner → queue) │ └─finish─→ ended ─close─→ closed ``` | State | Meaning | | ----------- | ------------------------------------------------------------------- | | `queue` | Awaiting a packer | | `taken` | Owned by a packer (see `owner.id`) | | `locked` | Paused — kept by the owner but not actively worked | | `ended` | All boxes closed and `/finish` was called | | `closed` | Final — `/close` released the lock and assigned a shipping location | | `cancelled` | Cancelled (terminal) | > **NOTE: Finding a user's current task** > > `GET /iam/users/{id}/tasks` returns a user's active task — but **not** `locked` (paused) > ones. Query those separately with `GET /packing/orders?state=locked`. If a non-owner calls > `/unlock` on a locked task it returns to `queue` (not `taken`) and must be re-accepted. **Endpoint: List packing orders** — `GET /packing/orders` (operationId: listPackingOrders) #### Purchase order (incoming) lifecycle Purchase orders, returns and warehouse movements all use the same order object, distinguished by `type` (`purchase_order`, `return`, `warehouse_movement`). | State | Meaning | | -------------------- | ------------------------------------ | | `queue` | Created, awaiting receiving | | `checking` | Goods are being received / inspected | | `finished_partially` | Closed with a partial receipt | | `closed` | Fully received (Goods Receipt) | | `cancelled` | Cancelled | Receiving events (`incoming_goods`) record per-item outcomes. For returns and quality-control, each received item carries its own `state` of `accepted` or `rejected`. **Endpoint: List purchase orders** — `GET /reception/purchase_orders` (operationId: listPurchaseOrders) #### Shipment tracking status (label provider) When an external system generates labels, the packing box's `shipment_tracking.status` walks this machine: | From | To | Meaning | | ----------------------------------- | ----------------------------------- | --------------------------------- | | `null` | `pulpowms_label_generation_started` | Generation in progress | | `pulpowms_label_generation_started` | `pulpowms_label_generated` | Success — tracking info available | | `pulpowms_label_generation_started` | `pulpowms_label_generation_failed` | Failure — see `error_message` | | `null` | `pulpowms_label_not_required` | Skip label for this box | > **TIP: The real readiness signal** > > Label readiness is the presence of `attachments[0].url` on the packing box — not > `shipment_tracking.status` alone. Poll `GET /packing/orders/{id}` every \~5s for up to \~2 > minutes (24 attempts), the same budget the PULPO app uses. Full walkthrough on the > [Shipping Label Provider](/label-provider/shipment-tracking) track. ### Webhooks Path: `/guide/webhooks` Subscribe once with the webhook endpoint, then receive callbacks for the event types your integration needs. Each process page lists the events relevant to it. **Endpoint: Subscribe to a webhook** — `POST /webhook/` (operationId: subscribeWebhook) Register a URL to receive event callbacks. #### Catalog by process | Process | Events | | -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Incoming | `purchase_order_updated`, `incoming_good_created`, `purchase_order_finished_early`, `purchase_order_finished` (GR), `replenishment_order_created`, `replenishment_order_finished` | | Outgoing | `sales_order_created`, `sales_order_updated`, `sales_order_cancelled`, `picking_order_created`, `picking_order_finished`, `packing_order_created`, `packing_order_finished` (PIC), `packing_order_closed`, `sales_order_finished` (PGI), `fulfillment_order_finished` | | Returns | `sales_order_created` (return) | | Stock transfer | `sales_order_created` (`warehouse_movement`) | | Stock changes | `stock_correction_finished`, `counting_task_closed` | | POS | `sales_order_finished` (`POS_external`) | | Kitting | `replenishment_order_created` (`kit_move`), `replenishment_order_finished` (`kitting`) | | Labels | `packing_box_closed`, `packing_order_finished`, `turbo_label_packing_created`, `shipment_tracking_updated` | #### Sample payloads The richest webhook payloads — the packing and shipment-tracking events used by label providers — are documented with full field glossaries and JSON on the label-provider track: - [`packing_box_closed` and `packing_order_finished`](/label-provider/webhooks) - [`shipment_tracking_updated`](/label-provider/shipment-tracking) > **NOTE: Annex samples** > > The original Integration Notes include annex samples for `purchase_order_finished`, > `sales_order_finished`, `packing_order_finished` and `shipment_tracking_updated`. These are > mirrored inline on the relevant process pages. ### Receiving webhooks Path: `/guide/receiving-webhooks` Summary: Building a receiver that survives retries and out-of-order delivery The [webhooks catalog](/guide/webhooks) tells you *which* events to subscribe to. This page is about the other half — building a **receiver** that stays correct when deliveries retry, arrive out of order, or arrive twice. Getting this wrong is the most common source of duplicated fulfillments and missed orders. #### Subscribe **Endpoint: Subscribe to webhook events** — `POST /webhook/` (operationId: subscribeWebhook) Your `url` must be **HTTPS** and the `method` is `POST`. Narrow the firehose with `warehouse_id`, `merchant_id` and `merchant_channel_id` filters, and list only the event types you handle in `allowed_types`. **Example (cURL):** ```bash curl -X POST {{baseUrl}}/webhook/ \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d '{ "url": "https://your-domain.com/webhooks/pulpo", "method": "POST", "warehouse_id": 140, "merchant_id": 69, "merchant_channel_id": 76, "allowed_types": ["packing_order_finished", "sales_order_finished"] }' ``` #### The four rules PULPO's own delivery contract asks receivers to do four things. Treat them as non-negotiable. > **WARNING: 1 · Return 200 quickly, process asynchronously** > > Acknowledge with `200` as soon as you've *durably stored* the event (e.g. enqueued it). > Do all real work — API calls, DB writes, label generation — after responding. Slow handlers > cause timeouts, which cause retries, which cause duplicate processing. > **WARNING: 2 · Be idempotent — deliveries retry** > > The same event may arrive more than once. Compute a stable key from the event and skip > anything you've already handled. A good key is `type` + the entity id in `data` > (e.g. `sales_order_finished:`). Store handled keys and dedupe on write. > **WARNING: 3 · Handle out-of-order delivery** > > Ordering is **not** guaranteed. You might see `sales_order_finished` before > `packing_order_finished`. Don't build logic that assumes a sequence. Treat each event as a > *hint that something changed*, then re-fetch the authoritative state from the API (e.g. > `GET /sales/orders/{id}`) before acting on it. > **WARNING: 4 · Verify authenticity** > > Only act on events you can trust. If PULPO issues a signing secret for your subscription, > verify it on every request; confirm the exact mechanism (header name and algorithm) with > your onboarding contact. At minimum, use an unguessable receiver path or a shared secret you > check on arrival, and reject anything that fails. #### A receiver that follows all four ```js import express from "express"; const app = express(); const seen = new Set(); // back this with Redis/DB in production app.post("/webhooks/pulpo", express.json(), async (req, res) => { // 4 — verify authenticity (shared secret shown; use PULPO's signature if provided) if (req.get("x-webhook-secret") !== process.env.PULPO_WEBHOOK_SECRET) { return res.sendStatus(401); } const event = req.body; // { type, data, ... } const key = `${event.type}:${event.data?.sales_order_id ?? event.data?.id}`; // 2 — idempotency: ignore repeats if (seen.has(key)) return res.sendStatus(200); seen.add(key); // 1 — acknowledge fast, then process out of band res.sendStatus(200); queue.push(event); // 3 — the worker re-fetches authoritative state before acting }); ``` #### Payload shape Every delivery is a JSON object with a `type` (one of the subscribed `allowed_types`) and a `data` object carrying the full event data. The richest payloads — the packing and shipment-tracking events used by label providers — are documented field-by-field on the [label-provider webhooks](/label-provider/webhooks) page. **Webhook event: **`sales_order_finished` Fired when a sales order completes (PGI). Re-fetch the order to read its authoritative final state before you mark anything shipped on your side. Sample payload: ```json { "type": "sales_order_finished", "data": { "sales_order_id": 12345, "order_num": "SO-2024-001", "state": "ended" } } ``` > **TIP: Not receiving anything?** > > Check the subscription filters first — a `warehouse_id` / `merchant_id` that doesn't match > the order silently excludes its events. The receiver URL must be publicly reachable over > HTTPS. See [idempotency & retries](/guide/idempotency) for how PULPO retries failed > deliveries. ### Idempotency & retries Path: `/guide/idempotency` Summary: Safe retries, bulk partial success, and 429 backoff Networks fail mid-request. The question is never *if* you retry, but *whether a retry is safe*. PULPO gives you the tools to make retries safe — this page shows how to use them. #### Idempotency through natural keys PULPO does not use a separate idempotency-key header. Instead it enforces **uniqueness on business keys** — most importantly `order_num`. That turns a retry into a safe no-op: - If the first request succeeded and you retry with the **same `order_num`**, the duplicate is rejected instead of creating a second order. - If the first request never landed, the retry creates the order exactly once. > **SUCCESS: The rule** > > Derive `order_num` deterministically from your source system's order id. Never > generate it randomly per attempt. Same input → same `order_num` → at-most-once > creation, no matter how many times you retry. > **WARNING: Reused order_num is an error, not a duplicate** > > A repeat `order_num` returns a validation error (`has already been taken`). Treat "already > taken" on a retry as **success** (the order exists), not as a failure to surface to a user. #### Retrying on 429 Rate limits are tenant-based (60–300 calls/min). A `429` response tells you exactly how long to wait: **Endpoint: Rate limit response** — `HTTP/1.1 429 Too Many Requests` ```json { "message": "rate_limit_reached", "retry_after_seconds": 1.0 } ``` Honor `retry_after_seconds` (also sent as the `Retry-After` header), then back off exponentially for anything that still fails. Parallelism does **not** help — it just burns your budget faster. **Example (Node.js):** ```js async function requestWithRetry(url, init, attempt = 0) { const res = await fetch(url, init); if (res.status === 429) { const body = await res.json().catch(() => ({})); const headerWait = Number(res.headers.get("retry-after")); const wait = body.retry_after_seconds ?? (Number.isFinite(headerWait) ? headerWait : 2 ** attempt); await new Promise((r) => setTimeout(r, wait * 1000)); return requestWithRetry(url, init, attempt + 1); } // Retry transient server errors with plain exponential backoff (cap the attempts). if (res.status >= 500 && attempt < 5) { await new Promise((r) => setTimeout(r, 2 ** attempt * 1000)); return requestWithRetry(url, init, attempt + 1); } return res; } ``` **Example (Python):** ```python import time, requests def request_with_retry(method, url, attempt=0, **kwargs): res = requests.request(method, url, **kwargs) if res.status_code == 429: body = res.json() if res.headers.get("content-type", "").startswith("application/json") else {} wait = body.get("retry_after_seconds") or float(res.headers.get("Retry-After", 2 ** attempt)) time.sleep(wait) return request_with_retry(method, url, attempt + 1, **kwargs) if res.status_code >= 500 and attempt < 5: time.sleep(2 ** attempt) return request_with_retry(method, url, attempt + 1, **kwargs) return res ``` > **TIP: Don't retry 4xx (except 429)** > > A `400`, `401`, `404` or `422` won't change on retry — the request itself is wrong. Fix it. > Only `429` and `5xx` are worth retrying. See [errors & troubleshooting](/guide/errors) for > what each one means. #### Bulk endpoints: partial success Bulk endpoints can **partially** succeed — some records land, others fail. You must inspect the response and retry only the failures, or you'll either drop good records or re-send ones that already succeeded. `POST /picking/bulk/orders` is the clearest example: it returns a `created[]` list of the picklists that were created alongside an `errors[]` list of the fulfillment orders that failed (see the `PickingCreateError` schema). **Example (Node.js):** ```js const res = await fetch(BASE + "/picking/bulk/orders", { method: "POST", headers, body }); const result = await res.json(); // Succeeded — do not resend these orders. const done = new Set((result.created ?? []).map((c) => c.order_num)); // Failed — inspect why, fix, and retry ONLY these. for (const err of result.errors ?? []) { for (const item of err.items ?? []) { if (item.insufficient_stock) { console.warn("Short on stock:", err.order_num, item.insufficient_stock); } } } ``` > **WARNING: Not all 2xx means fully applied** > > A `2xx` on a bulk call does not guarantee every record was accepted. Always reconcile > `created[]` against what you sent before treating the batch as complete. #### Webhook retries Delivery is retried too. That's why your receiver must be idempotent — the same event can arrive more than once. The receiver side is covered in [receiving webhooks](/guide/receiving-webhooks). ### Errors & troubleshooting Path: `/guide/errors` Summary: Error shapes, common failures, and how to resolve them When a call fails, PULPO tells you why in a consistent shape. This page covers that shape, what each status code means, and the handful of mistakes that account for most rejected requests. #### The error shape Most errors return a JSON body with a human-readable `message`, an optional `code`, and — for validation failures — a per-field `errors` map. **Endpoint: Standard error shape** — `Error body` ```json { "message": "Validation failed", "code": "VALIDATION_ERROR", "errors": { "sku": ["has already been taken"] } } ``` Always read `errors` before `message` on a `400` — it names the exact field(s) at fault. #### Status codes | Status | Meaning | Retry? | What to do | | ------ | ------------------------------------------------------- | ------- | --------------------------------------------------- | | `400` | Bad request — invalid parameters or a failed validation | No | Read `errors`, fix the field, resend | | `401` | Invalid or expired token | No\* | Re-authenticate, then retry once with the new token | | `404` | Resource not found | No | Check the id and that it belongs to your tenant | | `422` | Semantic validation failed (e.g. picking a short line) | No | Inspect the structured body, fix the cause | | `429` | Rate limit reached | **Yes** | Wait `retry_after_seconds`, then back off | | `5xx` | Server error | **Yes** | Exponential backoff, capped attempts | > **NOTE: * 401 is a special case** > > A `401` isn't worth retrying with the *same* token — but a token expires after 60 minutes, > so the correct recovery is to fetch a fresh token and retry the original request once. #### Insufficient stock (picking) Creating picking tasks returns a **structured** error when a fulfillment order can't be picked — `422` from `POST /picking/orders`, `400` from `POST /picking/bulk/orders`. The body is a `PickingCreateError`: `errors[].items[].insufficient_stock` names the failing product, and the bulk endpoint also returns `created[]` for the ones that succeeded. **Endpoint: PickingCreateError** — `POST /picking/bulk/orders → 400` ```json { "created": [], "errors": [ { "id": 15411612, "order_num": "SO-2024-001", "fulfillment_sequence_number": "FO-0000145", "items": [ {}, { "id": "15411612", "order_num": "SO-2024-001", "insufficient_stock": "not enough stock available for item with product \"ABC-1\"" } ] } ] } ``` For turbo label picking the request itself succeeds (`204`). The same reason appears later in the fulfillment order's `process_information.errors`. #### Common failures > **WARNING: Merchant / channel mismatch (3PL)** > > The single most common cause of rejected records. On a **purchase order**, the merchant of > the product and of the supplier must match the PO's merchant. On a **sales order**, the > merchant + channel of the product, the customer, and the order must all agree. As a single > merchant this can't happen — everything resolves to your one default pair. > **WARNING: Reused order_num** > > `order_num` is unique. A repeat returns `has already been taken`. On a retry this means the > order already exists — treat it as success. See [idempotency & retries](/guide/idempotency). > **WARNING: Updates replace, they don't merge** > > `items` on a sales-order update **replaces the full line-item list** — send the complete set > of lines, not just the ones you changed, or the omitted lines are dropped. The same replace > semantics apply when closing packing boxes (the body is the complete boxes array). This is > declarative, not a patch. > **WARNING: Operating on a terminal state** > > State gates what you can do. Orders in `ended` or `cancelled` **cannot be updated**; an > order in `ended` **cannot be cancelled**; an order in `picking` can't be cancelled when no > packing locations are available. Check the [order states](/guide/order-states) before you > mutate. > **TIP: Empty list where you expected data?** > > A `200` with an empty collection usually means a **filter** excluded everything — most often > a missing or wrong `warehouse_id`, or a `merchant_id` filter that doesn't match. Widen the > filter and confirm the ids belong to your tenant. #### Debugging checklist 1. **Is the token fresh?** Tokens last 60 minutes — a stale one is a `401`, not a bug. 2. **Read `errors`, not just `message`.** The field-level map points straight at the cause. 3. **Right environment?** Staging ids don't exist in production. Confirm the base URL in the header selector matches where your data lives. 4. **Right `warehouse_id`?** Orders are warehouse-scoped; the wrong id returns empty or 404. 5. **Merchant + channel aligned?** For 3PL, re-check they match across product, party, order. 6. **Is the state terminal?** You can't mutate `ended` / `cancelled` orders. ### Glossary Path: `/guide/glossary` Summary: PULPO and WMS terms — FO, PIC, PGI, GR, kitting and more The terms you'll meet across this guide and the API, in plain language. WMS shorthand like **PIC** and **PGI** shows up throughout the flows — this is where they're defined. #### Core entities | Term | Meaning | | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **Tenant** | Your PULPO WMS account. Usually one `tenant_id` per instance. Owns all products, parties and warehouses. | | **Merchant** | In a 3PL setup, one of your customers. A single merchant has exactly one default Merchant. | | **Channel** | A sales channel belonging to a Merchant (e.g. Shopify, Amazon). | | **Warehouse** | A physical warehouse. Every purchase order and sales order is tied to one `warehouse_id`. | | **User** | A login. Your user implies the Tenant you belong to and which Merchants you can manage. | | **Product** | Master data item, owned by a Merchant. Carries one or more **SKUs**. | | **SKU** | A stock-keeping code that always points to the same physical product. | | **Tag** | A label of the tenant that can be put on products, users and warehouse locations. Called `product_categories` in the API — same thing, different name. See [products](/guide/products). | | **Third Party** | A supplier (`type = S`, delivers goods) or a customer (`type = C`, receives orders). | See the [entity & data model](/guide/data-model) for how these relate. #### Orders & fulfillment | Term | Meaning | | -------------------------- | -------------------------------------------------------------------------------------------------------------------------- | | **Sales Order (SO)** | A customer-facing outgoing order. `type = sales_order`. | | **Fulfillment Order (FO)** | The warehouse execution unit for an SO. One SO has at least one FO; workflow state lives here. Picking operates on FO ids. | | **Purchase Order (PO)** | An incoming order — goods arriving into the warehouse. | | **Incoming Goods** | A receiving event against a PO. A PO may have several (partial receipts). | | **Return** | Goods coming back. Received with per-item `accepted` / `rejected` outcomes. | | **Warehouse Movement** | Stock moving between locations or warehouses (a stock transfer). | | **POS order** | `type = POS_external` — reduces stock instantly, with no picking or packing. | #### Warehouse process steps | Term | Meaning | | ------------------------ | ----------------------------------------------------------------------------------------------------------------- | | **Picking** | Collecting items from storage locations for an order. | | **Packing** | Placing picked items into boxes, ready to ship. | | **Shipping** | Dispatching packed boxes. | | **Replenishment** | Moving stock into pickable storage so it becomes available. | | **Kitting** | Assembling component products into a **kit** (a sellable bundle). | | **Batch / Lot / Serial** | Traceability modes (`management_type = lot` or `serial`, with `batch_control`) for expiry or unit-level tracking. | #### The three-letter milestones These abbreviations mark the key completion events. Each maps to a webhook. | Abbr. | Full name | Fires on | Webhook | | ------- | ---------------- | ------------------------------------- | ------------------------- | | **GR** | Goods Receipt | Incoming goods fully received | `purchase_order_finished` | | **PIC** | Picking Complete | Packing task finished | `packing_order_finished` | | **PGI** | Post Goods Issue | Sales order fully shipped (fulfilled) | `sales_order_finished` | #### Picking strategies | Strategy | Semantics | | --------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | | **standard** | One picking task per fulfillment order (`POST /picking/bulk/orders`). | | **batch** | One task grouping multiple FOs (`POST /picking/orders`, `cart: false`). | | **cart** | Batch pick with each FO in its own cart slot (`cart: true`). | | **turbo label** | Shipping labels are fetched before picking starts (`/picking/bulk/orders/turbo` for standard, `/picking/orders/turbo` for batch). Asynchronous. | #### API mechanics | Term | Meaning | | --------------------- | ------------------------------------------------------------------------------------------------------- | | **Bearer token** | The 60-minute OAuth token from `/auth`, sent as `Authorization: Bearer …`. | | **Offset pagination** | `limit` + `offset`; page until a short page. See [best practices](/guide/best-practices). | | **`capped_limit=0`** | Drops the total count for \~20% faster responses. | | **`view_attributes`** | Restricts which fields a response returns, to shrink payloads. | | **Webhook** | An HTTP callback PULPO sends when an event occurs. See [receiving webhooks](/guide/receiving-webhooks). | | **Filter operators** | `between:`, `gte:`, `lte:`, `to_list:`, `contains:`, `includes:` prefixes on query params. | ## Shipping Label Provider ### Shipping Label Provider — overview Path: `/label-provider/overview` Summary: The end-to-end label provider integration flow This track is for an **external label or carrier provider** integrating label generation into Pulpo's packing flow. When an external system generates shipping labels (a carrier API or a label service), Pulpo emits packing events, waits for your label, and attaches it to the box. > **NOTE: Who this is for** > > The main guide targets the *fulfiller*. This track targets the *label provider*: > you receive packing webhooks, generate a label, and push it back to Pulpo via the > shipment-tracking and attach endpoints. #### The end-to-end flow **Flow: From sales order to attached label to return. Click a stage for the call it maps to.** 1. **Sales Orders** — Orders are created in bulk (POST /sales/bulk/orders). Endpoint: `POST /sales/bulk/orders` 2. **Order Update** — Webhooks: sales_order_created, sales_order_finished, sales_order_cancelled. 3. **Picking** — Items are picked. 4. **Packing** — Boxes are closed. Webhook: packing_order_finished AND turbo_label_packing_created (or packing_box_closed AND turbo_label_packing_created). 5. **Shipment tracking** — Set status pulpowms_label_generation_started, generate the label, then attach it. Endpoint: `PUT /packing/orders/{packing_order_id}/boxes/{box_id}/shipment_tracking/{tracking_id}` 6. **Attach label** — Upload the label PDF to the box. Endpoint: `POST /packing/orders/{packing_order_id}/boxes/{box_id}/attach` 7. **Tracking updated** — Set status pulpowms_label_generated; webhook shipment_tracking_updated fires. 8. **Return** — Returns via POST /reception/bulk/purchase_orders (type return). Endpoint: `POST /reception/bulk/purchase_orders` #### The label lifecycle, step by step 1. **Subscribe** to `packing_box_closed` (or `packing_order_finished`) **and** `turbo_label_packing_created`. 2. **Receive** the packing webhook → extract `packing_order_id`, `box_id`, `shipment_tracking.id`. 3. **`PUT …/shipment_tracking/{tracking_id}`** → set status `pulpowms_label_generation_started`. 4. **Generate** the label in your system using the order / box data. 5. **`POST …/boxes/{box_id}/attach`** → upload the label PDF. 6. **`PUT …/shipment_tracking/{tracking_id}`** → set status `pulpowms_label_generated` with `tracking_code`, `tracking_url`, `carrier_code`. 7. **Webhook `shipment_tracking_updated`** fires, confirming the label is attached — use it to notify the end customer (SMS, email, push…). > **WARNING: You have \~2 minutes** > > The `turbo_label_packing_created` webhook is what signals Pulpo expects an external label. > Without it, the packing events are informational only. After a box closes, the Pulpo app > waits **up to 2 minutes** for the label; if none arrives, the packer must wait > or skip. Continue to the [packing webhooks](/label-provider/webhooks) for the exact payloads, then the [shipment tracking & labels](/label-provider/shipment-tracking) endpoints. ### Packing webhooks Path: `/label-provider/webhooks` These are the two events that kick off label generation. Subscribe to one of them **and** `turbo_label_packing_created`. Both carry the ids you need for the shipment-tracking and attach calls. > **NOTE: shipment_tracking not yet populated** > > On both events the box's `shipment_tracking` object is not yet populated — only > the packing box `id` and the `shipment_tracking.id` are present. You > populate the rest via [the PUT endpoint](/label-provider/shipment-tracking). #### packing_box_closed Fires as each box is closed. **Webhook event: **`packing_box_closed` | Field | Type | Required | Description | | --------------------------------------- | ---- | -------- | ------------------------------------------------------- | | type | | | Unique per kind of webhook. | | data.warehouse_id | | | Warehouse where the event was triggered. | | data.sales_order_id | | | Unique id of the order in Pulpo. | | data.sales_order.order_num | | | Order number on the customer side. | | data.sales_order.merchant_id | | | Customer of the fulfiller (single default for non-3PL). | | data.sales_order.merchant_channel_id | | | Selling channel — e.g. to only label Amazon orders. | | packing_boxes.packing_order_id | | | Unique id of the packing task. | | packing_boxes.shipment_tracking.id | | | Tracking id for this box — needed for the PUT calls. | | packing_boxes.id | | | Unique id of the box in Pulpo. | | packing_box_items.quantity | | | Quantity of the product in this box. | | packing_box_items.product_id | | | Unique product id in Pulpo. | | packing_box_items.product.sku | | | SKU (unique per Tenant + Merchant). | Sample payload: ```json { "warehouse_name": "simon_warehouse_1", "warehouse_id": 2236, "updated_at": "2026-09-23T13:36:48", "type": "packing_box_closed", "inserted_at": "2026-09-23T13:36:48", "id": "8053797e-9fee-4abb-b9a4-721a2fb6dc03", "data": { "warehouse_id": 2236, "sequence_number": "PA-0000054", "sales_order_id": 26167904, "sales_order": { "merchant_channel_id": 1068, "merchant_id": 1053, "order_num": "ORDER_587493" }, "packing_boxes": [ { "width": 15, "weight": 336.2, "state": "packed", "inserted_at": "2026-09-23T13:36:47", "shipment_tracking": { "id": 63898 }, "packing_order_id": 46093, "packing_box_items": [ { "line_order_id": null, "quantity": 12, "product_id": 9169276, "product": { "tenant_id": 1445, "sku": "NP0001" } }, { "line_order_id": null, "quantity": 4, "product_id": 9169283, "product": { "tenant_id": 1445, "sku": "SP0002" } } ], "name": "BOX S", "loaded_shipping_box_id": null, "length": 20, "id": 72384, "height": 10, "box_number": 1, "attributes": {}, "attachments": [] } ], "owner": {}, "origin_location_id": 1065394, "items": [ { "suggested_batches": [], "requested_quantity": 12, "product": {}, "packed_quantity": 12, "id": 66631, "batches": [] } ], "inserted_at": "2026-09-23T13:28:10", "id": 46093, "end_date": null, "destination_location_id": null, "attachments": [], "source_channel": true } } ``` #### packing_order_finished Fires when the whole packing task is finished. Same key fields as above, plus batch detail under `items[].batches[]` (`batch_id`, `quantity`, `batch.type` = lot/serial, `batch.product_id`). **Webhook event: **`packing_order_finished` Sample payload: ```json { "warehouse_name": "simon_warehouse_1", "warehouse_id": 2236, "type": "packing_order_finished", "inserted_at": "2026-09-23T13:39:19", "id": "23f5ddab-8189-491a-b814-71190b0272d7", "data": { "warehouse_id": 2236, "sequence_number": "PA-0000054", "sales_order_id": 26167904, "sales_order": { "order_num": "ORDER_587493", "merchant_id": 1053, "merchant_channel_id": 1068 }, "packing_boxes": [ { "width": 15, "weight": 336.2, "shipment_tracking": { "id": 63898, "status": "pulpowms_label_generated", "tracking_code": "PA-0000054-72384" }, "packing_order_id": 46093, "packing_box_items": [ { "quantity": 12, "product_id": 9169276 } ], "attachments": [ { "id": "5cdee5d4-70bb-446b-a9eb-b9dbda0c5151", "type": "label", "extension": "pdf", "url": "https://s3.eu-central-1.amazonaws.com/pulpo-wms-eu-show-attachments/uploads/5cdee5d4-70bb-446b-a9eb-b9dbda0c5151.pdf" } ], "name": "BOX S", "length": 20, "inserted_at": "2026-09-23T13:36:47", "id": 72384, "height": 10, "box_number": 1 } ], "owner": {}, "items": [ { "suggested_batches": [], "requested_quantity": 12, "product": { "tenant_id": 1445 }, "packed_quantity": 12, "id": 66633, "batches": [ { "quantity": 12, "packing_item_id": 66633, "batch_id": 163923, "batch": { "type": "lot", "product_id": 9169279, "id": 163923 } } ] } ], "inserted_at": "2026-09-23T13:28:10", "id": 46093, "end_date": null, "destination_location_id": null, "attachments": [] } } ``` ### Shipment tracking & labels Path: `/label-provider/shipment-tracking` Once you have a `packing_order_id`, `box_id` and `shipment_tracking.id` from a [packing webhook](/label-provider/webhooks), you drive the label lifecycle with two endpoints: **shipment tracking** (status) and **attach** (the label file). #### The status state machine **Flow: shipment_tracking.status transitions.** 1. **null** — Default. No label activity yet. 2. **pulpowms_label_generation_started** — You have begun generating the label. 3. **pulpowms_label_generated** — Success — tracking info available. Other valid transitions: `null → pulpowms_label_generation_failed` (failure — see `error_message`) and `null → pulpowms_label_not_required` (skip label for this box). **Endpoint: Update shipment tracking status** — `PUT /packing/orders/{packing_order_id}/boxes/{box_id}/shipment_tracking/{tracking_id}` (operationId: updateShipmentTracking) | Field | Type | Required | Description | | ------------------------------ | ---- | -------- | -------------------------------------------------------------------------------------------------------------------------- | | status | enum | yes | null, pulpowms_label_generation_started, pulpowms_label_generation_failed, pulpowms_label_generated. Default null. | | error_message | | | Populated on failure. | | tracking_code | | | External code to track the shipment. | | tracking_url | | | External URL to track the shipment. | | carrier_code | | | Carrier code as defined in Pulpo (typically the carrier alpha code). | | attributes, service_point_id | | | Optional. id, updated_at and printed are generated automatically. | ##### 1 · Initiate the shipment tracking **PUT body — initiate** ```json { "status": "pulpowms_label_generation_started", "error_message": "" } ``` ##### 2 · Upload the label into the box **Endpoint: Attach the label PDF to the box** — `POST /packing/orders/{packing_order_id}/boxes/{box_id}/attach` (operationId: attachLabelToBox) Multipart upload of the generated label file. **Example (cURL):** ```bash curl -X POST \ https://eu.pulpo.co/api/v1/packing/orders/{packing_order_id}/boxes/{box_id}/attach \ -H "Authorization: Bearer $TOKEN" \ --form 'attachment=@"/Label/Location/packingBoxLabel0000001.pdf"' \ --form 'type="label"' ``` ##### 3 · Indicate the result **PUT body — failure** ```json { "error_message": "error message", "status": "pulpowms_label_generation_failed" } ``` **PUT body — success** ```json { "attributes": null, "service_point_id": null, "error_message": "", "tracking_code": "XXXXXXXXXXX", "tracking_url": "www.trackingurl.com", "carrier_code": "DDD", "status": "pulpowms_label_generated" } ``` #### Confirmation webhook When you set the status to generated, Pulpo fires `shipment_tracking_updated`. Use it to notify the end customer (SMS, email, push). **Webhook event: **`shipment_tracking_updated` | Field | Type | Required | Description | | ---------------------------------------------- | ---- | -------- | -------------------------------------------------- | | data.id | | | Shipment tracking id. | | data.packing_box_id | | | The box this tracking belongs to. | | data.sales_order | | | Order snapshot incl. ship_to (recipient address). | | tracking_code / tracking_url / carrier_code | | | Populated once you set them on success. | Sample payload: ```json { "webhook_id": null, "warehouse_name": "simon_warehouse_1", "warehouse_id": 2236, "updated_at": "2026-09-23T13:36:52", "type": "shipment_tracking_updated", "status": "triggered", "merchant_name": "default", "merchant_id": 1053, "merchant_channel_id": 1068, "id": "a63c3b9a-38bd-4285-aa5e-30bc114d9b05", "data": { "updated_at": "2026-09-23T13:36:52", "tracking_url": null, "tracking_code": "PA-0000054-72384", "status": "pulpowms_label_generated", "service_point_id": null, "sales_order": { "warehouse_id": 2236, "state": "packing", "ship_to": { "name": "Braun and Sons", "company_name": "Oberbrunner Inc", "address": { "street": "412 Willms Underpass", "country": "ME", "city": "New Elyse" } }, "order_num": "ORDER_587493", "id": 26167904 }, "printed": false, "packing_box_id": 72384, "packing_box": { "width": 15, "weight": 336.2, "length": 20, "id": 72384, "height": 10 }, "id": 63898, "error_message": null, "carrier_code": null } } ``` ### Returns Path: `/label-provider/returns` A return is received as a **Purchase Order** with `type = return`, referencing the original Sales Order. In a return, the customer (`type = C`) becomes the supplier of the product. **Endpoint: Create a return PO** — `POST /reception/bulk/purchase_orders` (operationId: bulkCreatePurchaseOrders) | Field | Type | Required | Description | | ----------------------------------- | -------- | -------- | ------------------------------------------------------------------------------------------ | | type | | yes | return | | delivery_date | datetime | yes | When the order will be received (YYYY-MM-DDTHH:MM:SS). | | sku OR product_id | | yes | Identify each line item — SKU (per product + tenant) or the Pulpo product_id. | | requested_quantity | | yes | Amount to be received. | | order_num | | yes | External order id — use the tracking code of the sales order. | | sales_order_id | | yes | The sales order being returned in Pulpo. | | third_party_id | | yes | In returns, the customer (type = C) acts as the supplier. Not present in packing webhooks. | | warehouse_id | | yes | Warehouse that will receive the returned goods. | | batches | | | Array of strings — mandatory when the product is of type lot or serial. | | merchant_id, merchant_channel_id | | | Not mandatory for non-3PL, but recommended. | ```json [ { "order_num": "MyReturn001", "sales_order_id": 5732510, "delivery_date": "2023-01-10T21:56:23", "type": "return", "third_party_id": 1075095, "warehouse_id": 882, "merchant_id": 76, "merchant_channel_id": 76, "items": [ { "product_id": 7646303, "requested_quantity": 2, "notes": null, "batches": [] }, { "product_id": 7646305, "requested_quantity": 2, "notes": null, "batches": [] } ] } ] ``` #### Resolving line items **Endpoint: Get sales order by ID** — `GET /sales/orders/{id}` (operationId: getSalesOrder) Provides everything needed to build a return PO for products of type `none` (no batches or serials). **Endpoint: Packing orders by sales order** — `GET /packing/orders` (operationId: listPackingOrders) When the product is lot/serial, use the packing orders to find the batch to declare on the return (`packing_orders/items[]/batches/batch_id`). > **TIP** > > It is also possible to receive a spontaneous return directly in the warehouse app without an > incoming PO — the outgoing customer (`type = C`) is used as the supplier of the incoming > replenishment. ## API reference **PULPO WMS API Documentation** Complete API documentation for integrating with PULPO WMS as a 3PL fulfiller. **Overview** This API enables third-party logistics (3PL) providers to integrate with PULPO WMS for managing: - **Incoming processes**: Purchase orders, goods receipt, stock replenishment - **Outgoing processes**: Sales orders, picking, packing, shipping - **Inventory management**: Products, stock levels, kitting - **Master data**: Merchants, channels, third parties, warehouses **Key Concepts** **Multi-tenant Architecture** - **Tenant**: Your PULPO WMS account - **Merchant**: Your customers (in 3PL scenarios) - **Channel**: Sales channels for each merchant (e.g., Shopify, Amazon) - **Warehouse**: Physical warehouse locations **Authentication** - OAuth 2.0 password grant flow - Tokens expire after 60 minutes - Store and reuse tokens to avoid rate limits **Rate Limits** - Default: 60-300 calls per minute (tenant-based) - Handle 429 responses with exponential backoff - Use bulk endpoints when possible **Pagination** - Offset-based pagination - Use `limit` (1-2000, default 10) and `offset` (default 0) - Use `capped_limit=0` for better performance (no total count) - Use `sort_by=id:asc` to avoid duplicate results **Webhooks** - Subscribe to events for real-time updates - Webhook payloads include full event data - Configure retry logic for failed deliveries **Getting Started** 1. Authenticate using `/auth` endpoint 2. Get your tenant and warehouse info from `/iam/users/me` and `/warehouses` 3. Create master data: Products, Third Parties 4. Subscribe to webhooks for order events 5. Create Purchase Orders (incoming) or Sales Orders (outgoing) **Common Workflows** **Incoming Process (Purchase Order)** ``` 1. POST /inventory/bulk/products (create products) 2. POST /iam/bulk/third_parties (create suppliers) 3. POST /reception/bulk/purchase_orders (create PO) 4. Warehouse receives goods (via Android app) 5. Webhook: purchase_order_finished (GR - Goods Receipt) 6. Webhook: replenishment_order_finished (stock available) ``` **Outgoing Process (Sales Order)** ``` 1. POST /iam/bulk/third_parties (create customers) 2. POST /sales/bulk/orders (create sales order) 3. Warehouse picks items (via Android app) 4. Webhook: packing_order_finished (PIC - Picking Complete) 5. Warehouse packs items (via Android app) 6. Webhook: sales_order_finished (PGI - Post Goods Issue) ``` **Support** - Integration Guide: Version 4.4.0 (July 2024) - API Documentation: https://eu.pulpo.co/api/v1/swagger/index.html ### Authentication OAuth 2.0 authentication endpoints #### POST /auth — Authenticate or refresh an access token operationId: `authenticate` OAuth 2.0 endpoint supporting two grant types: - `password` — exchange username + password for an access token. - `refresh_token` — exchange a previously issued `refresh_token` for a fresh access token without re-prompting for credentials. **Important:** - Tokens expire after 60 minutes - Store the token and reuse it until expiry - Do NOT request a new token for every API call - Create a dedicated API user with access to all warehouses - If the auth response includes a `refresh_token`, use the `refresh_token` grant to silently renew the access token instead of re-submitting credentials. Request body (object | object): - (no documented fields) Responses: - 200: Successfully authenticated - 401: Unauthorized - invalid or missing token - 429: Rate limit exceeded - too many requests #### POST /auth/revoke — Revoke an access or refresh token operationId: `revokeToken` Best-effort logout — revokes the supplied token so it can no longer be used. Send the current `Authorization: Bearer ` header AND the token to revoke in the body. Servers may accept revoking a `refresh_token` here as well. Returning 200 indicates the token is no longer valid; clients should also clear their local copy regardless of the response. Request body (object): - `token` (string, required) — Access or refresh token to revoke Responses: - 200: Token revoked - 401: Unauthorized - invalid or missing token ### User & Tenant User and tenant information, and the tenant's **tags**. **Tags = product_categories** What the PULPO apps (mobile and browser) call **tags** is called **`product_categories`** in the API. They are the same thing — only the name differs. Despite the name, they are not limited to products: a tag can be assigned to **products**, **users** and **warehouse locations**. Create a tag once per tenant, then assign it by its **ID**: | Record | How to assign tags | |--------|--------------------| | Product | `product_categories: [ids]` in `POST` / `PUT /inventory/bulk/products` | | User | `product_categories: [ids]` in `POST /iam/users`, later `POST /iam/users/{id}/categories` | | Location | `product_categories: [ids]` in `POST /warehouses/locations` or `PUT /warehouses/locations/{id}` | In every case the list **replaces** the record's tags and `[]` removes them all. Send tag IDs only — codes, objects, or a field called `tags` don't work. Products and locations can be searched by tag with `product_categories=`. **Locations — watch out:** - `PUT /warehouses/locations/{id}` **without** `product_categories` removes all of the location's tags. Always resend them. - `POST /warehouses/locations/categories/assign` (`{"locations": [ids], "product_categories": [ids]}`) **adds** tags instead of replacing them, creates duplicates when repeated, and its result doesn't show in `GET /warehouses/locations/{id}` (only in the location search). Prefer `PUT /warehouses/locations/{id}`. #### GET /iam/users/me — Get current user information operationId: `getCurrentUser` Returns detailed information about the authenticated user, including: - Tenant ID and details - Accessible warehouses (allowlist — users only see data for these warehouses) - Accessible merchants (allowlist) - User profiles and permissions Use this endpoint to obtain your `tenant_id` and `warehouse_id` values. The returned `warehouses[]` and `merchants[]` define the user's effective authorization scope. There is no explicit role/permission field — visibility is implied by these allowlists, and clients should filter server responses against the same sets. Responses: - 200: User information retrieved successfully - 401: Unauthorized - invalid or missing token #### GET /iam/users/{id}/merchants — List merchants accessible to a user operationId: `getUserMerchants` Returns the merchants the given user has access to. Equivalent to `me.merchants[]`, but addressable by ID. If this endpoint is not available for your tenant, fall back to `GET /merchants/` and intersect with the user's `merchants` allowlist. Parameters: - `id` (path, integer, required) Responses: - 200: Merchants for the user - 401: Unauthorized - invalid or missing token #### GET /iam/merchants/{id}/channels — List sales channels for a merchant operationId: `getMerchantChannels` Returns the merchant_channels configured for a given merchant. Use the returned `id` as `merchant_channel_id` on order/product creation. Parameters: - `id` (path, integer, required) — Merchant ID Responses: - 200: Channels retrieved - 401: Unauthorized - invalid or missing token #### GET /iam/users/{id}/tasks — List active tasks owned by a user operationId: `getUserTasks` Returns the set of in-flight warehouse tasks currently assigned to a user. Useful for the "one task at a time per user" rule applied in picking/packing — before opening a new flow, check whether the user already owns an active task. **Note:** Paused (`locked`) packing orders are **not** included here. Query `GET /packing/orders?state=locked` to find them. Parameters: - `id` (path, integer, required) — User ID Responses: - 200: Active tasks for the user - 401: Unauthorized - invalid or missing token #### GET /inventory/products/categories — Search tags (product_categories) operationId: `searchTags` Lists the tenant's tags. Tags are called `product_categories` in the API. **Filters:** `id`, `code` and `name` are exact, case-sensitive matches (`code=Cold` does not find `cold`). `id` and `code` also accept `to_list:` for several values. `total_results` is `null` when `offset` is greater than 0. Parameters: - `id` (query, string) — Tag ID, or `to_list:id1,id2` - `code` (query, string) — Exact code, or `to_list:code1,code2` - `name` (query, string) — Exact name - `limit` (query, integer) — Number of items to return (1-2000) - `offset` (query, integer) — Number of items to skip - `sort_by` (query, string) — Sort field and direction (field:asc or field:desc) Responses: - 200: Tags retrieved - 401: Unauthorized - invalid or missing token #### GET /inventory/products/categories/{id} — Get a tag by ID operationId: `getTag` Parameters: - `id` (path, integer, required) Responses: - 200: Tag retrieved - 401: Unauthorized - invalid or missing token - 422: Unknown ID #### POST /inventory/products/categories — Create a tag (product_category) operationId: `createTag` Creates a tag for the tenant. Send a plain object (not wrapped). - `code`, `name` and `tenant_id` are required. `tenant_id` must be your own tenant (see `GET /iam/users/me`). - `code` must be unique within the tenant. It is case-sensitive, so `cold` and `Cold` count as different codes. - `name` does not need to be unique. Use the returned `id` to assign the tag to products, users or locations. Request body (object): - `code` (string, required) - `name` (string, required) - `tenant_id` (integer, required) Responses: - 201: Tag created - 400: Missing field, duplicate code, or a tenant the user doesn't belong to. - 401: Unauthorized - invalid or missing token #### POST /iam/users/{id}/categories — Set a user's tags operationId: `setUserTags` Sets the user's **tags** (`product_categories`). The body is a plain JSON array of tag IDs. The list **replaces** the user's tags; `[]` removes all of them. If any ID is unknown, the whole call fails and nothing changes. Tag codes are rejected. This is the only way to change a user's tags after creation: `PUT /iam/users/{id}` silently ignores `product_categories`. When creating a user with `POST /iam/users`, tags can be sent directly as `product_categories: [ids]`. Returns the full user, including the new `product_categories`. Parameters: - `id` (path, integer, required) — User ID Request body (array of integer): - (no documented fields) Responses: - 200: Tags set. The body is the full user. - 400: Body is not a JSON array. - 401: Unauthorized - invalid or missing token - 422: Unknown tag ID or tag code sent, or unknown user. Nothing changed. #### PUT /inventory/products/categories/{id} — Update a tag operationId: `updateTag` Changes a tag's `code` and/or `name`. Only the fields you send change. The same rules as on create apply: `code` must stay unique, neither may be empty. Products, users and locations keep the tag — they reference it by ID, so a new code or name shows up everywhere. Parameters: - `id` (path, integer, required) Request body (object): - `code` (string) - `name` (string) Responses: - 200: Tag updated - 401: Unauthorized - invalid or missing token - 422: Unknown ID, duplicate code, or empty value. #### DELETE /inventory/products/categories/{id} — Delete a tag operationId: `deleteTag` Deletes a tag and returns it. **Careful:** a tag that is in use can be deleted too. There is no warning — the tag is silently removed from the products that had it (tested for products; users and locations presumably behave the same). Parameters: - `id` (path, integer, required) Responses: - 200: Tag deleted. The body is the deleted tag. - 401: Unauthorized - invalid or missing token - 422: Unknown ID ### Warehouses Warehouse management #### GET /warehouses/ — List all warehouses operationId: `listWarehouses` Returns detailed information about all warehouses accessible to the current user. Use this to get warehouse IDs required for order creation. Parameters: - `limit` (query, integer) — Number of items to return (1-2000) - `offset` (query, integer) — Number of items to skip Responses: - 200: Warehouses retrieved successfully - 401: Unauthorized - invalid or missing token #### GET /warehouses/locations — Get warehouse locations operationId: `getWarehouseLocations` Returns physical locations within a warehouse. **Use cases:** - Find kitting locations for kitting tasks - Map warehouse layout - Track stock by specific bin/shelf Parameters: - `location_type_id` (query, integer) — Filter by location type (e.g., kitting, storage, return) - `warehouse_id` (query, integer) - `limit` (query, integer) — Number of items to return (1-2000) - `offset` (query, integer) — Number of items to skip Responses: - 200: Locations retrieved ### Products Product master data #### GET /inventory/products — Search products operationId: `searchProducts` Search and filter products with pagination. **Useful filters:** - `id`, `sku`, `article_number`, `barcode` — exact match, or `sku`/`name` accept a `contains:term` prefix for a substring search - `name`, `description` — exact match, or `contains:term` on `name` - `management_type` — `none`, `lot`, `serial` - `third_party_id` — default supplier - `merchant_id` (also `to_list:`), `active`, `has_stock` - `product_categories` — tag ID, or `to_list:id1,id2` for products with any of them. Tag codes return an error. - `holds_stock_on_warehouse_id` / `holds_blocked_stock_on_warehouse_id` — single ID or `to_list:id1,id2` - `related_orders_state`, `related_orders_delivery_date` — exact match only, `YYYY-MM-DD HH:MM:SS`. A bare date or a `gte:`/`between:`/etc. prefix returns a 500 error. - `view_attributes=id,sku,name` (return only specific fields) `__or_search` and `show_deleted` are accepted but don't do anything on this endpoint — deleted products never appear in search results regardless. Parameters: - `limit` (query, integer) — Number of items to return (1-2000) - `offset` (query, integer) — Number of items to skip - `sort_by` (query, string) — Sort field and direction (field:asc or field:desc) - `capped_limit` (query, integer) — Set to 0 to exclude total_results and improve performance by ~20%. Pagination continues until returned items < limit. Allowed: `0`, `20`, `100`, `2000`. - `id` (query, integer) - `sku` (query, string) — Exact match or `contains:term` substring search - `article_number` (query, string) — Exact match. - `barcode` (query, string) — Exact match against any of the product's `barcodes`. - `name` (query, string) — Exact match or `contains:term` - `description` (query, string) — Exact match. - `management_type` (query, string) Allowed: `none`, `lot`, `serial`. - `third_party_id` (query, integer) — Default supplier ID. - `merchant_id` (query, string) — Merchant ID. Use `to_list:1,2,3` for multiple. - `active` (query, boolean) - `has_stock` (query, boolean) — Whether the product has at least one stock record. - `holds_stock_on_warehouse_id` (query, string) — Restricts `has_stock` to the given warehouse(s). Single ID or `to_list:id1,id2`. - `holds_blocked_stock_on_warehouse_id` (query, string) — Product holds stock on a blocked position (unavailable state) in the given warehouse(s). Single ID or `to_list:id1,id2`. - `related_orders_state` (query, string) — State of orders that reference this product. - `related_orders_delivery_date` (query, string) — Delivery date of orders that reference this product. Exact match only, `YYYY-MM-DD HH:MM:SS` — a bare date or a `gte:`/`between:`/etc. prefix returns a 500 error. - `view_attributes` (query, string) — Comma-separated list of fields to return Responses: - 200: Products found - 401: Unauthorized - invalid or missing token #### POST /inventory/bulk/products — Create products in bulk operationId: `bulkCreateProducts` Creates multiple products at once. Products are the master data for all items in your warehouse. To update existing products instead, use `PUT /inventory/bulk/products`. **Important fields:** - `sku`: Unique identifier per product (your external reference) - `name`: Unique product name - `merchant_id`: Owner of the product - `barcodes`: Required for scanning in warehouse (Android app) - `management_type`: none, lot, or serial (for batch tracking) **Recommended batch size:** up to 50 items per request. Request body (array of object): - `id` (integer) — PULPO WMS product ID. Only used to identify the product on `PUT /inventory/bulk/products` (alternative to `sku`) — ignored on create. - `active` (boolean, required) — Product is active. Set to `false` to deactivate without deleting — see `DELETE /inventory/bulk/products` to remove a product entirely. - `name` (string, required) — Unique product name per tenant - `sku` (string, required) — Unique SKU per product and tenant (your reference) - `description` (string) - `management_type` (string, required) — Inventory tracking method Allowed: `none`, `lot`, `serial`. - `batch_control` (boolean, required) — Enable batch/expiry date tracking (use with lot/serial) - `tenant_id` (integer, required) — Your PULPO WMS account ID - `merchant_id` (integer, required) — Product owner (merchant) - `merchant_channel_id` (integer) — Specific channel (null = all channels) - `third_party_id` (integer) — Default supplier ID - `cost_price` (number, required) — Product cost (use 1 if not relevant) - `minimum_purchase_unit` (integer, required) — Minimum purchase quantity - `minimum_sales_unit` (integer, required) — Minimum sales quantity - `units_per_purchase_package` (integer, required) — Units per package (usually 1) - `units_per_sales_package` (integer, required) — Units per sales package (usually 1) - `purchase_measure_units` (string, required) — Unit of measure for purchasing - `sales_measure_units` (string, required) — Unit of measure for sales - `weight` (number, required) — Weight in kg - `length` (number) — Length in cm - `width` (number) — Width in cm - `height` (number) — Height in cm - `volume` (number) — Volume in cubic meters - `stackable` (boolean) — Can be stacked - `barcodes` (array of string, required) — Product barcodes (required for warehouse scanning) - `product_categories` (array of integer) — **Tags** for the product, as a list of tag IDs (from `GET /inventory/products/categories`). Tags are called `product_categories` in the API. Codes or objects are rejected, and an unknown ID rejects the product. On update the list **replaces** the product's tags: `[]` removes all, leaving the field out (or `null`) keeps them. A field named `tags` is ignored. - `hs_code` (string) — Harmonized System code for customs - `origin_country` (string) — Country of origin (ISO 2-letter code) - `supplier_product_id` (string) — Supplier's product code - `article_number` (string) — Internal article number (optional). Some integrations match incoming product feeds against this field as a fallback when SKU is absent. - `units_per_pallet` (integer) — Units per shipping pallet (optional) - `lead_time` (integer) — Supplier lead time in days. **Note:** sent by some clients but server persistence may be partial — verify with your tenant before relying on it for ordering decisions. - `moq` (integer) — Minimum order quantity. **Note:** sent by some clients but server persistence may be partial — verify before relying on it. - `attributes` (object) — Custom attributes (flexible JSON). Some keys are read by the dashboard: `image_url` (or aliases `imageUrl`, `image`, `picture_url`, `pictureUrl`) renders the product thumbnail. On update, the whole object is replaced, not merged — resend every key you want to keep. Responses: - 201: Products processed. Check `created` for the products that succeeded and `errors` for the ones that didn't — a partial failure still returns 201 if at least the request itself was well-formed. - 400: All items failed validation — none were created. - 401: Unauthorized - invalid or missing token - 429: Rate limit exceeded - too many requests #### PUT /inventory/bulk/products — Update products in bulk operationId: `bulkUpdateProducts` Updates existing products. Works as bulk — if any product update fails, the remaining products continue processing. **Identify the product to update:** - `sku`: Product SKU (looked up together with your tenant) - `id`: PULPO product ID also works, if you already store it **Updatable fields:** Send only the fields you want to change, plus the identifier — this is a partial update, **except for `barcodes`**: it must always be included and non-empty (resend the existing barcodes if you're not changing them, or the request fails). Any other field accepted by product creation can be updated — `name`, `active`, `cost_price`, `attributes`, etc. **`attributes` is replaced, not merged:** whatever you send becomes the product's complete `attributes` object, and any key you leave out is deleted (including `image_url`, which drives the dashboard thumbnail). To change one attribute, send all existing keys along with it. To deactivate a product instead of updating it, send `active: false`. **Recommended batch size:** up to 50 items per request. Request body (array of object): - `id` (integer) — PULPO WMS product ID. Only used to identify the product on `PUT /inventory/bulk/products` (alternative to `sku`) — ignored on create. - `active` (boolean, required) — Product is active. Set to `false` to deactivate without deleting — see `DELETE /inventory/bulk/products` to remove a product entirely. - `name` (string, required) — Unique product name per tenant - `sku` (string, required) — Unique SKU per product and tenant (your reference) - `description` (string) - `management_type` (string, required) — Inventory tracking method Allowed: `none`, `lot`, `serial`. - `batch_control` (boolean, required) — Enable batch/expiry date tracking (use with lot/serial) - `tenant_id` (integer, required) — Your PULPO WMS account ID - `merchant_id` (integer, required) — Product owner (merchant) - `merchant_channel_id` (integer) — Specific channel (null = all channels) - `third_party_id` (integer) — Default supplier ID - `cost_price` (number, required) — Product cost (use 1 if not relevant) - `minimum_purchase_unit` (integer, required) — Minimum purchase quantity - `minimum_sales_unit` (integer, required) — Minimum sales quantity - `units_per_purchase_package` (integer, required) — Units per package (usually 1) - `units_per_sales_package` (integer, required) — Units per sales package (usually 1) - `purchase_measure_units` (string, required) — Unit of measure for purchasing - `sales_measure_units` (string, required) — Unit of measure for sales - `weight` (number, required) — Weight in kg - `length` (number) — Length in cm - `width` (number) — Width in cm - `height` (number) — Height in cm - `volume` (number) — Volume in cubic meters - `stackable` (boolean) — Can be stacked - `barcodes` (array of string, required) — Product barcodes (required for warehouse scanning) - `product_categories` (array of integer) — **Tags** for the product, as a list of tag IDs (from `GET /inventory/products/categories`). Tags are called `product_categories` in the API. Codes or objects are rejected, and an unknown ID rejects the product. On update the list **replaces** the product's tags: `[]` removes all, leaving the field out (or `null`) keeps them. A field named `tags` is ignored. - `hs_code` (string) — Harmonized System code for customs - `origin_country` (string) — Country of origin (ISO 2-letter code) - `supplier_product_id` (string) — Supplier's product code - `article_number` (string) — Internal article number (optional). Some integrations match incoming product feeds against this field as a fallback when SKU is absent. - `units_per_pallet` (integer) — Units per shipping pallet (optional) - `lead_time` (integer) — Supplier lead time in days. **Note:** sent by some clients but server persistence may be partial — verify with your tenant before relying on it for ordering decisions. - `moq` (integer) — Minimum order quantity. **Note:** sent by some clients but server persistence may be partial — verify before relying on it. - `attributes` (object) — Custom attributes (flexible JSON). Some keys are read by the dashboard: `image_url` (or aliases `imageUrl`, `image`, `picture_url`, `pictureUrl`) renders the product thumbnail. On update, the whole object is replaced, not merged — resend every key you want to keep. Responses: - 200: Products processed. Check `updated` for the products that succeeded and `errors` for the ones that didn't. - 401: Unauthorized - invalid or missing token - 422: All items failed validation — none were updated. #### DELETE /inventory/bulk/products — Delete products in bulk operationId: `bulkDeleteProducts` Permanently removes products. Deleted products no longer appear in `GET /inventory/products` or other product searches. Works as bulk — if any product fails to delete, the remaining products are still processed. **Recommended batch size:** up to 50 items per request. Request body (array of object | array of string | array of integer): - (no documented fields) Responses: - 200: Products processed. Check `deleted` for the products that succeeded and `errors` for the ones that didn't. - 401: Unauthorized - invalid or missing token - 422: All items failed — none were deleted (e.g. unknown sku/id). ### Third Parties Suppliers and customers #### POST /iam/bulk/third_parties — Create third parties in bulk operationId: `bulkCreateThirdParties` Creates suppliers (type=S) or customers (type=C) in bulk. To update existing third parties instead, use `PUT /iam/bulk/third_parties`. **Suppliers (type=S):** - Used in purchase orders - `merchant_channel_id` can be NULL **Customers (type=C):** - Used in sales orders - `merchant_channel_id` is REQUIRED **Important:** - Store the returned `id` for use in orders - `identifier_number` + `third_type` must be unique — creating a duplicate is rejected, it does not update the existing record **Recommended batch size:** up to 50 items per request. Request body (array of object): - `active` (boolean, required) — Third party is active - `name` (string, required) — Company/person name - `identifier_number` (string, required) — External reference (unique with third_type) - `identifier_type` (string, required) — Type of identifier (ID, VAT, TAX, etc) - `third_type` (string, required) — S=Supplier, C=Customer Allowed: `S`, `C`. - `email` (string) - `tenant_id` (integer, required) - `merchant_id` (integer, required) — Associated merchant - `merchant_channel_id` (integer) — Required for customers (C), optional for suppliers (S) - `erp_id` (string) — External ERP ID - `erp_code` (string) — External ERP code - `attributes` (object) — Custom attributes including addresses - `addresses` (array of object) - `name` (string) - `company_name` (string) - `phone_number` (string) - `address` (object) Responses: - 201: Third parties processed. Check `created` for the ones that succeeded and `errors` for the ones that didn't. - 400: All items failed validation — none were created. - 401: Unauthorized - invalid or missing token #### PUT /iam/bulk/third_parties — Update third parties in bulk operationId: `bulkUpdateThirdParties` Updates existing suppliers or customers. Works as bulk — if any item fails, the remaining ones continue processing. This is a partial update — send only the fields you want to change, plus an identifier. **Identify the third party to update:** - `identifier_number` (with `third_type`) - `id`: PULPO third party ID also works **Recommended batch size:** up to 50 items per request. Request body (array of object): - `active` (boolean, required) — Third party is active - `name` (string, required) — Company/person name - `identifier_number` (string, required) — External reference (unique with third_type) - `identifier_type` (string, required) — Type of identifier (ID, VAT, TAX, etc) - `third_type` (string, required) — S=Supplier, C=Customer Allowed: `S`, `C`. - `email` (string) - `tenant_id` (integer, required) - `merchant_id` (integer, required) — Associated merchant - `merchant_channel_id` (integer) — Required for customers (C), optional for suppliers (S) - `erp_id` (string) — External ERP ID - `erp_code` (string) — External ERP code - `attributes` (object) — Custom attributes including addresses - `addresses` (array of object) - `name` (string) - `company_name` (string) - `phone_number` (string) - `address` (object) Responses: - 200: Third parties processed. Check `updated` for the ones that succeeded and `errors` for the ones that didn't. - 401: Unauthorized - invalid or missing token - 422: All items failed — none were updated (e.g. unknown identifier_number/id). #### DELETE /iam/third_parties/{id} — Delete a third party operationId: `deleteThirdParty` Deletes a single supplier or customer by its PULPO ID. This is a soft delete — the record is deactivated (`active: false`, `deleted_at`, `deleted_by` set) and no longer appears in third party searches. Third parties referenced by existing orders (purchase orders or sales orders) cannot be deleted — deactivate them instead with `PUT /iam/bulk/third_parties` (`active: false`). Parameters: - `id` (path, integer, required) Responses: - 200: Third party deleted (soft-deleted). - 401: Unauthorized - invalid or missing token - 422: Invalid ID, or the third party has order history and cannot be deleted. ### Purchase Orders Incoming goods and purchase orders #### GET /reception/purchase_orders — List purchase orders operationId: `listPurchaseOrders` Lists purchase orders (incoming, returns, warehouse movements) with filters and pagination. **Useful filters** - `id`, `order_num` — exact match - `warehouse_id`, `state`, `merchant_id` (also `to_list:`) - `product_sku`, `product_name` — exact match, not a substring search - `delivery_date` — exact match only, `YYYY-MM-DD HH:MM:SS`. `between:`/`gte:`/`lte:` prefixes are **not** supported and return a 500 error. - `view_attributes` — comma-separated field list to return `type`, `third_party_id`, `updated_at`, and a plain `inserted_at` filter are accepted but don't actually filter anything on this endpoint — the response is unaffected either way, so don't rely on them. **Performance** Pass `cap_limit=0` (or `capped_limit=0`) to skip the total-results count for ~20% lower latency. Stop paginating when the returned page is shorter than the requested `limit`. Parameters: - `limit` (query, integer) — Number of items to return (1-2000) - `offset` (query, integer) — Number of items to skip - `sort_by` (query, string) — Sort field and direction (field:asc or field:desc) - `capped_limit` (query, integer) — Set to 0 to exclude total_results and improve performance by ~20%. Pagination continues until returned items < limit. Allowed: `0`, `20`, `100`, `2000`. - `id` (query, integer) - `order_num` (query, string) - `warehouse_id` (query, integer) - `state` (query, string) Allowed: `queue`, `checking`, `finished_partially`, `closed`, `cancelled`. - `merchant_id` (query, string) — Merchant ID. Use `to_list:1,2,3` for multiple. - `product_sku` (query, string) — Exact SKU match. - `product_name` (query, string) — Exact product name match (not a substring search). - `delivery_date` (query, string) — Exact match only, `YYYY-MM-DD HH:MM:SS`. Range prefixes (`between:`/`gte:`/`lte:`) are not supported and return a 500 error. - `view_attributes` (query, string) — Comma-separated list of fields to return Responses: - 200: Purchase orders retrieved - 401: Unauthorized - invalid or missing token #### GET /reception/incoming_goods/{id} — Get an incoming-goods record by ID operationId: `getIncomingGood` Returns the full incoming-goods record, including per-item states, batch details, destination locations, inspection photos (`attachments[]`), and the operator who recorded the receipt (`owner`). Parameters: - `id` (path, integer, required) Responses: - 200: Incoming-goods record retrieved - 401: Unauthorized - invalid or missing token - 404: Resource not found #### GET /reception/incoming_goods — List incoming-goods (receiving) records operationId: `listIncomingGoods` Lists incoming-goods records — individual receiving events against purchase orders. A purchase order may have multiple incoming_goods (partial receipts). For returns, query with `document_type=return` to see inspection history, including per-item accepted/rejected outcomes and attached photos. **Filters** - `warehouse_id`, `purchase_order_id`, `merchant_id` (`to_list:` supported), `owner_id`, `sequence_number` — exact match - `document_type` — `purchase_order`, `return`, `warehouse_movement`, `none` (`none` = unplanned receiving without a PO) - `start_date` / `end_date` — filter by `inserted_at`. **Must be a full date-time** (`YYYY-MM-DDTHH:MM:SS`) — a bare `YYYY-MM-DD` date returns a 500 error. `sales_order_id` and a plain `inserted_at` filter are not supported by this endpoint — both are silently ignored or error; use `start_date`/`end_date` instead. Parameters: - `limit` (query, integer) — Number of items to return (1-2000) - `offset` (query, integer) — Number of items to skip - `sort_by` (query, string) — Sort field and direction (field:asc or field:desc) - `capped_limit` (query, integer) — Set to 0 to exclude total_results and improve performance by ~20%. Pagination continues until returned items < limit. Allowed: `0`, `20`, `100`, `2000`. - `warehouse_id` (query, integer) - `purchase_order_id` (query, integer) - `document_type` (query, string) Allowed: `purchase_order`, `return`, `warehouse_movement`, `none`. - `merchant_id` (query, string) — Merchant ID. Use `to_list:1,2,3` for multiple. - `owner_id` (query, integer) — User ID that received/owns the incoming-goods record. - `sequence_number` (query, string) — Exact match, e.g. `IG-0000017`. - `start_date` (query, string) — Filters by `inserted_at`, on/after this timestamp. Must be a full `YYYY-MM-DDTHH:MM:SS` date-time — a bare `YYYY-MM-DD` date returns a 500 error. - `end_date` (query, string) — Filters by `inserted_at`, on/before this timestamp. Same format requirement as `start_date`. Responses: - 200: Incoming-goods records retrieved - 401: Unauthorized - invalid or missing token #### POST /reception/bulk/purchase_orders — Create purchase orders in bulk operationId: `bulkCreatePurchaseOrders` Creates multiple purchase orders for incoming goods. **Order Types:** - `purchase_order`: Standard incoming goods (default) - `return`: Customer returns (see Returns section for full workflow) - `warehouse_movement`: Stock transfer from another warehouse **Workflow:** 1. Create purchase order via API 2. Warehouse receives goods (Android app) 3. Webhook `purchase_order_finished` fires (Goods Receipt) 4. Webhook `replenishment_order_finished` fires (stock available) **Important:** - Products and suppliers must exist before creating PO - Use `product_sku` OR `product_id` in items - `delivery_date` should be in format YYYY-MM-DDTHH:MM:SS **For Returns:** - Set `type: return` - Include `sales_order_id` referencing the original order - Use the **customer** (type=C) as `third_party_id` (the customer becomes the "supplier" of returned goods) - For batch-controlled products, include batch/lot numbers in `items[].batches` array - Use the shipment tracking code as `order_num` for traceability **Recommended batch size:** up to 50 orders per request. Request body (array of object): - `type` (string, required) — Order type Allowed: `purchase_order`, `warehouse_movement`, `return`. - `order_num` (string, required) — Your external order number - `delivery_date` (string, required) — Expected delivery date (YYYY-MM-DDTHH:MM:SS) - `warehouse_id` (integer, required) — Receiving warehouse - `merchant_id` (integer, required) — Merchant receiving goods - `merchant_channel_id` (integer) — Optional channel - `third_party_id` (integer, required) — Supplier ID (type=S) for purchase orders. For **returns**: use the customer ID (type=C) — the customer becomes the "supplier" of returned goods. - `sales_order_id` (integer) — Required when `type=return`. The ID of the original sales order being returned. Retrieve this from `GET /sales/orders/{id}` or from the original order creation response. - `notes` (string) — Order notes - `criterium` (string) — Custom sorting/routing criteria - `attributes` (object) — Custom attributes - `items` (array of object, required) - `product_id` (integer) — PULPO product ID (use this OR product_sku) - `product_sku` (string) — Product SKU (use this OR product_id) - `requested_quantity` (integer, required) — Quantity to receive - `line_item_number` (string) — Line number in source system - `batches` (array of object) — Batch info for lot/serial managed products - `batch_number` (string) - `expiration_date` (string) - `quantity` (integer) - `packagings` (array of object) — Optional physical loading units (pallets, boxes, bags, bins, mixed containers) describing how the order physically arrives. See the [Loading units](/guide/loading-units) guide page for the full model, nesting rules, and worked examples. - `line_item_number` (string, required) — Must match a `line_item_number` in `items`. Ties this unit to one order line (SKU). - `barcode` (string, required) — Identifier of the physical unit. Unique per unit — except a `mix_container`, which repeats the same barcode once per SKU it holds. - `barcode_agency` (string) — Source of the barcode, e.g. `custom` for your own barcodes. - `packaging_type` (string, required) Allowed: `bag`, `bin`, `box`, `pallet`, `mix_container`. - `packaging_level` (integer, required) — Nesting depth. `0` is the outermost unit, sitting directly at a warehouse location. Levels must be contiguous from `0` for a given `line_item_number` — a level-2 unit requires levels 0 and 1 to exist too, chained via `location_level_barcode`. - `location_level_barcode` (string) — `barcode` of the parent unit one level up (same SKU). `null` at level `0`. - `quantity_in_package` (integer, required) — Units of this line's SKU contained in the unit. A parent's quantity equals the sum of its children. - `dimensions_width` (number) — Width of the unit. - `dimensions_height` (number) — Height of the unit. - `dimensions_length` (number) — Length of the unit. - `dimensions_weight` (number) — Weight of the unit (named with the `dimensions_` prefix). Responses: - 201: Purchase orders processed. Check `created` for the ones that succeeded and `errors` for the ones that didn't. - 400: All items failed validation — none were created. - 401: Unauthorized - invalid or missing token #### POST /reception/incoming_goods — Record a receiving event operationId: `createIncomingGood` Records goods received — normally against a purchase order (or return PO), but also usable for unplanned receiving with `document_type: none` and no `purchase_order_id`. Multiple `incoming_goods` records can be created per PO for partial receipts; the `purchase_order_finished` webhook fires once cumulative quantities equal the requested quantities. There is no endpoint to delete or cancel an incoming-goods record once created. **Per-item outcomes** Each item carries a `state` — `accepted` or `rejected` — and a `destination_location_id` that routes the physical units accordingly (storage vs return locations). Rejected items should carry `reason_codes`. Request body (object): - `warehouse_id` (integer, required) - `third_party_id` (integer) — Supplier (PO) or customer (return) - `purchase_order_id` (integer) — Required when receiving against a PO/return - `document_type` (string, required) — `none` = unplanned receiving without a PO Allowed: `purchase_order`, `return`, `warehouse_movement`, `none`. - `merchant_id` (integer) - `merchant_channel_id` (integer) - `owner_id` (integer) — User performing the receipt. Required for the `owner` field to be populated on the returned record. - `start_date` (string, required) — When receiving began (YYYY-MM-DDTHH:MM:SS) - `end_date` (string, required) — When receiving completed - `notes` (string) - `reason_codes` (array of object) — Order-level reason codes. Rejected items more commonly carry their own. - `reason_code` (string) - `items` (array of object, required) - `product_id` (integer) — Use this OR `product_sku` - `product_sku` (string) - `quantity` (integer, required) - `state` (string, required) — Inspection outcome for this line Allowed: `accepted`, `rejected`. - `destination_location_id` (integer, required) — Storage/reception location for accepted units, return/rejection location for rejected units. - `batch_id` (integer) — Required for batch-controlled products - `reason_codes` (array of object) — Reason(s) for a rejected item. - `reason_code` (string) - `temp_id` (string) — Optional client-generated identifier (e.g. a UUID) to correlate this item across your own request/response handling. Not persisted or echoed back. - `notes` (string) Responses: - 201: Receiving event recorded - 400: Bad request - invalid parameters - 401: Unauthorized - invalid or missing token #### DELETE /reception/purchase_orders/{id} — Cancel/delete a purchase order operationId: `deletePurchaseOrder` Cancels a purchase order that hasn't been received yet. This **is** available via the API — despite older guidance suggesting cancellation was warehouse-only, `DELETE` on a `queue`-state order removes it and it no longer appears in `GET /reception/purchase_orders` searches. Orders that have already started receiving are not expected to be cancellable this way — this hasn't been verified against every state. Parameters: - `id` (path, integer, required) Responses: - 200: Purchase order deleted/cancelled. - 401: Unauthorized - invalid or missing token - 422: Invalid ID, or the order's state doesn't allow cancellation. ### Sales Orders **Outgoing Orders and Fulfillment** Sales orders represent outgoing goods from the warehouse. They go through a defined state machine from creation to completion. **Sales Order vs Fulfillment Order** A **sales order** is the customer-facing order. A **fulfillment order** is the execution unit inside the warehouse — typically there is one fulfillment order per sales order, but a sales order may be split into multiple fulfillment orders (e.g., partial fulfillment, multi-warehouse). Picking tasks operate on **fulfillment_order IDs**, not sales order IDs. The `paused` state lives on the **fulfillment order** (`fulfillment_orders[0].state`). The parent sales order remains in `state: queue` while a fulfillment order is paused. Clients should derive the effective UI state as `fulfillment_orders[0].state || sales_order.state`. **Order State Flow** ``` queue ──→ picking ──→ packing ──→ shipping ──→ ended │ ✗ (cannot cancel) ├──→ paused (on FO) ──→ queue (resume) │ ├──→ cancelled (from queue) │ picking ──→ cancelled (if packing locations available) │ packing ──→ cancelled ``` **State Descriptions** | State | Description | |-------|-------------| | `queue` | Order created, waiting to be picked | | `picking` | Items are being picked in the warehouse | | `packing` | Items are being packed into boxes | | `shipping` | Packed and ready for shipment | | `ended` | Order fully fulfilled (Post Goods Issue / PGI) | | `paused` | Temporarily held — applied to the **fulfillment order**, not the sales order | | `cancelled` | Order cancelled — cannot cancel from `ended` | **Priority Levels** | Value | Level | |-------|-------| | 1 | Low | | 2 | Normal | | 3 | High | | 4 | Top | **Common Filter Operators** Sales order list endpoints accept these operator-prefixed filter values: | Operator | Example | Meaning | |----------|---------|---------| | `between:` | `delivery_date=between:2024-03-01 00:00:00,2024-03-31 23:59:59` | Date range (inclusive) | | `gte:` / `lte:` | `inserted_at=gte:2024-03-01 00:00:00` | Greater/less than or equal | | `gt:` / `lt:` | `order_items_count=gt:5` | Strictly greater/less | | `to_list:` | `merchant_id=to_list:69,70,71` | Match any of the listed values | | `includes:` | `product_id=includes:123,456` | Order contains any of these products | | `contains:` | `order_num=contains:SO-2024` | Substring match | The `to_list:` operator works on `merchant_id`, `priority`, `criterium`, and most ID-style filters, not just `priority`. #### GET /sales/orders — Search sales orders operationId: `searchSalesOrders` Searches and filters sales orders with pagination. Supports a wide range of filters for querying orders by state, date, customer, product, and more. **Possible states** (fixed, managed by PULPO): `queue`, `picking`, `packing`, `shipping`, `ended`, `cancelled`. A paused order is not a sales order state — it shows as `paused` on `fulfillment_orders[].state` while the sales order stays in `queue`. **Date filters** support range queries: - `between:2024-01-01 00:00:00,2024-03-31 23:59:59` - `gte:2024-01-01 00:00:00` (greater than or equal) - `lte:2024-03-31 23:59:59` (less than or equal) **Numeric filters** (order_items_count, volume, weight): - `gte:value`, `gt:value`, `lte:value`, `lt:value` **Product filters:** - `product_id=123` — orders containing this product - `product_id=includes:123,456` — orders containing any of these products - `not_product_id=123` — orders NOT containing this product **Priority filters:** - `priority=2` — single priority - `priority=to_list:1,2,3` — multiple priorities **Performance tip:** Use `view_attributes=id,order_num,state` to return only specific fields. Parameters: - `state` (query, string) — Filter by order state Allowed: `queue`, `picking`, `packing`, `shipping`, `ended`, `cancelled`. - `order_num` (query, string) — Filter by external order number - `warehouse_id` (query, integer) — Filter by warehouse ID - `merchant_id` (query, string) — Filter by merchant ID. Use `to_list:1,2,3` for multiple. - `third_party_id` (query, integer) — Filter by customer/third party ID - `client_id` (query, string) — Filter by customer client ID - `product_id` (query, string) — Orders containing this product. Use `includes:id1,id2` for multiple. - `not_product_id` (query, string) — Orders NOT containing this product - `priority` (query, string) — Filter by priority. Use `to_list:1,2` for multiple. - `channel` (query, string) — Filter by sales channel - `inserted_at` (query, string) — Creation date filter (format: YYYY-MM-DD hh:mm:ss). Supports `between:`, `gte:`, `lte:` - `updated_at` (query, string) — Last update filter (format: YYYY-MM-DD hh:mm:ss). Supports `between:`, `gte:`, `lte:` - `delivery_date` (query, string) — Delivery date filter. Supports `between:`, `gte:`, `lte:` - `order_items_count` (query, string) — Filter by number of line items. Supports `gte:`, `gt:`, `lte:`, `lt:` - `estimated_total_weight` (query, string) — Filter by total weight. Supports `gte:`, `gt:`, `lte:`, `lt:` - `estimated_total_volume` (query, string) — Filter by total volume. Supports `gte:`, `gt:`, `lte:`, `lt:` - `order_products_qty` (query, string) — Filter by total product quantity. Supports `gte:`, `gt:`, `lte:`, `lt:` - `criterium` (query, string) — Filter by criterium. Use `to_list:` for multiple. - `return_label` (query, string) — Filter by return label code - `product_category_id` (query, string) — Orders with products matching category ID - `view_attributes` (query, string) — Comma-separated list of fields to return (e.g. `id,order_num,state`). No associations supported. - `id` (query, string) — Filter by sales order ID - `limit` (query, integer) — Number of items to return (1-2000) - `offset` (query, integer) — Number of items to skip - `sort_by` (query, string) — Sort field and direction (field:asc or field:desc) - `capped_limit` (query, integer) — Set to 0 to exclude total_results and improve performance by ~20%. Pagination continues until returned items < limit. Allowed: `0`, `20`, `100`, `2000`. Responses: - 200: Sales orders retrieved - 401: Unauthorized - invalid or missing token #### GET /sales/orders/{id} — Get sales order by ID operationId: `getSalesOrder` Retrieves detailed information about a specific sales order by its PULPO ID. **Use cases:** - Get order details for creating a return purchase order - Check current order state and fulfillment status - Retrieve product list, quantities, and batch information - Get the `third_party_id` (customer) needed for return orders **Response includes:** - Order metadata (state, dates, merchant info) - Items with product IDs, SKUs, and quantities - Ship-to address and customer details - Shipment instructions and tracking info - Batch/lot information for batch-controlled products **Possible states** (fixed, managed by PULPO): `queue`, `picking`, `packing`, `shipping`, `ended`, `cancelled`. A paused order shows as `paused` on `fulfillment_orders[].state`, not on the sales order. Parameters: - `id` (path, integer, required) — Sales order ID Responses: - 200: Sales order retrieved successfully - 401: Unauthorized - invalid or missing token - 404: Resource not found #### GET /sales/orders/fulfillments — Search fulfillment orders operationId: `searchFulfillmentOrders` Lists fulfillment orders. Use it to read the `fulfillment_orders[].id` values for picking, and to poll `process_information` after an asynchronous turbo label picking request. **Polling turbo label picking:** `GET /sales/orders/fulfillments?view_attributes=id,order_num,sequence_number,process_information&id=to_list:14619148,14619149` — repeat until every `process_information.status` is `turbo_label_created` or `error_creating_picking`. Only trust a status whose `attributes.request_id` equals the `x-request-id` response header of your turbo call. `process_information` keeps the result of the previous run — including after its picklist was deleted — until a new run starts. `total_results` is `null` when `offset` is greater than 0. Parameters: - `id` (query, string) — One ID, or several with `to_list:` (e.g. `to_list:14619148,14619149`) - `sales_order_id` (query, integer) - `order_num` (query, string) - `state` (query, string) - `view_attributes` (query, string) — Comma-separated list of fields to return - `limit` (query, integer) — Number of items to return (1-2000) - `offset` (query, integer) — Number of items to skip Responses: - 200: Fulfillment orders retrieved - 401: Unauthorized - invalid or missing token #### GET /sales/orders/{id}/returns — Get returns for a sales order operationId: `getSalesOrderReturns` Returns the return data associated with a specific sales order. **Use cases:** - Check if a sales order has any associated return purchase orders - Get details of returned products and quantities - Verify return status before creating a new return This is useful to avoid creating duplicate returns and to track the return history of an order. Parameters: - `id` (path, integer, required) — Sales order ID Responses: - 200: Return data retrieved successfully - 401: Unauthorized - invalid or missing token - 404: Resource not found #### GET /shipping/shipping_methods — Search shipping methods operationId: `searchShippingMethods` Lists the shipping methods the user can access. Use it to find the `id` you send as `shipping_method_id` when creating sales orders. **Filters** (`name`, `carrier`, `merchant_id`, `merchant_channel_id`) are exact and case-sensitive matches: `name=FedEx` finds "FedEx", `name=fedex` and `name=Fed` find nothing. Filters combine with AND. There is no `service` filter. `total_results` is `null` when `offset` is greater than 0. Parameters: - `name` (query, string) — Exact shipping method name (case-sensitive) - `carrier` (query, string) — Exact carrier (case-sensitive) - `merchant_id` (query, integer) — Only methods of this merchant - `merchant_channel_id` (query, integer) — Only methods of this merchant channel - `limit` (query, integer) — Number of items to return (1-2000) - `offset` (query, integer) — Number of items to skip - `sort_by` (query, string) — Sort field and direction (field:asc or field:desc) Responses: - 200: Shipping methods retrieved - 401: Unauthorized - invalid or missing token #### GET /shipping/shipping_methods/{id} — Get shipping method by ID operationId: `getShippingMethod` Returns one shipping method by its PULPO ID. Parameters: - `id` (path, integer, required) — Shipping method ID Responses: - 200: Shipping method retrieved - 401: Unauthorized - invalid or missing token - 422: Unknown ID, or the shipping method belongs to a merchant the user cannot access. #### POST /sales/bulk/orders — Create sales orders in bulk operationId: `bulkCreateSalesOrders` Creates multiple sales orders for outgoing fulfillment. **Order Types:** - `sales_order`: Standard outgoing order (default) - `warehouse_movement`: Transfer to another warehouse - `return`: Return to supplier - `POS_external`: Direct stock reduction (no picking/packing) **Workflow:** 1. Create sales order via API 2. Warehouse picks items (Android app) 3. Webhook `packing_order_finished` fires (Picking Complete) 4. Warehouse packs items (Android app) 5. Webhook `sales_order_finished` fires (Post Goods Issue) **Customer:** `third_party_id` is required — create the customer first via `POST /iam/bulk/third_parties` (type=C), then pass its `id` here. **Priorities:** required. 1=low, 2=normal, 3=high, 4=top — send `1` if you don't have a use case for it. **Recommended batch size:** up to 50 orders per request. Request body (array of object): - `type` (string, required) — Order type Allowed: `sales_order`, `warehouse_movement`, `return`, `POS_external`. - `order_num` (string, required) — Your external order number (must be unique) - `delivery_date` (string, required) — Required delivery date (YYYY-MM-DDTHH:MM:SS) - `warehouse_id` (integer, required) — Fulfilling warehouse - `merchant_id` (integer, required) — Merchant fulfilling order - `merchant_channel_id` (integer, required) — Sales channel (required) - `third_party_id` (integer, required) — Customer ID (type=C third party). Create the customer first via `POST /iam/bulk/third_parties`, then pass its `id` here. - `identifier_number` (string) — Customer external ID reference - `identifier_type` (string) — ID type (defaults to CUSTOMER_ID if omitted) - `priority` (integer, required) — 1=low, 2=normal, 3=high, 4=top. If you don't have a use case for order priority, send `1`. - `shipping_method_id` (integer) — PULPO ID of the shipping method. The shipping method must already exist — create it with `POST /shipping/shipping_methods` and look it up with `GET /shipping/shipping_methods`. An unknown ID makes the whole request fail with `500 Internal Server Error`. - `destination_warehouse_id` (integer) — Required if type=warehouse_movement - `notes` (string) — Order notes - `criterium` (string) — Custom routing criteria - `is_cart` (boolean) — Shopping cart mode - `ship_to` (object, required) - `name` (string, required) — Recipient name - `company_name` (string) — Company name - `phone_number` (string) — Phone number with country code - `address` (object, required) - `street` (string) - `house_nr` (string) - `city` (string) - `state` (string) - `zip` (string) - `country` (string) — ISO 2-letter country code - `country_code` (string) — ISO numeric country code - `email` (string) - `additional_info` (string) - `items` (array of object, required) - `product_id` (integer) — PULPO product ID (use this OR product_sku) - `product_sku` (string) — Product SKU (use this OR product_id) - `quantity` (integer, required) — Quantity to fulfill - `line_order_id` (string) — Line number in source system - `required_date` (string) — Item-specific required date - `attributes` (object) — Custom line item attributes - `attributes` (object) — Custom attributes Responses: - 201: Sales orders processed. Check `created` for the orders that succeeded and `errors` for the ones that didn't. - 400: All items failed validation — none were created. - 401: Unauthorized - invalid or missing token #### POST /sales/bulk/orders/quick — Create POS orders (instant stock reduction) operationId: `bulkCreateQuickOrders` Creates sales orders of type `POS_external` that immediately reduce stock without going through picking/packing processes. **Use cases:** - Point of sale transactions - Direct sales from warehouse - Stock adjustments via sales **Behavior:** - Order status immediately changes to "finished" - Stock is reduced instantly - No picking or packing tasks created - Webhook `sales_order_finished` fires immediately Despite the instant-fulfillment behavior, `delivery_date` is still required by the schema — send the current time if you don't have a real one. **Recommended batch size:** up to 50 orders per request. Request body (array of object): - `type` (string, required) — Order type Allowed: `sales_order`, `warehouse_movement`, `return`, `POS_external`. - `order_num` (string, required) — Your external order number (must be unique) - `delivery_date` (string, required) — Required delivery date (YYYY-MM-DDTHH:MM:SS) - `warehouse_id` (integer, required) — Fulfilling warehouse - `merchant_id` (integer, required) — Merchant fulfilling order - `merchant_channel_id` (integer, required) — Sales channel (required) - `third_party_id` (integer, required) — Customer ID (type=C third party). Create the customer first via `POST /iam/bulk/third_parties`, then pass its `id` here. - `identifier_number` (string) — Customer external ID reference - `identifier_type` (string) — ID type (defaults to CUSTOMER_ID if omitted) - `priority` (integer, required) — 1=low, 2=normal, 3=high, 4=top. If you don't have a use case for order priority, send `1`. - `shipping_method_id` (integer) — PULPO ID of the shipping method. The shipping method must already exist — create it with `POST /shipping/shipping_methods` and look it up with `GET /shipping/shipping_methods`. An unknown ID makes the whole request fail with `500 Internal Server Error`. - `destination_warehouse_id` (integer) — Required if type=warehouse_movement - `notes` (string) — Order notes - `criterium` (string) — Custom routing criteria - `is_cart` (boolean) — Shopping cart mode - `ship_to` (object, required) - `name` (string, required) — Recipient name - `company_name` (string) — Company name - `phone_number` (string) — Phone number with country code - `address` (object, required) - `street` (string) - `house_nr` (string) - `city` (string) - `state` (string) - `zip` (string) - `country` (string) — ISO 2-letter country code - `country_code` (string) — ISO numeric country code - `email` (string) - `additional_info` (string) - `items` (array of object, required) - `product_id` (integer) — PULPO product ID (use this OR product_sku) - `product_sku` (string) — Product SKU (use this OR product_id) - `quantity` (integer, required) — Quantity to fulfill - `line_order_id` (string) — Line number in source system - `required_date` (string) — Item-specific required date - `attributes` (object) — Custom line item attributes - `attributes` (object) — Custom attributes Responses: - 201: Quick orders processed and fulfilled. Check `created` for the orders that succeeded and `errors` for the ones that didn't. - 400: All items failed (validation error or insufficient stock). #### POST /sales/orders/{id}/cancel — Cancel a single sales order operationId: `cancelSalesOrder` Cancels a specific sales order by ID. **Cancellation rules:** - Orders in state `ended` **cannot** be cancelled - Orders in state `picking` cannot be cancelled when no packing locations are available - The result depends on current state: - `queue` → cancelled immediately - `picking` → picking cancelled, items returned to stock - `packing` → packing cancelled, items returned to stock Parameters: - `id` (path, integer, required) — Sales order ID Responses: - 200: Sales order cancelled - 400: Bad request - invalid parameters - 401: Unauthorized - invalid or missing token #### POST /sales/bulk/orders/cancel — Cancel sales orders in bulk operationId: `bulkCancelSalesOrders` Cancels multiple sales orders. Supports multiple payload formats for flexibility. **Payload formats:** - Array of objects with `order_num`: `[{"order_num": "SO-001"}, ...]` - Array of order numbers: `["SO-001", "SO-002", ...]` - Array of objects with `id`: `[{"id": 123}, ...]` - Array of IDs: `[123, 456, ...]` **Cancellation rules:** - Orders in state `ended` **cannot** be cancelled - Orders in state `picking` cannot be cancelled when there are no available packing locations - The cancellation action depends on the current order state: - `queue` → cancelled immediately - `picking` → picking task cancelled, items returned - `packing` → packing task cancelled, items returned **Recommended batch size:** up to 50 orders per request. Request body (array of object | array of string | array of integer): - (no documented fields) Responses: - 200: Sales orders processed. Check `updated` for the orders that were cancelled and `errors` for the ones that weren't. - 401: Unauthorized - invalid or missing token - 422: All items failed (e.g. unknown order, or state doesn't allow cancellation). #### POST /sales/orders/{id}/pause — Pause a single sales order operationId: `pauseSalesOrder` Pauses a sales order. Only orders in state `queue` can be paused. Paused orders are not available for picking. Parameters: - `id` (path, integer, required) — Sales order ID Responses: - 200: Sales order paused - 400: Bad request - invalid parameters - 401: Unauthorized - invalid or missing token #### POST /sales/bulk/orders/pause — Pause sales orders in bulk operationId: `bulkPauseSalesOrders` Pauses multiple sales orders. Only orders in state `queue` can be paused. **Payload formats** (same as cancel): - `[{"order_num": "SO-001"}, ...]` - `["SO-001", ...]` - `[{"id": 123}, ...]` - `[123, ...]` Paused orders will not be picked until resumed. **Recommended batch size:** up to 50 orders per request. Request body (array of object | array of string | array of integer): - (no documented fields) Responses: - 200: Sales orders processed. Check `updated` for the orders that were paused and `errors` for the ones that weren't. - 401: Unauthorized - invalid or missing token #### POST /sales/orders/{id}/resume — Resume a paused sales order operationId: `resumeSalesOrder` Resumes a paused sales order. Only orders in state `paused` can be resumed. The order returns to `queue` state and becomes available for picking. Parameters: - `id` (path, integer, required) — Sales order ID Responses: - 200: Sales order resumed - 400: Bad request - invalid parameters - 401: Unauthorized - invalid or missing token #### POST /sales/bulk/orders/resume — Resume sales orders in bulk operationId: `bulkResumeSalesOrders` Resumes previously paused sales orders. Only orders in state `paused` can be resumed. Resumed orders return to `queue` state and become available for picking. **Payload formats** (same as cancel/pause): - `[{"order_num": "SO-001"}, ...]` - `["SO-001", ...]` - `[{"id": 123}, ...]` - `[123, ...]` **Recommended batch size:** up to 50 orders per request. Request body (array of object | array of string | array of integer): - (no documented fields) Responses: - 200: Sales orders processed. Check `updated` for the orders that were resumed and `errors` for the ones that weren't. - 401: Unauthorized - invalid or missing token #### POST /sales/orders/{id}/attach — Attach a file to a sales order operationId: `attachFileToSalesOrder` Uploads one file (for example a delivery note) and attaches it to the sales order. Send it as `multipart/form-data`. Each call adds a new attachment — uploading the same file twice creates two attachments. **`type`** — one of `document`, `label`, `photo` or `undefined`. Left out or empty, it is stored as `undefined`. Any other value is rejected. **`document_type`** — only allowed with `type=document`. It is free text and stored exactly as sent (no fixed list, case is kept), for example `delivery_note` or `invoice`. Sending it with any other `type` is rejected. **Files:** PDF and images (PNG tested) are accepted, plain text files are rejected. Attachments can be added in any order state, including `ended`. They are returned in `attachments[]` when you fetch or search the sales order. Parameters: - `id` (path, integer, required) — Sales order ID Request body (object): - `attachment` (string, required) — The file to upload (PDF or image). - `type` (string) Allowed: `document`, `label`, `photo`, `undefined`. - `document_type` (string) — Free text, only with `type=document`. Example `delivery_note`. - `filename` (string) — Name to store instead of the uploaded file's name. Responses: - 201: File attached. The body is the full sales order (same shape as `GET /sales/orders/{id}`) including the new entry in `attachments[]`. - 400: Invalid `type`, `document_type` without `type=document`, or a missing or unsupported file. - 401: Unauthorized - invalid or missing token - 422: Unknown sales order ID. #### POST /shipping/shipping_methods — Create a shipping method operationId: `createShippingMethod` Creates one shipping method. Only `name` is required, and it must be unique within the merchant. If `merchant_id` and `merchant_channel_id` are left out, the method is created for the user's own merchant and channel. Request body (object): - `name` (string, required) — Must be unique within the merchant. - `carrier` (string) - `service` (string) - `fetch_label` (boolean) - `merchant_id` (integer) - `merchant_channel_id` (integer) Responses: - 201: Shipping method created - 400: Validation failed — missing or duplicate name. - 401: Unauthorized - invalid or missing token #### PUT /sales/orders/{id} — Update a single sales order operationId: `updateSalesOrder` Updates an individual sales order by ID. Use this when editing one order with a partial payload — for batch updates, use `PUT /sales/bulk/orders`. **Editable fields** - `notes` - `priority` (1=low, 2=normal, 3=high, 4=top) - `delivery_date` - `items` — replaces the full line-item list; each item may include `id` (to match an existing line), `product_id`, and `quantity` - `ship_to` — when only the address changes for an in-flight order, prefer `PATCH /fulfillment_orders/{id}/ship_to` (the address actually used by shipping) **Edit window** Updates are rejected when the order is in `picking`, `in_picking`, `packing`, `in_packing`, `packed`, `ended`, or `cancelled` states. Clients should gate the edit UI on these states. Parameters: - `id` (path, integer, required) Request body (object): - `notes` (string) - `priority` (integer) - `delivery_date` (string) - `items` (array of object) - `id` (integer) — Existing line ID (omit to add a new line) - `product_id` (integer) - `quantity` (integer) - `ship_to` (object) - `name` (string, required) — Recipient name - `company_name` (string) — Company name - `phone_number` (string) — Phone number with country code - `address` (object, required) - `street` (string) - `house_nr` (string) - `city` (string) - `state` (string) - `zip` (string) - `country` (string) — ISO 2-letter country code - `country_code` (string) — ISO numeric country code - `email` (string) - `additional_info` (string) Responses: - 200: Sales order updated - 400: Bad request - invalid parameters - 401: Unauthorized - invalid or missing token - 404: Resource not found #### PUT /sales/bulk/orders — Update sales orders in bulk operationId: `bulkUpdateSalesOrders` Updates multiple existing sales orders. Works as bulk — if any update fails, the remaining orders continue processing. This is a partial update — send only the fields you want to change, plus an identifier. **Updatable fields:** - `order_num`: External order number - `delivery_date`: Delivery date - `priority`: Order priority (1=low, 2=normal, 3=high, 4=top) - `ship_to`: Shipping address - `notes`: Order notes - `items`: Order line items (replaces existing items) - `shipping_method_id`: Shipping method - `attributes`: Custom attributes **Important:** - Orders must be identified by `order_num` or `id` - Orders in state `ended` or `cancelled` cannot be updated - Updating items replaces the full item list - Updating `attributes` replaces the whole object — keys you leave out are deleted, so resend every key you want to keep **Recommended batch size:** up to 50 orders per request. Request body (array of object): - `type` (string, required) — Order type Allowed: `sales_order`, `warehouse_movement`, `return`, `POS_external`. - `order_num` (string, required) — Your external order number (must be unique) - `delivery_date` (string, required) — Required delivery date (YYYY-MM-DDTHH:MM:SS) - `warehouse_id` (integer, required) — Fulfilling warehouse - `merchant_id` (integer, required) — Merchant fulfilling order - `merchant_channel_id` (integer, required) — Sales channel (required) - `third_party_id` (integer, required) — Customer ID (type=C third party). Create the customer first via `POST /iam/bulk/third_parties`, then pass its `id` here. - `identifier_number` (string) — Customer external ID reference - `identifier_type` (string) — ID type (defaults to CUSTOMER_ID if omitted) - `priority` (integer, required) — 1=low, 2=normal, 3=high, 4=top. If you don't have a use case for order priority, send `1`. - `shipping_method_id` (integer) — PULPO ID of the shipping method. The shipping method must already exist — create it with `POST /shipping/shipping_methods` and look it up with `GET /shipping/shipping_methods`. An unknown ID makes the whole request fail with `500 Internal Server Error`. - `destination_warehouse_id` (integer) — Required if type=warehouse_movement - `notes` (string) — Order notes - `criterium` (string) — Custom routing criteria - `is_cart` (boolean) — Shopping cart mode - `ship_to` (object, required) - `name` (string, required) — Recipient name - `company_name` (string) — Company name - `phone_number` (string) — Phone number with country code - `address` (object, required) - `street` (string) - `house_nr` (string) - `city` (string) - `state` (string) - `zip` (string) - `country` (string) — ISO 2-letter country code - `country_code` (string) — ISO numeric country code - `email` (string) - `additional_info` (string) - `items` (array of object, required) - `product_id` (integer) — PULPO product ID (use this OR product_sku) - `product_sku` (string) — Product SKU (use this OR product_id) - `quantity` (integer, required) — Quantity to fulfill - `line_order_id` (string) — Line number in source system - `required_date` (string) — Item-specific required date - `attributes` (object) — Custom line item attributes - `attributes` (object) — Custom attributes Responses: - 200: Sales orders processed. Check `updated` for the orders that succeeded and `errors` for the ones that didn't. - 401: Unauthorized - invalid or missing token - 422: All items failed (e.g. unknown order, or state doesn't allow updates). #### PUT /shipping/bulk/shipping_methods — Bulk create or update shipping methods operationId: `bulkUpsertShippingMethods` Creates or updates several shipping methods in one call. The body is a plain JSON array (not wrapped in an object). **Matching:** each entry is matched to an existing method by `name` within the merchant. A match is updated, otherwise a new method is created. `id` in the body is ignored, so a method cannot be renamed through this endpoint. **Always send `merchant_id` and `merchant_channel_id`.** Unlike the single create, a new method created here without them gets no merchant. It then doesn't appear in searches, can't be fetched or deleted by the user, and later calls with the same name create further duplicates. Partial success: valid entries are saved even when others fail. If any entry fails the status is `422`, so always read both `created`/`updated` and `errors`. Request body (array of object): - `name` (string, required) — Must be unique within the merchant. - `carrier` (string) - `service` (string) - `fetch_label` (boolean) - `merchant_id` (integer) - `merchant_channel_id` (integer) Responses: - 200: All entries saved. - 400: Body is not a non-empty JSON array. - 401: Unauthorized - invalid or missing token - 422: At least one entry failed. Entries listed in `created`/`updated` were still saved. #### PATCH /fulfillment_orders/{id}/ship_to — Update the ship-to address on a fulfillment order operationId: `updateFulfillmentOrderShipTo` Updates the delivery address used during packing/shipping. This is the endpoint to call when a label generation failure was caused by a bad address — fix the address here, then retry label generation by calling `PUT /packing/orders/{id}/boxes/{box_id}/shipment_tracking/{tracking_id}` with `{ "retry": true }`. Address changes via this endpoint do not propagate back to the parent sales order's `ship_to`; use `PUT /sales/orders/{id}` or `PUT /sales/bulk/orders` to persist the change there too. Parameters: - `id` (path, integer, required) — Fulfillment order ID Request body (object): - `name` (string, required) — Recipient name - `company_name` (string) — Company name - `phone_number` (string) — Phone number with country code - `address` (object, required) - `street` (string) - `house_nr` (string) - `city` (string) - `state` (string) - `zip` (string) - `country` (string) — ISO 2-letter country code - `country_code` (string) — ISO numeric country code - `email` (string) - `additional_info` (string) Responses: - 200: Address updated - 400: Bad request - invalid parameters - 401: Unauthorized - invalid or missing token - 404: Resource not found #### DELETE /sales/orders/{id}/attachments/{attachment_id} — Delete a sales order attachment operationId: `deleteSalesOrderAttachment` Removes one attachment from the sales order. Returns the full sales order without the removed entry. Parameters: - `id` (path, integer, required) — Sales order ID - `attachment_id` (path, string, required) — Attachment ID (UUID) from `attachments[].id` Responses: - 200: Attachment removed. The body is the full sales order. - 401: Unauthorized - invalid or missing token - 422: Unknown or already deleted attachment ID. #### DELETE /shipping/shipping_methods/{id} — Delete a shipping method operationId: `deleteShippingMethod` Permanently deletes a shipping method and returns the deleted record. A shipping method that has ever been assigned to an order cannot be deleted — this also applies when those orders are cancelled. The API then answers `422` with a technical database message mentioning `fulfillment_orders_shipping_method_id_fkey`. Parameters: - `id` (path, integer, required) — Shipping method ID Responses: - 200: Shipping method deleted. The body is the deleted record. - 401: Unauthorized - invalid or missing token - 422: Unknown ID, no access, or the method is used by orders. ### Picking **Picking Tasks** A picking task corresponds to one warehouse picker walking the floor with a device. There are three picking strategies, all selectable when the task is created: | Strategy | Endpoint | Semantics | |----------|----------|-----------| | `single` | `POST /picking/bulk/orders` | One picking task **per** fulfillment_order | | `batch` | `POST /picking/orders` (`cart: false`) | One picking task grouping multiple fulfillment_orders | | `cart` | `POST /picking/orders` (`cart: true`) | Batch pick where each FO is placed in a separate cart slot | Picking task creation always operates on **fulfillment_order IDs**, not sales order IDs (see Sales Orders tag). Flatten `sales_order.fulfillment_orders[].id` before posting. **Picking Order States** | State | Description | |-------|-------------| | `queue` | Created, awaiting a picker | | `taken` | Claimed by a picker | | `ended` | All items picked | | `mixed` | Partially picked — some lines remain | | `cancelled` | Cancelled, items returned to stock | **Insufficient Stock Errors** Both creation endpoints return a structured 400 (`/picking/bulk/orders`) or 422 (`/picking/orders`) when a fulfillment_order has insufficient stock for one or more lines. See `PickingCreateError` schema. The `items[].insufficient_stock` string identifies the failing product. The bulk endpoint additionally returns a top-level `created[]` array with the picklists that were created. The turbo label endpoints (`/picking/orders/turbo`, `/picking/bulk/orders/turbo`) are asynchronous: errors appear in the fulfillment order's `process_information`. #### GET /picking/orders — List picking orders operationId: `listPickingOrders` Retrieves picking orders with filtering and pagination. **Possible states** (fixed, managed by PULPO): - `queue`: Waiting to be picked - `taken`: Being picked - `locked`: Remainder of a picking that was finished early with items missing (usually out of stock). The system creates it locked so it isn't picked again and again while stock is still missing — it must be unlocked manually before a picker can take it. - `mixed`: Partially picked - `ended`: Picking completed - `cancelled`: Cancelled **Useful filters:** - `warehouse_id=140` - `state=ended` - `merchant_id=69` - `sales_order_id=13283307` — picking history for a specific sales order - `updated_at=between:2024-03-01 00:00:00,2024-03-31 23:59:59` `sort_by` is not supported here — any value returns `500 Internal Server Error`. Parameters: - `limit` (query, integer) — Number of items to return (1-2000) - `offset` (query, integer) — Number of items to skip - `capped_limit` (query, integer) — Set to 0 to exclude total_results and improve performance by ~20%. Pagination continues until returned items < limit. Allowed: `0`, `20`, `100`, `2000`. - `warehouse_id` (query, integer) - `state` (query, string) Allowed: `queue`, `taken`, `locked`, `mixed`, `ended`, `cancelled`. - `merchant_id` (query, integer) - `sales_order_id` (query, integer) — Picking orders related to a specific sales order Responses: - 200: Picking orders retrieved #### POST /picking/orders — Create a batch or cart picklist operationId: `createPickingOrder` Creates **one** picklist that groups all given fulfillment orders. Use it for **batch** picking (`cart: false`) and **cart** picking (`cart: true`). For one picklist per order (standard picking), use `POST /picking/bulk/orders`. | Request | Resulting picklist `type` | |---------|---------------------------| | several FOs, `cart: false` | `consolidated` | | several FOs, `cart: true` | `cart_picking` | | one FO, `cart: false` | `normal` | **`orders_count`** splits the given fulfillment orders evenly over that many picklists. Example: 4 FOs with `orders_count: 2` give 2 picklists with 2 FOs each. These picklists get `type: normal`. **`pickers`:** the first user ID becomes the picklist `owner`. Further IDs are ignored. The picklist stays in `queue` until the picker starts it. **All or nothing:** if any fulfillment order can't be picked (for example missing stock or already on a picklist), no picklist is created and the call returns `422`. **`delete_missing_stock_sales_items: true`** reduces lines without enough stock to the available quantity, so the picklist can still be created. The sales order keeps its original quantities. `cart: true` does not change `is_cart` on the sales orders. **Turbo label:** with `turbo_label: true` the picklist is created as a turbo label picklist and the labels are generated **within this request** (synchronous, about 5 seconds per order on staging). For larger volumes use the asynchronous `POST /picking/orders/turbo` instead. Request body (object): - `fulfillment_orders` (array of integer, required) — Fulfillment order IDs (`fulfillment_orders[].id` on the sales order) - `cart` (boolean) — `true` = cart picking, `false` = batch picking - `orders_count` (integer) — Split the fulfillment orders over this many picklists. - `notes` (string) — Note shown on the picklist - `pickers` (array of integer) — User ID to assign the picklist to. Only the first ID is used. - `delete_missing_stock_sales_items` (boolean) — When `true`, lines without enough stock are reduced to the available quantity instead of failing the request. - `turbo_label` (boolean) — Generate labels synchronously (see description). Responses: - 201: Picklist(s) created - 400: `fulfillment_orders` missing or empty. - 401: Unauthorized - invalid or missing token - 422: Nothing was created. Unknown IDs, a fulfillment order that already has a picklist, or missing stock. #### POST /picking/orders/turbo — Create a turbo label batch picklist (asynchronous) operationId: `createTurboPickingOrder` Turbo label version of `POST /picking/orders`: **one** picklist for all given fulfillment orders (`type: consolidated_turbo_label`, or `turbo_label` for a single FO). Before picking starts, PULPO creates a draft packing order per sales order and fetches the shipping labels. **Asynchronous.** The call returns `204 No Content` immediately. The work runs in the background and can take from seconds to minutes, because labels come from external carrier systems. Track the result per fulfillment order with `GET /sales/orders/fulfillments` and its `process_information`: | `process_information.status` | Meaning | |------------------------------|---------| | `queue` | Waiting to be processed | | `started` | Picklist created, labels being fetched. `value` = picklist number | | `turbo_label_created` | Done. `value` = picklist number (e.g. `PI-0000095`) | | `error_creating_picking` | Failed. See `errors`. The fulfillment order stays in `queue` and can be submitted again | **Labels:** one packing box and label **per unit** in a draft packing order of type `turbo_label`, one packing order per sales order. **Not supported here:** `cart: true` and `turbo_label_per_order: true` both end in `error_creating_picking`. Unknown fulfillment order IDs are rejected synchronously with `422`. All other errors (missing stock, already on a picklist) only show up in `process_information`. **Matching the status to your request:** the `x-request-id` header of the `204` response equals `process_information.attributes.request_id` of the run it started. Ignore statuses with a different `request_id` — they are left over from an earlier run. Request body (object): - `fulfillment_orders` (array of integer, required) - `cart` (boolean) — Must be `false`. Cart picking is not supported in turbo mode. - `notes` (string) - `pickers` (array of integer) — User ID to assign the picklist to. Only the first ID is used. - `delete_missing_stock_sales_items` (boolean) - `turbo_label` (boolean) — Ignored — this call always works in turbo mode. Responses: - 204: Accepted. Processing runs in the background — poll `process_information`. - 400: `fulfillment_orders` missing or empty. - 401: Unauthorized - invalid or missing token - 422: Unknown fulfillment order ID. Nothing was started. #### POST /picking/bulk/orders/turbo — Create turbo label standard picklists (asynchronous) operationId: `bulkCreateTurboPickingOrders` Turbo label version of `POST /picking/bulk/orders`: **one** picklist per fulfillment order (`type: turbo_label`). Before picking starts, PULPO creates a draft packing order per sales order and fetches the shipping labels. **Asynchronous.** The call returns `204 No Content` immediately. The work runs in the background and can take from seconds to minutes, because labels come from external carrier systems. Track the result per fulfillment order with `GET /sales/orders/fulfillments` and its `process_information`: | `process_information.status` | Meaning | |------------------------------|---------| | `queue` | Waiting to be processed | | `started` | Picklist created, labels being fetched. `value` = picklist number | | `turbo_label_created` | Done. `value` = picklist number (e.g. `PI-0000092`) | | `error_creating_picking` | Failed. See `errors`. The fulfillment order stays in `queue` and can be submitted again | Each fulfillment order is processed on its own — one can fail while the others succeed. **Labels:** - Default: one packing box and label **per unit**. - `turbo_label_per_order: true` with a `shipment_box_template_id`: **one** box and label for the whole order. Without a template ID this fails with `shipment_box_template_id_required_for_order_per_box_strategy`. **Errors only show up in `process_information`** — the call itself always returns `204` once the body is valid. Unknown fulfillment order IDs are silently ignored. **Matching the status to your request:** the `x-request-id` header of the `204` response equals `process_information.attributes.request_id` of the run it started. Ignore statuses with a different `request_id` — they are left over from an earlier run. Request body (object): - `fulfillment_orders` (array of integer, required) - `orders_count` (integer) — Accepted but has no effect on this call. - `pickers` (array of integer) - `notes` (string) - `delete_missing_stock_sales_items` (boolean) - `turbo_label` (boolean) — Ignored — this call always works in turbo mode. - `turbo_label_per_order` (boolean) — One box and label per order instead of per unit. Requires `shipment_box_template_id`. - `shipment_box_template_id` (integer) — Box template for `turbo_label_per_order` (from `GET /packing/boxes`). Responses: - 204: Accepted. Processing runs in the background — poll `process_information`. - 400: `fulfillment_orders` missing or empty. - 401: Unauthorized - invalid or missing token #### POST /picking/bulk/orders — Create standard picklists (one per order) operationId: `bulkCreatePickingOrders` Creates **one picklist per fulfillment order** (`type: normal`). Use this for standard picking. For one picklist covering several orders, use `POST /picking/orders`. `orders_count` has no effect here — there is always one picklist per order. **`pickers`:** the picklists are assigned to the given users in turn (first picklist → first picker, second → second picker, …). Each becomes the picklist `owner`; the picklist stays in `queue`. **Partial success:** each fulfillment order is handled on its own. Those that work are listed in `created`, the others in `errors`. If at least one fails, the status is `400` — always read both lists. An unknown fulfillment order ID fails the whole call with `422` and creates nothing. **`delete_missing_stock_sales_items: true`** reduces lines without enough stock to the available quantity, so the picklist can still be created. The sales order keeps its original quantities. **Turbo label:** with `turbo_label: true` the picklists are created as turbo label picklists and the labels are generated **within this request** (synchronous, about 5 seconds per order on staging). For larger volumes use the asynchronous `POST /picking/bulk/orders/turbo` instead. Request body (object): - `fulfillment_orders` (array of integer, required) - `orders_count` (integer) — Accepted but has no effect on this call. - `pickers` (array of integer) — User IDs, assigned to the picklists in turn. - `turbo_label` (boolean) — Generate labels synchronously (see description). - `notes` (string) — Note shown on every created picklist - `delete_missing_stock_sales_items` (boolean) Responses: - 201: All picklists created. - 400: At least one fulfillment order failed. Entries in `created` were still created. Also returned when `fulfillment_orders` is missing or empty. - 401: Unauthorized - invalid or missing token - 422: An unknown fulfillment order ID was sent. Nothing was created. #### DELETE /picking/bulk/orders — Delete picklists in bulk operationId: `bulkDeletePickingOrders` Deletes several picklists in one call. The body is a plain JSON array of picklist IDs (`picking_orders[].id`), not wrapped in an object. **What happens to the orders:** the fulfillment orders and sales orders go back to `queue` and can be put on a new picklist. Nothing is cancelled. For turbo label picklists, the draft packing order and its labels are deleted too. `process_information` on the fulfillment order is **not** reset — it still shows the deleted picklist's number until a new turbo run starts. **Partial success:** each ID is handled on its own. If at least one fails, the status is `422` — read both `deleted` and `errors`. Tested on picklists in `queue` only. Request body (array of integer): - (no documented fields) Responses: - 200: All picklists deleted. - 400: Body is not a non-empty array of IDs. - 401: Unauthorized - invalid or missing token - 422: At least one ID failed (unknown or already deleted). Entries in `deleted` were still deleted. #### DELETE /picking/orders/{id} — Delete a picklist operationId: `deletePickingOrder` Deletes one picklist. Same effect as `DELETE /picking/bulk/orders` with a single ID: the orders go back to `queue`, and turbo label packing orders are removed. Returns the deleted picklist. Parameters: - `id` (path, integer, required) — Picklist ID Responses: - 200: Picklist deleted. - 401: Unauthorized - invalid or missing token - 422: Unknown or already deleted ID. ### Packing **Packing Tasks** A packing task is created by the system after picking completes. One packer claims a task and works through its packing boxes until the order is ready to ship. **Packing Order State Machine** ``` queue ─accept─→ taken ─lock─→ locked │ ↑ │ │ └─unlock────┘ (owner: → taken; non-owner: → queue) │ └─finish─→ ended ─close─→ closed ``` | State | Description | |-------|-------------| | `queue` | Awaiting a packer | | `taken` | Owned by a packer (see `owner.id`) | | `locked` | Paused — kept by owner but not actively worked | | `ended` | All boxes closed and `/finish` was called | | `closed` | Final state — `/close` released the owner lock and assigned a shipping location | | `cancelled` | Cancelled (terminal) | **Ownership and "one task at a time"** The authoritative ownership signal is `owner.id` on the packing order. A user may only own one active (`taken` or `locked`) packing order at a time — call `GET /iam/users/{id}/tasks` to discover the current owned task before opening a new one. Paused (`locked`) tasks are NOT included in that endpoint's response — they are queryable via `GET /packing/orders?state=locked`. If a non-owner calls `POST /unlock` on a `locked` task, the task transitions back to `queue` (not `taken`) — they must then call `POST /accept` to claim it. **Polling After Box Close** After triggering label generation, clients should poll `GET /packing/orders/{id}` every ~5 seconds until each closed box has an `attachments[]` entry (the label PDF URL) or `shipment_tracking.error_message` is set. The PULPO app gives up after ~2 minutes; client integrations should use the same budget (24 attempts). The label readiness signal is the presence of `attachments[0].url` on the packing box — **not** solely `shipment_tracking.status`. #### GET /packing/orders — List packing orders operationId: `listPackingOrders` Retrieves packing orders with filtering and pagination. **Possible states** (fixed, managed by PULPO): `draft`, `queue`, `taken`, `locked` (paused), `ended`, `closed`, `cancelled`. Pass `state=locked` to retrieve paused packing orders — `locked` tasks are NOT included in `GET /iam/users/{id}/tasks`, only in this list. **Useful filters:** - `warehouse_id` - `state` - `sales_order_id` — packing orders related to a specific sales order - `view_attributes` — comma-separated field list (controls which nested attributes are returned; useful to keep payloads small for queue views) **Performance:** pass `capped_limit=0` to skip the total-results count for ~20% lower latency. Parameters: - `limit` (query, integer) — Number of items to return (1-2000) - `offset` (query, integer) — Number of items to skip - `sort_by` (query, string) — Sort field and direction (field:asc or field:desc) - `capped_limit` (query, integer) — Set to 0 to exclude total_results and improve performance by ~20%. Pagination continues until returned items < limit. Allowed: `0`, `20`, `100`, `2000`. - `warehouse_id` (query, integer) - `state` (query, string) Allowed: `draft`, `queue`, `taken`, `locked`, `ended`, `closed`, `cancelled`. - `sales_order_id` (query, integer) - `view_attributes` (query, string) — Comma-separated list of fields to return. Example: `id,sequence_number,state,inserted_at,fulfillment_order_id,sales_order_id,origin_location,items,sales_order,fulfillment_order`. Responses: - 200: Packing orders retrieved #### GET /packing/orders/{id} — Get a packing order by ID operationId: `getPackingOrder` Returns the full packing order, including `owner`, `origin_location`, `packing_boxes[]` with attached labels (`attachments[]`), and the items to pack. Clients implementing the packing flow should call this endpoint to poll for label readiness after a box is closed (~5s interval, ~24 attempts). **Possible states** (fixed, managed by PULPO): `draft`, `queue`, `taken`, `locked` (paused), `ended`, `closed`, `cancelled`. Parameters: - `id` (path, integer, required) - `view_attributes` (query, string) — Comma-separated list of fields to return Responses: - 200: Packing order retrieved - 401: Unauthorized - invalid or missing token - 404: Resource not found #### POST /packing/orders/{id}/accept — Claim (accept) a packing order operationId: `acceptPackingOrder` Transitions `queue → taken` and sets `owner` to the calling user. A user may only own one active packing order at a time. Use `GET /iam/users/{id}/tasks` first to ensure no other task is owned. If the order is in `locked` state and the caller is the original owner, use `/unlock` instead. If the caller is not the original owner of a `locked` order, call `/unlock` (returns the order to `queue`) and then `/accept`. Parameters: - `id` (path, integer, required) Responses: - 200: Packing order claimed - 400: Bad request - invalid parameters - 401: Unauthorized - invalid or missing token #### POST /packing/orders/{id}/lock — Pause (lock) a packing order operationId: `lockPackingOrder` Pauses an in-flight packing order. Transitions `taken → locked` while keeping the current owner. The task disappears from `GET /iam/users/{id}/tasks` but remains visible via `GET /packing/orders?state=locked`. Resume with `/unlock` (owner) or by `/unlock` + `/accept` (different user). Parameters: - `id` (path, integer, required) Responses: - 200: Packing order locked - 400: Bad request - invalid parameters - 401: Unauthorized - invalid or missing token #### POST /packing/orders/{id}/unlock — Resume (unlock) a packing order operationId: `unlockPackingOrder` Unlocks a paused packing order. Behavior depends on the caller: | Caller | Transition | |--------|------------| | Original owner | `locked → taken` (resumes work) | | Any other user | `locked → queue` (owner is cleared; the task can then be `/accept`-ed by anyone) | Parameters: - `id` (path, integer, required) Responses: - 200: Packing order unlocked - 400: Bad request - invalid parameters - 401: Unauthorized - invalid or missing token #### POST /packing/orders/{id}/boxes — Close one or more packing boxes (replace boxes array) operationId: `closePackingBoxes` Commits the set of closed packing boxes for the packing order. **Important — replace semantics:** the request body is a complete list of boxes that should exist for this order. The server **replaces** (not appends) the existing boxes. Callers MUST resend every previously-closed box in this list or those records will be wiped. Each box must include `box_number` (1-indexed across the full list) and `packing_order_id` (matching the path parameter). Parameters: - `id` (path, integer, required) Request body (array of object): - `packing_order_id` (integer, required) — Must match the path parameter - `box_number` (integer, required) — 1-indexed across the full list - `weight` (number) - `length` (number) - `width` (number) - `height` (number) - `packing_box_items` (array of object) - `line_order_id` (string) — External line order reference - `quantity` (integer) — Quantity of this product in the box - `product_id` (integer) — Unique product ID in PULPO WMS - `product` (object) - `tenant_id` (integer) - `sku` (string) — Product SKU (unique per tenant and merchant) Responses: - 200: Boxes committed - 400: Bad request - invalid parameters - 401: Unauthorized - invalid or missing token - 422: Invalid state transition (e.g., order state went back to `queue` after a non-owner unlock) #### POST /packing/orders/{packing_order_id}/boxes/{box_id}/attach — Attach label file to packing box operationId: `attachLabelToBox` Uploads a shipping label PDF file to a packing box. **File Requirements:** - Format: PDF - Type: `label` - Max size: Check with PULPO support **Workflow:** 1. Update shipment tracking to "started" 2. Generate label PDF in your system 3. POST label file to this endpoint 4. Update shipment tracking to "generated" with tracking codes Parameters: - `packing_order_id` (path, integer, required) - `box_id` (path, integer, required) Request body (object): - `attachment` (string, required) — PDF file of shipping label - `type` (string, required) Allowed: `label`. Responses: - 200: Label attached successfully - 400: Bad request - invalid parameters - 404: Resource not found #### POST /packing/orders/{id}/finish — Finish a packing order operationId: `finishPackingOrder` Transitions `taken → ended`. All items must be packed and each closed box must have a label attachment (or `pulpowms_label_not_required` status). After `/finish`, call `/close` with a `shipping_location_id` to release the owner lock and move the order to `closed`. Parameters: - `id` (path, integer, required) Responses: - 200: Packing order finished - 400: Bad request - invalid parameters - 401: Unauthorized - invalid or missing token #### POST /packing/orders/{id}/close — Close a packing order operationId: `closePackingOrder` Final step of the packing flow. Transitions `ended → closed`, sets `end_date`, and releases the owner's "one active task" slot so they can claim a new packing order. Requires a `shipping_location_id` — the warehouse location where the packed boxes are physically dropped off for the carrier. Look it up via `GET /warehouses/locations?location_type_id={shipping_area}` (the shipping area location type for the warehouse). Parameters: - `id` (path, integer, required) Request body (object): - `shipping_location_id` (integer, required) — Warehouse location where the boxes are dropped off Responses: - 200: Packing order closed - 400: Bad request - invalid parameters - 401: Unauthorized - invalid or missing token #### PUT /packing/orders/{packing_order_id}/boxes/{box_id}/shipment_tracking/{tracking_id} — Update shipment tracking information operationId: `updateShipmentTracking` Updates shipment tracking for a specific packing box. **Label Generation Workflow:** 1. Subscribe to `packing_box_closed` webhook 2. Receive webhook when box is closed 3. PUT with status `pulpowms_label_generation_started` 4. Generate label in your system 5. POST label file to attach endpoint 6. PUT with status `pulpowms_label_generated` + tracking info **Status Values:** - `null`: Initial state - `pulpowms_label_generation_started`: Label generation in progress - `pulpowms_label_generated`: Label successfully created - `pulpowms_label_generation_failed`: Label creation failed - `pulpowms_label_not_required`: Skip label (no waiting) **Retrying a failed label:** PUT this endpoint with body `{ "retry": true }` to re-trigger label generation for the same tracking record. Combine with `PATCH /fulfillment_orders/{id}/ship_to` first if the failure was an address issue. **Polling:** after triggering label generation, poll `GET /packing/orders/{id}` every ~5 seconds for up to ~2 minutes (24 attempts). Treat the presence of `packing_boxes[].attachments[0].url` as the readiness signal — not `shipment_tracking.status` alone. PULPO's own app gives up at the 2-minute mark. Parameters: - `packing_order_id` (path, integer, required) - `box_id` (path, integer, required) - `tracking_id` (path, integer, required) Request body (object): - `status` (string) — Label generation status Allowed: `pulpowms_label_generation_started`, `pulpowms_label_generated`, `pulpowms_label_generation_failed`, `pulpowms_label_not_required`. - `retry` (boolean) — Set `true` to re-trigger label generation for the same tracking record (e.g., after fixing the ship-to address via `PATCH /fulfillment_orders/{id}/ship_to`). - `tracking_code` (string) — Carrier tracking number (required for success) - `tracking_url` (string) — Carrier tracking URL - `carrier_code` (string) — Carrier code (required for success) - `error_message` (string) — Error message (required for failed status) - `service_point_id` (integer) — Pickup point ID - `attributes` (object) — Custom attributes Responses: - 200: Shipment tracking updated successfully - 404: Resource not found ### Batch Management **Batch & Expiration Date Management** Products with `batch_control: true` and `management_type: lot` or `serial` support batch tracking with expiration dates. This is essential for perishable goods, pharmaceuticals, or any product requiring lot traceability. **Prerequisites** To use batch management, the product must be created with: - `management_type`: `lot` (for lot-based tracking) or `serial` (for serial number tracking) - `batch_control`: `true` (enables expiration date tracking) **Batch Lifecycle** ``` 1. Create product with batch_control=true, management_type=lot 2. POST /inventory/products/{product_id}/batches → Create batch with expiration_date 3. Reference batch in purchase orders (items[].batches array) 4. GET /inventory/products/{product_id}/batches → List batches for a product 5. GET /inventory/stocks/expiring → Monitor expiring stock across warehouse 6. PUT /inventory/products/batches/{batch_id} → Update batch expiration date ``` **Batch Fields** | Field | Description | Format | |-------|-------------|--------| | `number` | Alphanumerical batch/lot number | String | | `type` | Batch type: `lot`, `serial`, or `none` | String | | `expiration_date` | Expiration date of the batch | `YYYY-MM-DD` | | `client_id` | Client identifier associated to batch | String | | `third_party_id` | Supplier ID for the batch | Integer | **Using Batches in Orders** When creating purchase orders or sales orders for batch-controlled products, include the `batches` array in the order items: ```json { "items": [ { "product_id": 7646303, "requested_quantity": 100, "batches": ["LOT-2025-001"] } ] } ``` #### GET /inventory/products/batches — Search all batches operationId: `searchBatches` Searches batches across all products with optional filters. **Filters:** - `product_id`: Filter by specific product - `number`: Filter by batch/lot number - `type`: Filter by batch type - `expiration_date`: Filter by expiration date - `existing_stock`: Only show batches with existing stock - `show_unavailable_stock`: Include batches with unavailable stock Parameters: - `product_id` (query, integer) — Filter by product ID - `number` (query, string) — Alphanumerical batch/lot number - `type` (query, string) — Type of batch Allowed: `lot`, `serial`, `none`. - `expiration_date` (query, string) — Expiration date filter (format: YYYY-MM-DD) - `client_id` (query, string) — Client identifier associated to batch - `existing_stock` (query, boolean) — Only show batches with existing stock - `show_unavailable_stock` (query, boolean) — Include batches with unavailable stock - `limit` (query, integer) — Number of items to return (1-2000) - `offset` (query, integer) — Number of items to skip Responses: - 200: Batches retrieved successfully - 401: Unauthorized - invalid or missing token #### GET /inventory/products/{id}/batches — List batches for a product operationId: `listProductBatches` Returns all batches associated with a specific product. Only applicable for products with `batch_control: true` and `management_type: lot` or `serial`. **Filters:** - `number`: Filter by batch/lot number - `type`: Filter by batch type (`lot`, `serial`, `none`) - `expiration_date`: Filter by expiration date (format: `YYYY-MM-DD`) - `client_id`: Filter by client identifier Parameters: - `id` (path, integer, required) — Product ID - `number` (query, string) — Alphanumerical batch/lot number - `type` (query, string) — Type of batch Allowed: `lot`, `serial`, `none`. - `expiration_date` (query, string) — Expiration date filter (format: YYYY-MM-DD) - `client_id` (query, string) — Client identifier associated to batch - `limit` (query, integer) — Number of items to return (1-2000) - `offset` (query, integer) — Number of items to skip Responses: - 200: Batches retrieved successfully - 400: Bad request - invalid parameters - 401: Unauthorized - invalid or missing token #### GET /inventory/products/batches/{id} — Get batch by ID operationId: `getBatch` Returns detailed information about a specific batch by its ID. Parameters: - `id` (path, integer, required) — Batch ID Responses: - 200: Batch retrieved successfully - 400: Bad request - invalid parameters - 401: Unauthorized - invalid or missing token #### POST /inventory/products/{id}/batches — Create a batch for a product operationId: `createBatch` Creates a new batch/lot for a product that has `batch_control: true`. **Required setup:** - Product must have `management_type` set to `lot` or `serial` - Product must have `batch_control` set to `true` **Use cases:** - Pre-create batches before receiving goods - Register lot numbers with expiration dates for perishable products - Track serial numbers for individual items Parameters: - `id` (path, integer, required) — Product ID Request body (object): - `number` (string, required) — Alphanumerical batch/lot number - `type` (string, required) — Type of batch: `lot`, `serial`, or `none` Allowed: `lot`, `serial`, `none`. - `expiration_date` (string) — Expiration date (format: YYYY-MM-DD) - `client_id` (string) — Client identifier associated to batch - `third_party_id` (string) — Supplier ID for the batch Responses: - 201: Batch created successfully - 400: Bad request - invalid parameters - 401: Unauthorized - invalid or missing token #### PUT /inventory/products/batches/{id} — Update a batch operationId: `updateBatch` Updates fields of a batch, such as the expiration date, lot number, or supplier. **Common use cases:** - Correct an expiration date - Update the supplier (third_party_id) associated with a batch - Change the client identifier Parameters: - `id` (path, integer, required) — Batch ID Request body (object): - `number` (string) — Alphanumerical batch/lot number - `expiration_date` (string) — Expiration date (format: YYYY-MM-DD) - `type` (string) — Type of batch Allowed: `lot`, `serial`, `none`. - `client_id` (string) — Client identifier associated to batch - `third_party_id` (string) — Supplier ID for the batch Responses: - 201: Batch updated successfully - 400: Bad request - invalid parameters - 401: Unauthorized - invalid or missing token ### Stock Inventory and stock management — all endpoints for checking product availability and stock levels. **Checking Product Availability** PULPO WMS provides several ways to query stock depending on your use case: | Endpoint | Purpose | Best For | |----------|---------|----------| | `GET /inventory/stocks/summary` | Aggregated stock totals (total, available, unavailable, rejected) | Quick availability checks, dashboard displays | | `POST /inventory/stocks/products/locations` | Stock breakdown by warehouse location | Warehouse operations, location-level inventory | | `GET /inventory/stocks/expiring` | Stock sorted by expiration date | Perishable goods monitoring, expiry compliance | | `GET /inventory/stocks/availability/products/{id}/batches` | Per-batch/serial available quantities | Batch-specific fulfillment, serial number tracking | **Available vs Total Stock** The **summary** endpoint distinguishes between: - **Total**: Stock physically in storage, user, cross-docking, and packing locations - **Available**: Total minus open orders — this is what you can actually fulfill - **Unavailable**: Stock reserved by open orders + in reception + in return - **Rejected**: Stock in return locations pending inspection **Filtering** All stock endpoints support filtering by `product_id` and `warehouse_id`. The summary endpoint also supports `merchant_id` for multi-tenant queries. #### GET /inventory/stocks — List stock records operationId: `listStocks` Lists raw stock records, optionally scoped to a product, location, batch, or warehouse. Each row represents a stock quantity at a specific (product, location, batch) tuple. **When to use this vs the other stock endpoints:** | Use case | Endpoint | |----------|----------| | Aggregate per-product totals | `GET /inventory/stocks/summary` | | Per-location quantities | `POST /inventory/stocks/products/locations` | | Soon-to-expire stock | This endpoint or `GET /inventory/stocks/batches` (the batch-grouped variant returns more complete batch metadata) | | Count units at one location | This endpoint with `location_id` + `limit=1` | Each row includes nested `batch: { id, number, expiration_date, type }` for batch-managed products — use this rather than `/inventory/stocks/expiring` when you need full batch metadata. Parameters: - `limit` (query, integer) — Number of items to return (1-2000) - `offset` (query, integer) — Number of items to skip - `sort_by` (query, string) — Sort field and direction (field:asc or field:desc) - `capped_limit` (query, integer) — Set to 0 to exclude total_results and improve performance by ~20%. Pagination continues until returned items < limit. Allowed: `0`, `20`, `100`, `2000`. - `warehouse_id` (query, integer) - `product_id` (query, integer) - `location_id` (query, integer) - `batch_id` (query, integer) - `merchant_id` (query, string) — Merchant ID. Use `to_list:1,2,3` for multiple. Responses: - 200: Stock records retrieved - 401: Unauthorized - invalid or missing token #### GET /inventory/stocks/summary — Get stock summary operationId: `getStockSummary` Returns stock summary for products with detailed breakdown. **Stock Types:** - `total`: Stock in storage, user, cross-docking, packing locations - `available`: Total minus open orders - `unavailable`: Open orders + reception + return - `rejected`: Stock in return locations **Filters:** - Filter by `product_id`, `warehouse_id`, `merchant_id` - Repeat `product_id` to query multiple products in one call: `?product_id=1957711&product_id=1957712` - `merchant_id` accepts `to_list:1,2,3` for multi-merchant queries - Combine filters for precise queries Parameters: - `product_id` (query, integer | array of integer) — Product ID; repeat the parameter to query multiple products. - `warehouse_id` (query, integer) - `merchant_id` (query, string) — Merchant ID. Use `to_list:1,2,3` for multiple. - `limit` (query, integer) — Number of items to return (1-2000) - `offset` (query, integer) — Number of items to skip Responses: - 200: Stock summary retrieved #### GET /inventory/stocks/batches — List stock grouped by batch operationId: `listStockBatches` Returns stock aggregated by batch (one row per batch), with each row carrying the total quantity across all locations holding that batch plus the per-location breakdown. This is the recommended endpoint for expiring-stock reporting when you need full batch metadata — `GET /inventory/stocks/expiring` returns a truncated subset of fields. **Filters:** - `batch_expiration_date` — supports `between:`, `gte:`, `lte:` (e.g., `lte:2025-12-31` for soon-to-expire batches) - `total_quantity` — supports `gte:`, `gt:` (e.g., `gt:0` to exclude empty batches) - `product_management_type` — `lot` or `serial` - `merchant_id=to_list:...` for multi-merchant queries Parameters: - `limit` (query, integer) — Number of items to return (1-2000) - `offset` (query, integer) — Number of items to skip - `sort_by` (query, string) — Sort field and direction (field:asc or field:desc) - `capped_limit` (query, integer) — Set to 0 to exclude total_results and improve performance by ~20%. Pagination continues until returned items < limit. Allowed: `0`, `20`, `100`, `2000`. - `warehouse_id` (query, integer) - `merchant_id` (query, string) — Merchant ID. Use `to_list:` for multiple. - `batch_expiration_date` (query, string) — Expiration filter. Supports `between:`, `gte:`, `lte:`. - `total_quantity` (query, string) — Quantity filter. Supports `gte:`, `gt:`. - `product_management_type` (query, string) Allowed: `lot`, `serial`. - `zone_id` (query, integer) - `location_type_id` (query, integer) Responses: - 200: Batch-grouped stock retrieved - 401: Unauthorized - invalid or missing token #### GET /inventory/stocks/expiring — Get expiring stock operationId: `getExpiringStock` Lists stock items sorted by expiration date (ascending), allowing you to identify products that are expiring soon. **Use cases:** - Monitor perishable goods approaching expiry - Plan promotions or markdowns for soon-to-expire stock - Generate expiry reports for compliance **Filters:** - `product_id`: Filter by specific product - `batch_id`: Filter by specific batch - `zone_id`, `location_id`: Filter by warehouse zone/location - `stock_state_id`: Filter by stock state Parameters: - `product_id` (query, integer) — Product ID to filter - `batch_id` (query, integer) — Batch ID to filter - `location_id` (query, integer) — Location ID to filter - `zone_id` (query, integer) — Zone ID to filter - `location_type_id` (query, integer) — Location Type ID to filter - `stock_state_id` (query, integer) — Stock State ID to filter - `limit` (query, integer) — Number of items to return (1-2000) - `offset` (query, integer) — Number of items to skip Responses: - 200: Expiring stock retrieved (sorted by expiration date ascending) - 401: Unauthorized - invalid or missing token #### GET /inventory/stocks/availability/products/{id}/batches — Get batch availability for a product operationId: `getBatchAvailability` Returns the available and reception quantities per batch for a given product. Useful for checking which batches have stock available for fulfillment. Parameters: - `id` (path, integer, required) — Product ID Responses: - 200: Batch availability retrieved - 401: Unauthorized - invalid or missing token #### POST /inventory/stocks/products/locations — Get stock by product and location operationId: `getStockByLocation` Returns detailed stock information per product and per physical location. **New Feature:** - `include_packed_goods_segmentation=true`: Shows if stock is packed or loose - `packed_or_loose` values: `packed`, `loose`, `both` **Use cases:** - Detailed location-level stock reports - Loading unit tracking - Warehouse layout optimization Parameters: - `include_packed_goods_segmentation` (query, boolean) — Include packed/loose stock breakdown - `warehouse_id` (query, integer) - `product_id` (query, integer) - `limit` (query, integer) — Number of items to return (1-2000) - `offset` (query, integer) — Number of items to skip Request body (object): - `warehouse_id` (integer) - `product_id` (integer) Responses: - 200: Stock locations retrieved #### POST /inventory/stocks/correct — Correct stock at a location operationId: `correctStock` Adds or removes stock for a product at a specific location. The path isn't under `/bulk/`, but the request still accepts multiple `items` in one call. **Direction:** `quantity` is signed — positive adds stock, negative removes it. Removing more than what's available at that location returns a 422 (`not_enough_stock_to_remove_for_given_location_product_batch`). **Batch-controlled products (`lot`/`serial`):** include `item_batches`, one entry per batch/lot/serial affected. For `serial`-managed products, each batch's `quantity` must be `1` — a serial is a single unique unit. For `lot` it can be any amount. The batch-level quantities are what actually get applied — keep the item's own `quantity` equal to their sum to avoid confusion, even though it isn't strictly validated against it. **Recommended batch size:** up to 50 corrections (`items` entries) per request. Request body (object): - `warehouse_id` (integer, required) — Warehouse the correction applies to. - `reason_codes` (array of object) — Optional reason code(s) for the correction, referenced by `id` — not by code string. - `id` (integer) - `items` (array of object, required) - `location_id` (integer, required) — Location where the correction is applied. - `product_id` (integer, required) - `quantity` (integer, required) — Signed amount to add (positive) or remove (negative). For batch-controlled products, keep this equal to the sum of `item_batches[].quantity` — the batch-level values are what actually get applied. - `item_batches` (array of object) — Required for lot/serial-managed products; omit for `none`-managed products. - `batch_id` (integer, required) — Existing lot/serial batch ID. For a `serial`-managed product, `quantity` must be `1` on every entry (a serial is a single unique unit); for `lot` it can be any amount. - `quantity` (integer, required) — Signed amount to add (positive) or remove (negative) from this batch. - `notes` (string) Responses: - 200: Stock corrected - 401: Unauthorized - invalid or missing token - 422: Validation error — a required field is missing, or (for negative quantities) there isn't enough stock to remove. ### Kitting Kit assembly and kitting tasks #### GET /warehouses/location_types — Get kitting location types operationId: `getKittingLocationType` Helper endpoint to find kitting location type IDs. Use the returned ID with `/warehouses/locations` to find actual kitting locations. Parameters: - `name` (query, string, required) Responses: - 200: Location types found #### POST /inventory/kits — Create kit template operationId: `createKit` Creates a kit template that defines how to assemble a new product from component products. **Workflow:** 1. Create kit product (the final assembled item) 2. Create kit template (this endpoint) defining components 3. Create kitting task to assemble kits 4. Webhook fires when kits are assembled **Example:** - Kit Product: "Coffee Gift Box" - Components: 2x Coffee Beans, 1x Coffee Mug, 1x Gift Box Request body (object): - `name` (string, required) — Unique kit name - `product_id` (integer, required) — Final product ID (the assembled kit) - `items` (array of object, required) — Component products - `product_id` (integer, required) — Component product ID - `quantity` (integer, required) — Quantity needed per kit - `warehouses` (array of integer, required) — Warehouse IDs where kit can be assembled Responses: - 200: Kit created successfully #### POST /kitting/tasks — Create kitting task operationId: `createKittingTask` Creates a task to assemble kits from component products. **Workflow:** 1. Webhook `replenishment_order_created` (type=kit_move): Components moved to kitting area, stock reduced 2. Warehouse assembles kits (Android app) 3. Webhook `replenishment_order_finished` (type=kitting): Kits moved to storage, kit product stock increased **Requirements:** - Kit template must exist - Sufficient component stock must be available - `destination_location_id` must be a kitting location Request body (object): - `warehouse_id` (integer, required) — Warehouse for kitting - `destination_location_id` (integer, required) — Kitting location ID - `items` (array of object, required) - `kit_id` (integer, required) — Kit template ID - `quantity` (integer, required) — Number of kits to assemble Responses: - 200: Kitting task created successfully ### Webhooks Event subscriptions and webhooks #### GET /webhook/ — List webhook subscriptions operationId: `listWebhooks` Returns your webhook subscriptions. Use it to check what is subscribed, or to find the `id` you need to [delete a subscription](#tag/Webhooks/operation/deleteWebhook). **Only enabled webhooks by default.** Without `enabled=false` in the query, disabled subscriptions are left out, even when you filter by their `id` or `url`. To see everything, call once with `enabled=true` and once with `enabled=false`. **Filters** (all optional, combine as needed): - `id`, `url`, `method`, `enabled`, `warehouse_id`, `merchant_id`, `merchant_channel_id` match exactly. - `url` also accepts a partial match with `like:`, e.g. `url=like:%25my-domain%25` (`%25` is the URL-encoded `%` wildcard). - Each filter takes one value. Lists such as `warehouse_id=1,2` or `warehouse_id=in:1,2` are not supported and return an error. - Unknown query parameters are ignored. **Paging:** `total_results` is only filled on the first page (`offset` 0 or not set). On later pages it is `null`, so read it from the first call. Parameters: - `id` (query, string) — Webhook ID - `url` (query, string) — Exact endpoint URL, or `like:%pattern%` for a partial match - `method` (query, string) Allowed: `POST`. - `enabled` (query, boolean) — `true` (the default) returns enabled webhooks, `false` returns disabled ones. Any other value returns an error. - `warehouse_id` (query, integer) - `merchant_id` (query, integer) - `merchant_channel_id` (query, integer) - `limit` (query, integer) — Number of items to return (1-2000) - `offset` (query, integer) — Number of items to skip - `sort_by` (query, string) — Sort field and direction (field:asc or field:desc) Responses: - 200: Matching webhook subscriptions. An empty `webhooks` list (and `total_results: 0`) when nothing matches. #### GET /webhook/{id} — Get a webhook subscription operationId: `getWebhook` Returns one webhook subscription by its `id`. Unlike the list, this also returns disabled webhooks. The webhook is returned directly, not inside a `webhooks` list. Parameters: - `id` (path, string, required) — Webhook ID (UUID) Responses: - 200: The webhook subscription - 422: No webhook with this id exists #### POST /webhook/ — Subscribe to webhook events operationId: `subscribeWebhook` Subscribes your endpoint to receive real-time notifications for warehouse events. **Available Events:** **Purchase Orders / Incoming:** - `purchase_order_updated` [📎](/guide/incoming#purchase_order_updated "Sample payload"): PO modified - `purchase_order_deleted`: PO deleted - `purchase_order_finished` [📎](/guide/incoming#purchase_order_finished "Sample payload"): Goods receipt completed (GR) - `purchase_order_finished_early` [📎](/guide/incoming#purchase_order_finished_early "Sample payload"): PO closed with partial receipt - `incoming_good_created` [📎](/guide/incoming#incoming_good_created "Sample payload"): Receiving task created - `replenishment_order_created` [📎](/guide/incoming#replenishment_order_created "Sample payload"): Stock movement to storage started - `replenishment_order_finished` [📎](/guide/incoming#replenishment_order_finished "Sample payload"): Stock available in warehouse **Sales Orders / Outgoing:** - `sales_order_created` [📎](/guide/outgoing#sales_order_created "Sample payload"): Order accepted - `sales_order_updated` [📎](/guide/outgoing#sales_order_updated "Sample payload"): Order modified - `sales_order_cancelled` [📎](/guide/outgoing#sales_order_cancelled "Sample payload"): Order cancelled - `sales_order_finished` [📎](/guide/outgoing#sales_order_finished "Sample payload"): Order fully shipped (PGI) - `fulfillment_order_finished` [📎](/guide/outgoing#fulfillment_order_finished "Sample payload"): Single fulfillment completed - `picking_order_created` [📎](/guide/outgoing#picking_order_created "Sample payload"): Picking task created - `picking_order_finished` [📎](/guide/outgoing#picking_order_finished "Sample payload"): Picking completed - `packing_order_created` [📎](/guide/outgoing#packing_order_created "Sample payload"): Packing task created - `packing_order_finished` [📎](/guide/outgoing#packing_order_finished "Sample payload"): Packing completed (PIC) - `packing_order_closed` [📎](/guide/outgoing#packing_order_closed "Sample payload"): Packing task closed and left the packing station - `packing_box_closed` [📎](/label-provider/webhooks#packing_box_closed "Sample payload"): Individual box sealed (for label generation) **Stock & Inventory:** - `stock_correction_finished` [📎](/guide/stock-changes#stock_correction_finished "Sample payload"): Manual stock adjustment - `counting_task_created`: Inventory count started - `counting_task_finished`: Inventory count completed - `counting_task_closed` [📎](/guide/stock-changes#counting_task_closed "Sample payload"): Count finalized **Shipping:** - `shipment_tracking_updated` [📎](/label-provider/shipment-tracking#shipment_tracking_updated "Sample payload"): Tracking info changed - `turbo_label_packing_created`: Quick label process **Filters:** - Filter by `warehouse_id`, `merchant_id`, `merchant_channel_id` - `allowed_types`: Array of event types to receive **Best Practices:** - Implement idempotency (webhook may retry) - Return 200 OK quickly (process async) - Verify webhook signature if available - Handle out-of-order delivery Request body (object): - `url` (string, required) — Your webhook endpoint URL (must be HTTPS) - `method` (string, required) — HTTP method. Required, there is no default. Allowed: `POST`. - `warehouse_id` (integer, required) — Warehouse whose events you receive. Required. - `merchant_id` (integer) — Filter by merchant - `merchant_channel_id` (integer) — Filter by channel - `allowed_types` (array of string, required) — Event types to receive Responses: - 201: Webhook subscription created. The new subscription is returned inside a `webhooks` list. Keep `webhooks[0].id`: you need it to delete the subscription later. - 400: Validation failed. `errors` names each invalid field, for example a missing `url`, `method` or `warehouse_id`, or an unknown event in `allowed_types`. #### DELETE /webhook/{id} — Delete a webhook subscription operationId: `deleteWebhook` Removes a webhook subscription, so PULPO no longer sends its events to that URL. The `id` is the UUID returned when you subscribed (`webhooks[].id` in the [Subscribe to webhook events](#tag/Webhooks/operation/subscribeWebhook) response). If you don't have it any more, look it up with [List webhook subscriptions](#tag/Webhooks/operation/listWebhooks). Disabled webhooks can be deleted too. **Responses:** - `204 No Content` with an empty body when the webhook was deleted. - `422` with `{"errors": {"id": "The given id is invalid"}}` when no webhook with this id exists, including one you already deleted. Treat this as "already gone" if you retry deletes. Parameters: - `id` (path, string, required) — Webhook ID (UUID) Responses: - 204: Webhook deleted. The response body is empty. - 422: No webhook with this id exists (never existed or already deleted)