> For the complete documentation index, see [llms.txt](https://navixy.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://navixy.com/docs/navixy-api/user-api/guides/data-retrieval/obtain-reports.md).

# Obtaining report information

Reports offer essential insights to effectively manage your fleet or mobile workforce. At times, you may need to extract report data for use in external applications or to generate custom business reports, such as those detailing trip information alongside fuel consumption, drains, and refills. Follow these steps to obtain report information using the Navixy API.

### Generate report

To receive data for processing, you first need to generate the report. This can be done using the [`report/tracker/generate`](/docs/navixy-api/user-api/resources/commons/report/report_tracker.md#post-report-tracker-generate) call.

Necessary parameters for this call:

* `from` - A string containing [date/time](/docs/navixy-api/general/api-conventions.md#date-time-formats). Data in the report will be from this moment.
* `to` - A string containing [date/time](/docs/navixy-api/general/api-conventions.md#date-time-formats). The specified date must be after the `from` date. Data in the report will be up to this moment.
* `title` - Report title. If null, the default title will be used.
* `trackers` - List of [tracker IDs](/docs/navixy-api/user-api/resources/tracking/tracker.md#post-tracker-list) to be included in the report (if the report is by trackers).
* `employees` - List of [employee IDs](/docs/navixy-api/user-api/resources/field-service/employee.md#post-employee-list) to be included in the report (if the report is by employees).
* `time_filter` - An object containing daily time and weekday limits for processed data, e.g., `{"to":"18:00", "from":"12:00", "weekdays":[1,2,3,4,5]}`.
* `plugin` - A plugin object. See the list of all [report plugins](/docs/navixy-api/user-api/resources/commons/plugin/report_plugins.md).

API request:

{% code title="cURL" overflow="wrap" %}

```sh
curl --request POST \
  --url 'https://api.eu.navixy.com/v2/report/tracker/generate' \
  --header 'Content-Type: application/json' \
  --data '{"hash": "a6aa75587e5c59c32d347da438505fc3", "title": "Trip report", "trackers": [669673], "from": "2020-10-05 00:00:00", "to": "2020-10-06 23:59:59", "time_filter": {"from": "00:00:00", "to": "23:59:59", "weekdays": [1,2,3,4,5,6,7]}, "plugin": {"hide_empty_tabs": true, "plugin_id": 4, "show_seconds": false, "include_summary_sheet_only": false, "split": true, "show_idle_duration": false, "show_coordinates": false, "filter": true, "group_by_driver": false}}'
```

{% endcode %}

The response will include the generated report ID:

```json
{
  "success": true,
  "id": 222
}
```

### Retrieve report

To obtain the generated report data in JSON format, use the `report/tracker/retrieve` call.

Use the `report_id` from the previous call response.

API request:

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

```sh
curl --request POST \
  --url 'https://api.eu.navixy.com/v2/report/tracker/retrieve' \
  --header 'Content-Type: application/json' \
  --data '{"hash": "a6aa75587e5c59c32d347da438505fc3", "report_id": 1234567}'
```

{% endtab %}

{% tab title="HTTP GET" %}
{% code overflow="wrap" %}

```http
https://api.eu.navixy.com/v2/report/tracker/retrieve?hash=a6aa75587e5c59c32d347da438505fc3&report_id=1234567
```

{% endcode %}
{% endtab %}
{% endtabs %}

You will receive the report in JSON format:

<details>

<summary>Response</summary>

```json
{
"success": true,
"report": {
  "created": "2020-10-06 16:01:46",
  "time_filter": {
      "from": "00:00:00",
      "to": "23:59:59",
      "weekdays": [
          1,
          2,
          3,
          4,
          5,
          6,
          7
      ]
  },
  "title": "Trip report",
  "id": 5602232,
  "sheets": [
      {
          "header": "Samantha (Ford Focus)",
          "sections": [
              {
                  "data": [
                      {
                          "rows": [
                              {
                                  "to": {
                                      "v": "02:39 - Downtown Los Angeles, CA, USA",
                                      "raw": 1601941188000.0,
                                      "type": "value",
                                      "location": {
                                          "lat": 34.040713,
                                          "lng": -118.246769
                                      }
                                  },
                                  "from": {
                                      "v": "00:47 - Santa Monica, CA, USA",
                                      "raw": 1601934439000.0,
                                      "type": "value",
                                      "location": {
                                          "lat": 34.019454,
                                          "lng": -118.491191
                                      }
                                  },
                                  "time": {
                                      "v": "01:52",
                                      "raw": 6749.0,
                                      "type": "value"
                                  },
                                  "length": {
                                      "v": "24.30",
                                      "raw": 24.30,
                                      "type": "value"
                                  },
                                  "avg_speed": {
                                      "v": "13",
                                      "raw": 13.0,
                                      "type": "value"
                                  },
                                  "max_speed": {
                                      "v": "27",
                                      "raw": 27.0,
                                      "type": "value"
                                  }
                              },
                              {
                                  "to": {
                                      "v": "05:10 - Hollywood, Los Angeles, CA, USA",
                                      "raw": 1601950218000.0,
                                      "type": "value",
                                      "location": {
                                          "lat": 34.092809,
                                          "lng": -118.328661
                                      }
                                  },
                                  "from": {
                                      "v": "03:11 - Downtown Los Angeles, CA, USA",
                                      "raw": 1601943083000.0,
                                      "type": "value",
                                      "location": {
                                          "lat": 34.040713,
                                          "lng": -118.246769
                                      }
                                  },
                                  "time": {
                                      "v": "01:58",
                                      "raw": 7135.0,
                                      "type": "value"
                                  },
                                  "length": {
                                      "v": "8.5",
                                      "raw": 8.5,
                                      "type": "value"
                                  },
                                  "avg_speed": {
                                      "v": "4.3",
                                      "raw": 4.3,
                                      "type": "value"
                                  },
                                  "max_speed": {
                                      "v": "19",
                                      "raw": 19.0,
                                      "type": "value"
                                  }
                              }
                          ],
                          "total": {
                              "text": "In total:",
                              "time": {
                                  "v": "03:50",
                                  "raw": 13740.0,
                                  "type": "value"
                              },
                              "length": {
                                  "v": "32.8",
                                  "raw": 32.8,
                                  "type": "value"
                              },
                              "avg_speed": {
                                  "v": "8.5",
                                  "raw": 8.5,
                                  "type": "value"
                              },
                              "max_speed": {
                                  "v": "27",
                                  "raw": 27.0,
                                  "type": "value"
                              }
                          },
                          "header": "Oct 6, 2020 (Tue) : 2"
                      }
                  ],
                  "type": "table",
                  "header": "Trips",
                  "columns": [
                      {
                          "align": "left",
                          "field": "from",
                          "title": "Movement start",
                          "width": 4,
                          "weight": 3,
                          "highlight_min_max": false
                      },
                      {
                          "align": "left",
                          "field": "to",
                          "title": "Movement end",
                          "width": 4,
                          "weight": 3,
                          "highlight_min_max": false
                      },
                      {
                          "align": "right",
                          "field": "length",
                          "title": "Total trips length,\nkm",
                          "width": 1,
                          "weight": 0,
                          "highlight_min_max": false
                      },
                      {
                          "align": "right",
                          "field": "time",
                          "title": "Travel time",
                          "width": 1,
                          "weight": 0,
                          "highlight_min_max": false
                      },
                      {
                          "align": "right",
                          "field": "avg_speed",
                          "title": "Average speed,\nkm/h",
                          "width": 1,
                          "weight": 0,
                          "highlight_min_max": false
                      },
                      {
                          "align": "right",
                          "field": "max_speed",
                          "title": "Max. speed,\nkm/h",
                          "width": 1,
                          "weight": 0,
                          "highlight_min_max": false
                      }
                  ],
                  "column_groups": []
              },
              {
                  "rows": [
                      {
                          "v": "2",
                          "raw": 2.0,
                          "name": "Trips",
                          "highlight": false
                      },
                      {
                          "v": "32.8",
                          "raw": 32.8,
                          "name": "Total trips length, km",
                          "highlight": false
                      },
                      {
                          "v": "03:50",
                          "raw": 230.0,
                          "name": "Travel time",
                          "highlight": false
                      },
                      {
                          "v": "8.5",
                          "raw": 8.5,
                          "name": "Average speed, km/h",
                          "highlight": false
                      },
                      {
                          "v": "27",
                          "raw": 27.0,
                          "name": "Max. speed, km/h",
                          "highlight": false
                      },
                      {
                          "v": "515855",
                          "raw": 515855.0,
                          "name": "Odometer value *, km",
                          "highlight": false
                      }
                  ],
                  "type": "map_table",
                  "header": "Summary"
              },
              {
                  "text": "Odometer value at the end of the selected period.",
                  "type": "text",
                  "style": "small_print"
              }
          ],
          "entity_ids": [
              311852
          ],
          "additional_field": ""
      }
  ],
  "from": "2020-10-06 00:00:00",
  "to": "2020-10-06 23:59:59"
}
```

</details>

### Deleting reports

Once you have received and processed the report information, you can delete the generated report to clean up resources. Use the `report/tracker/delete` call.

Use the `report_id` from the `generate` call response.

API request:

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

```sh
curl --request POST \
  --url 'https://api.eu.navixy.com/v2/report/tracker/delete' \
  --header 'Content-Type: application/json' \
  --data '{"hash": "a6aa75587e5c59c32d347da438505fc3", "report_id": 1234567}'
```

{% endtab %}

{% tab title="HTTP GET" %}
{% code overflow="wrap" %}

```http
https://api.eu.navixy.com/v2/report/tracker/delete?hash=a6aa75587e5c59c32d347da438505fc3&report_id=1234567
```

{% endcode %}
{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://navixy.com/docs/navixy-api/user-api/guides/data-retrieval/obtain-reports.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
