# \*Streaks

## Streaks | Overview <a href="#streaks-overview" id="streaks-overview"></a>

{% hint style="success" %}
Streaks feature allows you to get best & current series of Trips with statistics, based and calculated on user's accumulated statistics:

* Trips without Acceleration
* Trips without Braking
* Trips without Speeding
* Trips without Phone Usage
* Trips without Cornering
  {% endhint %}

![Streaks | Example of Interface \[ZenRoad\]](/files/-MTovzOx_z74sA49-IeT)

## Streaks | Steps to integrate: <a href="#streaks-steps-to-integrate" id="streaks-steps-to-integrate"></a>

1. Check [**this guide**](https://docs.telematicssdk.com/back-end-to-back-end-integration/authentication#authorization-types) to select **authorization type** according to your goals:
2. Use the [**Individual Streaks**](https://docs.telematicssdk.com/platform-features/streaks#individual-streaks) API if you'd like to get user's streaks **to moblie app for a single user.**
3. Use the [**Accumulated Streaks**](https://docs.telematicssdk.com/platform-features/streaks#accumulated-streaks) API if you'd like to get streaks to your **back-end** services for a **single user or for all users** within **single** **user group.**

## Streaks | Dictionary

| Field                                | Meaning                                                                                                          |
| ------------------------------------ | ---------------------------------------------------------------------------------------------------------------- |
| StreakAccelerationBest               | Total trips in Best series;                                                                                      |
| StreakAccelerationBestDurationSec    | Driving time in Best series;                                                                                     |
| StreakAccelerationBestDistanceKm     | Mileage in Best series;                                                                                          |
| StreakAccelerationBestFromDate       | Best series start date;                                                                                          |
| StreakAccelerationBestToDate         | Best series end date;                                                                                            |
| StreakAccelerationCurrentStreak      | Total trips in Current series;                                                                                   |
| StreakAccelerationCurrentDurationSec | Driving time in Current series;                                                                                  |
| StreakAccelerationCurrentDistanceKm  | Mileage in Current series;                                                                                       |
| StreakAccelerationCurrentFromDate    | Current series start date;                                                                                       |
| StreakAccelerationCurrentToDate      | Current series end date;                                                                                         |
| StreakAccelerationIsActive           | <p>True - Calculate Series of >=3 days duration only;</p><p>False - Series with any duration are calculated.</p> |

## Individual Streaks

<mark style="color:blue;">`GET`</mark> `https://api.telematicssdk.com/Statistics/v1/Streaks/individual/`

User: Get Personal Streaks \
\
**Authorization:** Required as User

#### Headers

| Name          | Type   | Description                                                                  |
| ------------- | ------ | ---------------------------------------------------------------------------- |
| Authorization | string | "Bearer {Token}" - get it via <https://user.telematicssdk.com/v1/auth/login> |

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

```
{
  "Result": 
    {
      "DeviceToken": "42b8b70d-54ug-49e6-8381-0120fb4be8ae",
      "InstanceId": "1e1c3e55-8fji-461d-bbbf-18a08913ec20",
      "AppId": "d9a26f4a-sr7h-476a-a54a-f5fd6fdb6395",
      "CompanyId": "ee654467-08hj-40ef-b9e9-665ab63aa2a5",
      "StreakCorneringBest": 47,
      "StreakCorneringBestDurationSec": 43750,
      "StreakCorneringBestDistanceKm": 573.5549999999998,
      "StreakCorneringBestFromDate": "2020-08-02T00:00:00",
      "StreakCorneringBestToDate": "2020-08-26T00:00:00",
      "StreakCorneringCurrentStreak": 5,
      "StreakCorneringCurrentDurationSec": 1922,
      "StreakCorneringCurrentDistanceKm": 16.749,
      "StreakCorneringCurrentFromDate": "2020-12-28T00:00:00",
      "StreakCorneringCurrentToDate": "2020-12-28T00:00:00",
      "StreakCorneringIsActive": true,
      "StreakDecelerationBest": 38,
      "StreakBreakingBestDurationSec": 31001,
      "StreakBreakingBestDistanceKm": 437.4810000000001,
      "StreakBreakingBestFromDate": "2020-12-17T00:00:00",
      "StreakBreakingBestToDate": "2020-12-28T00:00:00",
      "StreakBreakingCurrentStreak": 38,
      "StreakBreakingCurrentDurationSec": 31001,
      "StreakBreakingCurrentDistanceKm": 437.4810000000001,
      "StreakBreakingCurrentFromDate": "2020-12-17T00:00:00",
      "StreakBreakingCurrentToDate": "2020-12-28T00:00:00",
      "StreakBreakingIsActive": true,
      "StreakAccelerationBest": 38,
      "StreakAccelerationBestDurationSec": 29169,
      "StreakAccelerationBestDistanceKm": 298.137,
      "StreakAccelerationBestFromDate": "2020-08-30T00:00:00",
      "StreakAccelerationBestToDate": "2020-09-27T00:00:00",
      "StreakAccelerationCurrentStreak": 2,
      "StreakAccelerationCurrentDurationSec": 919,
      "StreakAccelerationCurrentDistanceKm": 10.845,
      "StreakAccelerationCurrentFromDate": "2020-12-28T00:00:00",
      "StreakAccelerationCurrentToDate": "2020-12-28T00:00:00",
      "StreakAccelerationIsActive": false,
      "StreakOverSpeedBest": 28,
      "StreakOverSpeedBestDurationSec": 20553,
      "StreakOverSpeedBestDistanceKm": 182.11299999999997,
      "StreakOverSpeedBestFromDate": "2020-08-31T00:00:00",
      "StreakOverSpeedBestToDate": "2020-09-23T00:00:00",
      "StreakOverSpeedCurrentStreak": 5,
      "StreakOverSpeedCurrentDurationSec": 1922,
      "StreakOverSpeedCurrentDistanceKm": 16.749,
      "StreakOverSpeedCurrentFromDate": "2020-12-28T00:00:00",
      "StreakOverSpeedCurrentToDate": "2020-12-28T00:00:00",
      "StreakOverSpeedIsActive": true,
      "StreakPhoneUsageBest": 31,
      "StreakPhoneUsageBestDurationSec": 28797,
      "StreakPhoneUsageBestDistanceKm": 364.79999999999984,
      "StreakPhoneUsageBestFromDate": "2020-08-06T00:00:00",
      "StreakPhoneUsageBestToDate": "2020-08-25T00:00:00",
      "StreakPhoneUsageCurrentStreak": 17,
      "StreakPhoneUsageCurrentDurationSec": 16674,
      "StreakPhoneUsageCurrentDistanceKm": 302.076,
      "StreakPhoneUsageCurrentFromDate": "2020-12-23T00:00:00",
      "StreakPhoneUsageCurrentToDate": "2020-12-28T00:00:00",
      "StreakPhoneUsageIsActive": true,
      "UpdatedAt": "2020-12-28T03:15:25.933"
    },
  "Status": 200,
  "Title": "",
  "Errors": []
}
```

{% endtab %}
{% endtabs %}

## User(s) Streaks

<mark style="color:blue;">`GET`</mark> `https://api.telematicssdk.com/Statistics/v1/Streaks/accumulated/`

Admin: Get user(s) Streaks\
\
**Authorization:** Required as admin with **API Authorization Credentials**

#### Query Parameters

| Name        | Type   | Description             |
| ----------- | ------ | ----------------------- |
| DeviceToken | string | One of this is required |
| InstanceID  | string | One of this is required |

#### Headers

| Name          | Type   | Description                                                                  |
| ------------- | ------ | ---------------------------------------------------------------------------- |
| Authorization | string | "Bearer {Token}" - get it via <https://user.telematicssdk.com/v1/auth/login> |

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

```
{
  "Result": [
    {
      "DeviceToken": "e8622a79-04c4-67ui-b13f-00284b820807",
      "InstanceId": "1e1c3e55-3fbd-34ft-bbbf-18a08913ec20",
      "AppId": "d9a26f4a-b9a5-34rf-a54a-f5fd6fdb6395",
      "CompanyId": "ee654467-hyz8-40ef-b9e9-665ab63aa2a5",
      "StreakCorneringBest": 21,
      "StreakCorneringBestDurationSec": 20516,
      "StreakCorneringBestDistanceKm": 266.596,
      "StreakCorneringBestFromDate": "2020-09-11T00:00:00",
      "StreakCorneringBestToDate": "2020-09-21T00:00:00",
      "StreakCorneringCurrentStreak": 4,
      "StreakCorneringCurrentDurationSec": 16902,
      "StreakCorneringCurrentDistanceKm": 316.374,
      "StreakCorneringCurrentFromDate": "2021-01-15T00:00:00",
      "StreakCorneringCurrentToDate": "2021-01-21T00:00:00",
      "StreakCorneringIsActive": true,
      "StreakBreakingBest": 8,
      "StreakBreakingBestDurationSec": 8743,
      "StreakBreakingBestDistanceKm": 123.202,
      "StreakBreakingBestFromDate": "2020-09-25T00:00:00",
      "StreakBreakingBestToDate": "2020-09-28T00:00:00",
      "StreakBreakingCurrentStreak": 1,
      "StreakBreakingCurrentDurationSec": 1375,
      "StreakBreakingCurrentDistanceKm": 17.951,
      "StreakBreakingCurrentFromDate": "2020-11-27T00:00:00",
      "StreakBreakingCurrentToDate": "2020-11-27T00:00:00",
      "StreakBreakingIsActive": false,
      "StreakAccelerationBest": 17,
      "StreakAccelerationBestDurationSec": 16517,
      "StreakAccelerationBestDistanceKm": 209.78,
      "StreakAccelerationBestFromDate": "2020-09-11T00:00:00",
      "StreakAccelerationBestToDate": "2020-09-19T00:00:00",
      "StreakAccelerationCurrentStreak": 1,
      "StreakAccelerationCurrentDurationSec": 3446,
      "StreakAccelerationCurrentDistanceKm": 35.31,
      "StreakAccelerationCurrentFromDate": "2021-01-21T00:00:00",
      "StreakAccelerationCurrentToDate": "2021-01-21T00:00:00",
      "StreakAccelerationIsActive": false,
      "StreakOverSpeedBest": 15,
      "StreakOverSpeedBestDurationSec": 20108,
      "StreakOverSpeedBestDistanceKm": 287.484,
      "StreakOverSpeedBestFromDate": "2020-09-29T00:00:00",
      "StreakOverSpeedBestToDate": "2020-10-09T00:00:00",
      "StreakOverSpeedCurrentStreak": 1,
      "StreakOverSpeedCurrentDurationSec": 3756,
      "StreakOverSpeedCurrentDistanceKm": 80.009,
      "StreakOverSpeedCurrentFromDate": "2021-01-15T00:00:00",
      "StreakOverSpeedCurrentToDate": "2021-01-15T00:00:00",
      "StreakOverSpeedIsActive": false,
      "StreakPhoneUsageBest": 21,
      "StreakPhoneUsageBestDurationSec": 20812,
      "StreakPhoneUsageBestDistanceKm": 298.212,
      "StreakPhoneUsageBestFromDate": "2020-09-18T00:00:00",
      "StreakPhoneUsageBestToDate": "2020-09-26T00:00:00",
      "StreakPhoneUsageCurrentStreak": 1,
      "StreakPhoneUsageCurrentDurationSec": 3446,
      "StreakPhoneUsageCurrentDistanceKm": 35.31,
      "StreakPhoneUsageCurrentFromDate": "2021-01-21T00:00:00",
      "StreakPhoneUsageCurrentToDate": "2021-01-21T00:00:00",
      "StreakPhoneUsageIsActive": false,
      "UpdatedAt": "2021-01-26T05:05:11.45"
    },
    {
      "DeviceToken": "42b8b70d-54ug-49e6-8381-0120fb4be8ae",
      "InstanceId": "1e1c3e55-8fji-461d-bbbf-18a08913ec20",
      "AppId": "d9a26f4a-sr7h-476a-a54a-f5fd6fdb6395",
      "CompanyId": "ee654467-08hj-40ef-b9e9-665ab63aa2a5",
      "StreakCorneringBest": 47,
      "StreakCorneringBestDurationSec": 43750,
      "StreakCorneringBestDistanceKm": 573.5549999999998,
      "StreakCorneringBestFromDate": "2020-08-02T00:00:00",
      "StreakCorneringBestToDate": "2020-08-26T00:00:00",
      "StreakCorneringCurrentStreak": 5,
      "StreakCorneringCurrentDurationSec": 1922,
      "StreakCorneringCurrentDistanceKm": 16.749,
      "StreakCorneringCurrentFromDate": "2020-12-28T00:00:00",
      "StreakCorneringCurrentToDate": "2020-12-28T00:00:00",
      "StreakCorneringIsActive": true,
      "StreakBreakingBest": 38,
      "StreakBreakingBestDurationSec": 31001,
      "StreakBreakingBestDistanceKm": 437.4810000000001,
      "StreakBreakingBestFromDate": "2020-12-17T00:00:00",
      "StreakBreakingBestToDate": "2020-12-28T00:00:00",
      "StreakBreakingCurrentStreak": 38,
      "StreakBreakingCurrentDurationSec": 31001,
      "StreakBreakingCurrentDistanceKm": 437.4810000000001,
      "StreakBreakingCurrentFromDate": "2020-12-17T00:00:00",
      "StreakBreakingCurrentToDate": "2020-12-28T00:00:00",
      "StreakBreakingIsActive": true,
      "StreakAccelerationBest": 38,
      "StreakAccelerationBestDurationSec": 29169,
      "StreakAccelerationBestDistanceKm": 298.137,
      "StreakAccelerationBestFromDate": "2020-08-30T00:00:00",
      "StreakAccelerationBestToDate": "2020-09-27T00:00:00",
      "StreakAccelerationCurrentStreak": 2,
      "StreakAccelerationCurrentDurationSec": 919,
      "StreakAccelerationCurrentDistanceKm": 10.845,
      "StreakAccelerationCurrentFromDate": "2020-12-28T00:00:00",
      "StreakAccelerationCurrentToDate": "2020-12-28T00:00:00",
      "StreakAccelerationIsActive": false,
      "StreakOverSpeedBest": 28,
      "StreakOverSpeedBestDurationSec": 20553,
      "StreakOverSpeedBestDistanceKm": 182.11299999999997,
      "StreakOverSpeedBestFromDate": "2020-08-31T00:00:00",
      "StreakOverSpeedBestToDate": "2020-09-23T00:00:00",
      "StreakOverSpeedCurrentStreak": 5,
      "StreakOverSpeedCurrentDurationSec": 1922,
      "StreakOverSpeedCurrentDistanceKm": 16.749,
      "StreakOverSpeedCurrentFromDate": "2020-12-28T00:00:00",
      "StreakOverSpeedCurrentToDate": "2020-12-28T00:00:00",
      "StreakOverSpeedIsActive": true,
      "StreakPhoneUsageBest": 31,
      "StreakPhoneUsageBestDurationSec": 28797,
      "StreakPhoneUsageBestDistanceKm": 364.79999999999984,
      "StreakPhoneUsageBestFromDate": "2020-08-06T00:00:00",
      "StreakPhoneUsageBestToDate": "2020-08-25T00:00:00",
      "StreakPhoneUsageCurrentStreak": 17,
      "StreakPhoneUsageCurrentDurationSec": 16674,
      "StreakPhoneUsageCurrentDistanceKm": 302.076,
      "StreakPhoneUsageCurrentFromDate": "2020-12-23T00:00:00",
      "StreakPhoneUsageCurrentToDate": "2020-12-28T00:00:00",
      "StreakPhoneUsageIsActive": true,
      "UpdatedAt": "2020-12-28T03:15:25.933"
    },
  ],
  "Status": 200,
  "Title": "",
  "Errors": []
}
```

{% 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://docs-old.telematicssdk.com/platform-features/streaks.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.
