Ctrl K

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

EndpointMethodsDescription
/api/v1GETAPI metadata & resource index
/api/v1/vehiclesGET, POSTList / create vehicles
/api/v1/vehicles/:idGET, PATCHFetch / update a vehicle
/api/v1/issuesGET, POSTList / create issues (POST fires issue.created webhook)
/api/v1/issues/:idGET, PATCHFetch / update an issue
/api/v1/work-ordersGET, POSTList / create work orders
/api/v1/work-orders/:idGETFetch a work order with lines
/api/v1/fuel-entriesGET, POSTList / create fuel entries
/api/v1/fuel-entries/:idGETFetch a fuel entry
/api/v1/partsGET, POSTList / create parts
/api/v1/parts/:idGETFetch a part with stock levels
/api/v1/service-entriesGET, POSTList / create service entries
/api/v1/service-entries/:idGETFetch a service entry
/api/v1/contactsGET, POSTList / create contacts
/api/v1/contacts/:idGETFetch a contact
/api/v1/vendorsGET, POSTList / create vendors
/api/v1/vendors/:idGETFetch a vendor
/api/v1/meter-entriesGET, POSTList / create meter entries
/api/v1/meter-entries/:idGETFetch 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"}'