---
tags: [purchases, controller]
module: Purchases
---

# [Controller]ApiControllers

## Connections
[[_Purchases]] · [[[Model]PurchaseBill]] · [[[Model]BillReturn]] · [[[Model]PurchaseOrder]] · [[[Model]Expense]] · [[[Model]Supplier]] · [[[Service]PurchaseBillServices]] · [[[Service]BillReturnServices]] · [[[Service]ExpenseServices]] · [[[Routes]Routes]]

## Source
`Modules/Purchases/Http/Controllers/Api/`

All API controllers extend `BaseApiController`.

---

## v2 Endpoints

### Api/PurchaseBillController
Base: `/api/v2/purchases/purchase-bills` — middleware: `api.v2.auth`

| Method | Endpoint | Purpose |
|---|---|---|
| GET | / | List with search, sort, pagination |
| GET | /{id} | Single bill with all relations |
| POST | / | Create bill (StoringPurchaseBillService) |
| PUT/PATCH | /{id} | Update bill (UpdatingPurchaseBillService) |
| DELETE | /{id} | Delete bill (DeletingPurchaseBillService) |

Relations eager-loaded: `fiscalYear` · `addedBy` · `updatedBy` · `deletedBy` · `supplier` · `paymentTerm` · `paymentAccount` · `journalEntry` · `formDesign` · `costCenter` · `purchaseOrder` · `purchaseBillDetails`

### Api/BillReturnController
Base: `/api/v2/purchases/bill-returns`

| Method | Endpoint | Purpose |
|---|---|---|
| GET | / | List returns |
| GET | /{id} | Single return |
| POST | / | Create (StoringBillReturnService) |
| PUT/PATCH | /{id} | Update (UpdatingBillReturnService) |
| DELETE | /{id} | Delete (DeletingBillReturnService) |

Relations: `fiscalYear` · `addedBy` · `supplier` · `paymentTerm` · `paymentAccount` · `journalEntry` · `formDesign` · `costCenter` · `purchaseBill` · `billReturnDetails`

### Api/PurchaseOrderController
Base: `/api/v2/purchases/purchase-orders`

| Method | Endpoint | Purpose |
|---|---|---|
| GET | / | List POs |
| GET | /{id} | Single PO |
| POST | / | Create PO |
| PUT/PATCH | /{id} | Update PO |
| DELETE | /{id} | Delete PO |

Relations: `addedBy` · `updatedBy` · `supplier` · `formDesign` · `products`

### Api/ExpenseController
Base: `/api/v2/purchases/expenses`

| Method | Endpoint | Purpose |
|---|---|---|
| GET | / | List expenses |
| GET | /{id} | Single expense |
| POST | / | Create (CreatingExpenseService) |
| DELETE | /{id} | Delete with optional `deleted_at` query param |

Relations: `fiscalYear` · `addedBy` · `updatedBy` · `supplier` · `customer` · `account` · `formDesign` · `costCenter` · `journalEntry` · `details`

### Api/SupplierController
Base: `/api/v2/purchases/suppliers`

| Method | Endpoint | Purpose |
|---|---|---|
| GET | / | List suppliers (read-only) |
| GET | /{id} | Single supplier |

Relations: `addedBy` · `updatedBy`

---

## v1 Legacy API
Same resources but under `auth:sanctum` middleware — purchase bills, bill returns, expenses, supplier receipts, suppliers. Receipt-bill assignment endpoints also present.
