# API Endpoints

### Authentication Endpoints

| Method | Endpoint | Auth | Description |
|--------|----------|------|-------------|
| POST | `/api/auth/signup` | None | Register new user |
| POST | `/api/auth/signin` | None | Login and get JWT token |
| GET | `/api/auth/profile` | JWT | Get user profile |
| GET | `/api/auth/agents` | JWT | List all agents |

### Waybill Endpoints

| Method | Endpoint | Auth | Description |
|--------|----------|------|-------------|
| POST | `/api/waybill/create` | JWT | Create new waybill |
| GET | `/api/waybill/:id` | JWT | Get waybill details |
| PUT | `/api/waybill/:id` | JWT | Update waybill |
| DELETE | `/api/waybill/:id` | JWT | Cancel waybill |
| GET | `/api/waybill/track/:awb` | JWT | Track waybill by AWB |
| POST | `/api/waybill/bulk` | JWT | Bulk waybill creation |
| GET | `/api/waybill/view-img/:id` | JWT | View waybill image |

### Check Fee Endpoints

| Method | Endpoint | Auth | Description |
|--------|----------|------|-------------|
| POST | `/api/check-fee` | JWT | Calculate shipping fee |
| POST | `/api/check-fee/bulk` | JWT | Bulk fee calculation |
| GET | `/api/check-fee/services` | JWT | Get available services |

### Scanning Endpoints

**Outgoing Scans:**

| Method | Endpoint | Auth | Description |
|--------|----------|------|-------------|
| POST | `/api/scan/packing` | JWT | Record packing scan |
| POST | `/api/scan/handover` | JWT | Record handover scan |
| GET | `/api/scan/handover/:id` | JWT | Get handover details |

**Incoming Scans:**

| Method | Endpoint | Auth | Description |
|--------|----------|------|-------------|
| POST | `/api/scan/receiving` | JWT | Record receiving scan |
| POST | `/api/scan/delivery` | JWT | Record delivery scan |
| POST | `/api/scan/problem` | JWT | Record problem scan |
| GET | `/api/scan/delivery/:id` | JWT | Get delivery details |

### Courier Partner Endpoints

| Method | Endpoint | Auth | Description |
|--------|----------|------|-------------|
| GET | `/api/partners` | JWT | List all partners |
| GET | `/api/partners/:id` | JWT | Get partner details |
| POST | `/api/partners` | JWT | Add new partner |
| PUT | `/api/partners/:id` | JWT | Update partner |
| DELETE | `/api/partners/:id` | JWT | Remove partner |

### 3rd-Party Integration Endpoints

| Method | Endpoint | Auth | Description |
|--------|----------|------|-------------|
| POST | `/api/3p/jne/webhook` | Basic | JNE status webhook |
| POST | `/api/3p/lionparcel/webhook` | Basic | Lion Parcel webhook |
| POST | `/api/3p/jtcargo/webhook` | Basic | JT Cargo webhook |
| POST | `/api/3p/anteraja/webhook` | Basic | AnteRaja webhook |
| POST | `/api/3p/sicepat/webhook` | Basic | Sicepat webhook |

### Reports Endpoints

| Method | Endpoint | Auth | Description |
|--------|----------|------|-------------|
| GET | `/api/reports/monitoring-pickup` | JWT | Pickup monitoring report |
| GET | `/api/reports/monitoring-delivery` | JWT | Delivery monitoring report |
| GET | `/api/reports/manifest` | JWT | Manifest report |
| GET | `/api/reports/sla` | JWT | SLA performance report |
| GET | `/api/reports/billing` | JWT | Billing report |
| GET | `/api/reports/billing-vip` | JWT | VIP billing report |
| GET | `/api/reports/commission` | JWT | Commission report |
| GET | `/api/reports/finance` | JWT | Finance report |
| GET | `/api/reports/courier-performance` | JWT | Courier performance |

### Quality Management Endpoints

| Method | Endpoint | Auth | Description |
|--------|----------|------|-------------|
| POST | `/api/qm/alter-weight` | JWT | Record weight alteration |
| POST | `/api/qm/pod` | JWT | Upload proof of delivery |
| POST | `/api/qm/pop` | JWT | Upload proof of pickup |
| GET | `/api/qm/pod/:awb` | JWT | Get POD for waybill |
| GET | `/api/qm/pop/:awb` | JWT | Get POP for waybill |

### Driver App Endpoints

| Method | Endpoint | Auth | Description |
|--------|----------|------|-------------|
| GET | `/api/driver/tasks` | JWT | Get assigned tasks |
| POST | `/api/driver/pickup` | JWT | Complete pickup |
| POST | `/api/driver/delivery` | JWT | Complete delivery |
| GET | `/api/driver/marketplace/orders` | JWT | Get marketplace orders |

### Marketplace Endpoints

| Method | Endpoint | Auth | Description |
|--------|----------|------|-------------|
| POST | `/api/marketplace/pickup` | JWT | Record marketplace pickup |
| POST | `/api/marketplace/receiving` | JWT | Record marketplace receiving |
| GET | `/api/marketplace/orders` | JWT | Get marketplace orders |

### Administration Endpoints

| Method | Endpoint | Auth | Description |
|--------|----------|------|-------------|
| GET | `/api/admin/users` | JWT | List users |
| POST | `/api/admin/users` | JWT | Create user |
| PUT | `/api/admin/users/:id` | JWT | Update user |
| DELETE | `/api/admin/users/:id` | JWT | Delete user |
| GET | `/api/admin/customers` | JWT | List customers |
| POST | `/api/admin/feed-info` | JWT | Post system notification |

### Finance Endpoints

| Method | Endpoint | Auth | Description |
|--------|----------|------|-------------|
| GET | `/api/finance/billing-vip` | JWT | Get VIP billing configs |
| POST | `/api/finance/billing-vip` | JWT | Create VIP billing config |
| PUT | `/api/finance/billing-vip/:id` | JWT | Update VIP billing config |

### File Download

| Method | Endpoint | Auth | Description |
|--------|----------|------|-------------|
| GET | `/api/file/download/:filename` | None | Download generated file |

**Note:** File is automatically deleted after download.