# Mileage

## API actions

API base path: `/tracker/stats/mileage`.

### read

Returns mileage in kilometers in specified period grouped by trackers and day.

#### Parameters

| name     | description                                                                                                                            | type                                                                   |
| -------- | -------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------- |
| trackers | Array of tracker IDs (aka "object\_id"). Trackers must belong to authorized user and not be blocked. Maximum 128 trackers per request. | int array                                                              |
| from     | From date/time.                                                                                                                        | [date/time](/docs/navixy-api/user-api/backend-api.md#datetime-formats) |
| to       | To date/time. Specified date must be after "from" date.                                                                                | [date/time](/docs/navixy-api/user-api/backend-api.md#datetime-formats) |

#### Examples

cURL

{% code overflow="wrap" %}

```sh
curl -X POST 'https://api.eu.navixy.com/v2/tracker/stats/mileage/read' \
    -H 'Content-Type: application/json' \
    -d '{"hash": "22eac1c27af4be7b9d04da2ce1af111b", "trackers": [123456], "from": "2020-09-24 03:24:00", "to": "2020-09-24 06:24:00"}'
```

{% endcode %}

#### Response

```json
{
  "success": true,
  "result": {
    "123456": {
      "2000-01-01": {
        "mileage": 0.0
      },
      "2000-01-02": {
        "mileage": 0.0
      },
      "2000-01-03": {
        "mileage": 199.09
      }
    }
  },
  "limit_exceeded": false
}
```

#### Errors

* 211 – Requested time span is too big - if interval between "from" and "to" is too big (maximum value specified in API config).
* 217 – List contains nonexistent entities.
* 221 – Device limit exceeded.


---

# 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://navixy.com/docs/navixy-api/user-api/backend-api/resources/tracking/tracker/stats/stats_mileage.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.
