# Warehouse processes

> Import, purchase order, transfer, write-off, stocktaking — the common mechanics.

All warehouse operations in BILLZ work the same way: a **document that is filled with items and then finished**.

```plaintext
create a document ──> add items ──> send / finish ──> accept / cancel
```

## Transfer (between shops)

| Step            | Method                        |
| --------------- | ----------------------------- |
| List            | `GET /v2/transfer`            |
| Create          | `POST /v2/transfer`           |
| Add a product   | `POST /v2/transfer/:id/add`   |
| Send            | `POST /v2/transfer/:id/send`  |
| Accept (finish) | `PUT /v2/transfer/finish/:id` |
| Update          | `PUT /v2/transfer/update/:id` |
| Delete a draft  | `DELETE /v2/transfer/:id`     |
| List items      | `GET /v2/transfer-items/:id`  |

A document in the “sent”, “under review” or “finished” status cannot be deleted. Finishing requires access to the **destination** shop: without it the response is `400` with a message about an unavailable shop.

## Write-off

| Step          | Method                         |
| ------------- | ------------------------------ |
| Create        | `POST /v2/write-off`           |
| Add a product | `POST /v2/write-off/:id/add`   |
| Finish        | `PUT /v2/write-off/finish/:id` |
| Reject        | `PUT /v2/write-off/cancel/:id` |
| Reasons list  | `GET /v2/write-off-reason`     |

The write-off reason is required and is taken from the company’s reference list by `id`. New reasons are created in the BILLZ interface. Some reasons are reserved for system use — write-off based on stocktaking results and write-off from the catalog.

## Purchase order

| Step                          | Method                                   |
| ----------------------------- | ---------------------------------------- |
| Create                        | `POST /v2/supplier-order`                |
| Add a product (one at a time) | `PUT /v2/supplier-order/add-item`        |
| Update an unsent order        | `PUT /v2/supplier-order/update/:id`      |
| Send (change status)          | `PATCH /v2/supplier-order/change-status` |
| List                          | `GET /v2/supplier-order`                 |
| Order items                   | `GET /v2/supplier-order-products/:id`    |

## Import (incoming stock)

Creating an import together with its items — `POST /v2/product-import/create-with-products`, listing — `GET /v2/import`, creating a single product — `POST /v2/product`.

## Common rule

Warehouse methods are asynchronous: to receive the result, pass `Billz-Response-Channel: HTTP`