# COLORJET API Endpoints

Base URL:

```text
https://api.colorjetbd.com/api/v1
```

## Public

| Method | Endpoint | Purpose |
|---|---|---|
| GET | `/health` | API + DB health check |
| POST | `/auth/setup-owner` | Create first Owner account; one-time only |
| POST | `/auth/login` | Login and get JWT token |

## Protected

All protected endpoints require:

```http
Authorization: Bearer JWT_TOKEN_HERE
```

| Method | Endpoint | Purpose |
|---|---|---|
| GET | `/auth/me` | Current user |
| POST | `/auth/change-password` | Change own password |
| GET | `/dashboard` | Owner dashboard KPI |
| GET | `/users` | User list |
| POST | `/users` | Create staff/user |
| PUT | `/users/:id` | Update user |
| POST | `/users/:id/reset-password` | Reset user password |
| GET | `/customers` | Customer list |
| GET | `/customers/:id` | Customer details + ledger |
| POST | `/customers` | Create customer |
| PUT | `/customers/:id` | Update customer |
| GET | `/products` | Product list |
| GET | `/products/:id` | Product details + stock movement |
| POST | `/products` | Create product |
| PUT | `/products/:id` | Update product |
| POST | `/products/stock-movement` | Stock in/out |
| GET | `/tasks` | Office task list |
| POST | `/tasks` | Create task |
| PUT | `/tasks/:id` | Update task |
| POST | `/tasks/:id/comments` | Add task comment |
| GET | `/service-tickets` | Service ticket list |
| GET | `/service-tickets/:id` | Service ticket details |
| POST | `/service-tickets` | Create service ticket |
| PUT | `/service-tickets/:id` | Update service ticket |
| POST | `/service-tickets/:id/parts` | Add parts used and reduce stock |
| GET | `/suppliers` | Supplier list |
| GET | `/suppliers/:id` | Supplier details + ledger |
| POST | `/suppliers` | Create supplier |
| PUT | `/suppliers/:id` | Update supplier |
| GET | `/lc-tt` | LC/TT list |
| POST | `/lc-tt` | Create LC/TT record |
| PATCH | `/lc-tt/:id/status` | Update LC/TT status |
| GET | `/invoices` | Invoice list |
| GET | `/invoices/:id` | Invoice details |
| POST | `/invoices` | Create invoice and stock/customer ledger posting |
| POST | `/invoices/receive-payment` | Receive customer payment |
| POST | `/uploads` | Upload JPG/PNG/WEBP/PDF file |


# V2 Mobile + Import/Warranty/Logistics Endpoints

## Mobile UI

```text
GET /mobile
GET /admin-mobile
```

## Import/Warranty/Logistics

```text
GET    /api/v1/import-logistics/summary
GET    /api/v1/import-logistics/rmas
POST   /api/v1/import-logistics/rmas
GET    /api/v1/import-logistics/rmas/:id
PATCH  /api/v1/import-logistics/rmas/:id/status
GET    /api/v1/import-logistics/shipments
POST   /api/v1/import-logistics/shipments
GET    /api/v1/import-logistics/shipments/:id
PATCH  /api/v1/import-logistics/shipments/:id/status
POST   /api/v1/import-logistics/shipments/:id/items
POST   /api/v1/import-logistics/shipments/:id/costs
GET    /api/v1/import-logistics/receipts
POST   /api/v1/import-logistics/receipts
PATCH  /api/v1/import-logistics/receipts/:id/approve
POST   /api/v1/import-logistics/receipts/:id/post-stock
GET    /api/v1/import-logistics/supplier-ledger
POST   /api/v1/import-logistics/supplier-ledger
GET    /api/v1/import-logistics/discrepancies
POST   /api/v1/import-logistics/discrepancies
PATCH  /api/v1/import-logistics/discrepancies/:id/resolve
```
