# Odometer

### Record Odometer Reading

This feature allows applications to upload odometer readings with photographic evidence. Use the following API to upload the odometer image.

**UploadOdometerImage**

* Uploads an odometer snapshot for a vehicle.

**Parameters**:

* `vehicleId`:  The ID of the vehicle that the odometer snapshot is for
* `imageData`: Image data in **JPEG** format
* `distance`: The number shown on the odometer when the photo is taken
* `utcTimestampMillis`: The Unix epoch UTC timestamp in milliseconds for when the odometer snapshot was taken
* `latitude`:  **Optional** latitude of the odometer snapshot location
* `longitude`: **Optional** longitude of the odometer snapshot location
* `completionHandler`: Called when the request has completed (iOS only)

**Concrete example**

{% tabs %}
{% tab title="Swift" %}

```swift
let odometerService = OdometerService()
odometerService.uploadOdometerImage(
        vehicleId: vehicleId,
        imageData: imageData,
        distance: distance,
        utcTimestampMillis: utcTimestampMillis,
        latitude: latitude,
        longitude: longitude
        ) { result in
    switch result {
    case .success(_):
        // upload successful
    case .failure(let error):
        // error
    }
}
```

{% endtab %}

{% tab title="Kotlin" %}

```kotlin
val service = OdometerService()
service.uploadOdometerImage(
    vehicleId,
    imageData, 
    distance, 
    utcTimestampMillis, 
    latitude, 
    longitude, 
) { result: Result<Unit> ->
    if (result?.value == null || result.throwable != null) {
        // failure
    } else {
        // Success
        val content = result.value
    }
})
```

{% endtab %}
{% endtabs %}
