API Reference v1

REST API Documentation

All endpoints return JSON. Authenticated requests require a Bearer token in the Authorization header.

v1.0.0
All systems operational

Authentication

POST/v1/auth/session
Create a session for a role.
{ "role": "operator" }
DELETE/v1/auth/sessionAuth required
Sign out the current session.

Customers

GET/v1/customersAuth required
List customers with filters & pagination.
POST/v1/customersAuth required
Create a new customer with custom fields.
{ "name": "Studio Ferrari", "address": "Via Roma 12", "city": "Milano",
  "wasteType": "toner", "cerCode": "080318",
  "pickupFrequencyDays": 30 }
GET/v1/customers/{id}Auth required
Fetch a single customer with status.
PATCH/v1/customers/{id}Auth required
Update customer fields.
DELETE/v1/customers/{id}Auth required
Permanently delete a customer.
GET/v1/customers/{id}/statusAuth required
Get traffic-light status & overdue days.
{ "status": "red", "daysSinceLast": 75, "overdueDays": 45 }

Pickups

GET/v1/pickupsAuth required
List pickups (filter by date, driver, status).
POST/v1/pickupsAuth required
Schedule a new pickup.
PATCH/v1/pickups/{id}Auth required
Update status (start, complete, cancel).
{ "status": "completed", "weightKg": 12 }
DELETE/v1/pickups/{id}Auth required
Delete a pickup record.

Routes

GET/v1/routesAuth required
List planned and completed routes.
POST/v1/routesAuth required
Create a route from selected customers.
POST/v1/routes/{id}/suggestAuth required
Get on-the-way overdue suggestions.
{ "suggestions": [{ "customerId": "c-003", "overdueDays": 50 }] }
GET/v1/routes/{id}/pdfAuth required
Generate one-page driver PDF sheet.

Imports

POST/v1/imports/excelAuth required
Upload Excel dataset and recompute history.

Analytics

GET/v1/analytics/backlogAuth required
Counts by status across all customers.
{ "green": 4, "yellow": 1, "red": 3 }
GET/v1/analytics/throughputAuth required
Pickups completed per week.