API Reference
AIlFleet REST API v1 — authentication, pagination and endpoints.
Authentication
Every request must include an API token created on the Settings page, passed in the Authorization header:
Authorization: Token aif_your_token_here
Tokens are shown once at creation and stored hashed. Requests with a missing, invalid or revoked token receive 401 with a JSON error body.
Pagination
List endpoints use cursor pagination. Pass ?per_page= (default 50, max 100) to control page size. Responses have the shape { "records": [...], "next_cursor": "..." }. When next_cursor is non-null, request the next page with ?start_cursor=<next_cursor>. A null cursor means you have reached the end. Records are ordered by id ascending.
Errors & validation
Create/update bodies are validated; invalid payloads return 422 with an issues array describing each problem. Unknown ids return 404.
Endpoints
| Endpoint | Methods | Description |
|---|---|---|
| /api/v1 | GET | API metadata & resource index |
| /api/v1/vehicles | GET, POST | List / create vehicles |
| /api/v1/vehicles/:id | GET, PATCH | Fetch / update a vehicle |
| /api/v1/issues | GET, POST | List / create issues (POST fires issue.created webhook) |
| /api/v1/issues/:id | GET, PATCH | Fetch / update an issue |
| /api/v1/work-orders | GET, POST | List / create work orders |
| /api/v1/work-orders/:id | GET | Fetch a work order with lines |
| /api/v1/fuel-entries | GET, POST | List / create fuel entries |
| /api/v1/fuel-entries/:id | GET | Fetch a fuel entry |
| /api/v1/parts | GET, POST | List / create parts |
| /api/v1/parts/:id | GET | Fetch a part with stock levels |
| /api/v1/service-entries | GET, POST | List / create service entries |
| /api/v1/service-entries/:id | GET | Fetch a service entry |
| /api/v1/contacts | GET, POST | List / create contacts |
| /api/v1/contacts/:id | GET | Fetch a contact |
| /api/v1/vendors | GET, POST | List / create vendors |
| /api/v1/vendors/:id | GET | Fetch a vendor |
| /api/v1/meter-entries | GET, POST | List / create meter entries |
| /api/v1/meter-entries/:id | GET | Fetch a meter entry |
Example
curl -s "https://your-host/api/v1/vehicles?per_page=25" \
-H "Authorization: Token aif_your_token_here"
# create an issue
curl -s -X POST "https://your-host/api/v1/issues" \
-H "Authorization: Token aif_your_token_here" \
-H "Content-Type: application/json" \
-d '{"vehicleId": "<vehicle_id>", "summary": "Brake pads worn", "priority": "high"}'