# 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 %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://sdk.ims.tech/drivesync-portal/odometer.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
