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

---

Website version: https://connect.pulpo.co/label-provider/returns
Whole guide in one file: https://connect.pulpo.co/llms-full.txt
Index of all pages: https://connect.pulpo.co/llms.txt
