# Update mileage

Once a vehicle is declared, the distances of all trips are aggregated to calculate the total analyzed distance.

If the vehicle has already been driven before it has been registered on the platform, there will be an offset between the vehicle odometer and the total analyzed distance (computed by DriveQuant services).

If you find an offset between the vehicle's odometer and the total analyzed distance, you can set vehicle mileage.

The vehicle mileage value is updated :

1. Every time a trip is analyzed.
2. Each time the odometer update API is used.

{% hint style="info" %}
If you have your **admin API key**, you can try the API via this [**link**](https://drivequant.stoplight.io/docs/drivequant-public/reference/Vehicles.yaml/paths/~1drivekit~1admin~1vehicles~1%7BvehicleId%7D~1distance/put).
{% endhint %}

## PUT /drivekit/admin/vehicles/{vehicleId}/distance

> Update vehicle mileage

```json
{"openapi":"3.0.3","info":{"title":"DKAdminVehiclesV3","version":"1.0"},"servers":[{"url":"https://service.drivequant.com/v3","description":"Prod"}],"security":[{"api-key":[]}],"components":{"securitySchemes":{"api-key":{"name":"DriveKit-Admin-API-Key","type":"apiKey","in":"header"}},"schemas":{"ErrorResponse":{"title":"ErrorResponse","type":"object","properties":{"message":{"type":"string"},"code":{"type":"integer"},"messageKey":{"type":"string"}}}}},"paths":{"/drivekit/admin/vehicles/{vehicleId}/distance":{"put":{"summary":"Update vehicle mileage","operationId":"put-drivekit-admin-vehicles-vehicleId-distance","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"analyzedDistance":{"type":"number","description":"Distance analysed by the app"},"creationDate":{"type":"string","format":"date-time","description":"Creation date of the vehicle"},"distance":{"type":"number","description":"Total distance travelled by the vehicle"},"offsetDistance":{"type":"number","description":"offset between analysed and total distance"}}}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"parameters":[{"schema":{"type":"string"},"in":"header","name":"DriveKit-Admin-API-Key","description":"Admin API Key","required":true}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"distance":{"type":"number","description":"Vehicle odometer reading in kilometer","minimum":0,"maximum":500000}},"required":["distance"]}}}},"description":""}}}}
```
