Overview
Mileage expenses use theCarSpecification expense type. They allow users to claim reimbursement for business travel based on distance driven, vehicle type, and optional extras like passengers, road tolls, and trailer usage.
The Fields system handles the complexity of mileage calculations — including country-specific reimbursement rates, vehicle type multipliers, and distance computation from routes. Your client renders the fields and lets the server do the math.
Key concepts
API endpoints
All mileage field operations use the standard Fields endpoints withexpenseType=CarSpecification:
Step 1: Initialize fields
Fetch the field structure for a new mileage expense:bash
bash
Field structure overview
The response contains these key fields:Step 2: Handle the route
The travel route is aFIELD_GROUP containing several nested fields:
Not all trip detail fields are visible by default. Their visibility depends on the organization’s configuration and country-specific rules. Only render fields where
visible: true.Route data format
TheMILEAGE_ROUTE field holds an array of waypoints:
requiresUpdate is true, the server recalculates the distance and generates a map image.
Adding via points
Routes can include intermediate stops. A route with two via points:Route commands
The travel route field group includes acommands array for clearing the route:
Map image
After a route update, the server generates a map image. The URL is stored in the hidden fieldvirtual.mileageMap:
virtual.mileageMapChecksum field for cache validation. Both fields are hidden and read-only.
Step 3: Vehicle type and category
Both the category (categoryId) and vehicle type (verification.carType) have requiresUpdate: true. Changing either triggers a server round-trip that may update reimbursement calculations and visible fields.
Fetching vehicle types
Vehicle types are scoped to the selected category:The full list of vehicle types depends on the organization’s country and configuration. Always fetch from the API rather than hardcoding values.
Step 4: The update cycle
Mileage expenses have several fields withrequiresUpdate: true. When the user changes any of these, send the full fields array back to the server:
Example update request
bash
Step 5: Save the expense
Once the user is finished, save the mileage expense:Using fields format
Using standard JSON format
Alternatively, extract values from the fields and use the standard expense format:bash
Example response
Commuting variant
Some organizations configure mileage categories for commuting. Commuting expenses replace the route-based travel with a year/month/day selection:
Fetch the available values from these endpoints:
PRIVATE_CAR with disabled: true).
Named passengers
Some organizations require named passengers instead of just a count. When enabled, thepassengers array contains individual entries:
name and the distance they traveled. This is used for per-passenger reimbursement calculations in some countries.
Fleet management integration
Organizations with fleet management integrations can link mileage expenses to tracked vehicle trips:LIST field with multiSelect: true at verification.fleetManagementTripIds.
Toll cost data
For Norwegian organizations using AutoPASS or similar toll systems, toll cost data can be included:tollCostFuelType affects the toll rate calculation and supports: PETROL, DIESEL, ELECTRIC, HYBRID, and HYDROGEN.
Common integration patterns
Route suggestions with place search
Route suggestions with place search
Use the route suggestions endpoint to provide autocomplete when users type a place name:Returns a list of matching places. After the user selects origin and destination, call the directions endpoint to get coordinates and calculated distance:With a body of
[{ "place": "Stockholm" }, { "place": "Gothenburg" }].Handling manual distance override
Handling manual distance override
When the user toggles
verification.manualDistance to true, the verification.distance field becomes editable and the verification.route field is no longer required. Send a PUT to update the fields — the server will adjust field visibility accordingly. When toggled back to false, the distance is recalculated from the route.Round trip handling
Round trip handling
When
verification.roundTrip is toggled to true, the server doubles the calculated distance. This is a requiresUpdate field — send a PUT to get the updated distance value. The route itself stays the same; only the distance is doubled.Rendering the route summary
Rendering the route summary
The travel route Use the
FIELD_GROUP includes a summary array for displaying a compact preview:image type to display the map from virtual.mileageMap, and property_value entries to show key metrics like distance.
