> This page is for Developers.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.iot.telia.lt/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.iot.telia.lt/_mcp/server.

# Endpoint usage and cost statistics

GET https://iot.telia.lt/api/v1/endpoint/{endpoint_id}/stats

You can only retrieve data traffic costs for organizations without multi-inclusive volumes.

Retrieves endpoint usage and cost statistics for a given ID.
Usage statistics are sorted by `data` and `sms`.

Returns statistics from the following periods:

* `last_month`: Previous billing month, from the first to last day (for example, April 1-30, 2023, when you send the request sometime in May 2023).
* `current_month`: Current month, with statistics calculated up to and including the date requested (for example, May 1-8, 2023, when you sent the request on May 8, 2023).
* `last_hour`: Previous 60 minutes, accumulated per minute and organized by data or SMS received by the device (`rx`) and transmitted by the device (`tx`).

`last_month` and `current_month` are only included in the responses if traffic exists.

Reference: https://docs.iot.telia.lt/developers/api/endpoint/endpoint-stats-by-id-get

## Authentication

- `Authorization` header (bearer token, required) — An `auth_token` should be provided to authenticate a session. To obtain an `auth_token`, see the [`/api/v1/authenticate` **POST** request](/developers/api/authentication/authenticate).

## Request

### Path parameters

- `endpoint_id` (integer, required) — Numeric ID of an endpoint

## Response

### 200

Successfully returned the endpoint statistics associated with the provided `id`.

- `last_month` (ApiV1EndpointEndpointIdStatsGetResponsesContentApplicationJsonSchemaLastMonth, optional)
- `current_month` (ApiV1EndpointEndpointIdStatsGetResponsesContentApplicationJsonSchemaCurrentMonth, optional)
- `last_hour` (ApiV1EndpointEndpointIdStatsGetResponsesContentApplicationJsonSchemaLastHour, optional)

## Errors

### 403 Forbidden Error

Your role doesn't include the permission this endpoint requires. Most endpoints return `error_code`, `error_token`, and `message`. Some return only `status_code` and `message`.

- `error_code` (integer, optional)
- `error_token` (string, optional)
- `status_code` (integer, optional)
- `message` (string, optional)

## Types

### ApiV1EndpointEndpointIdStatsGetResponsesContentApplicationJsonSchemaLastMonth

### ApiV1EndpointEndpointIdStatsGetResponsesContentApplicationJsonSchemaCurrentMonth

### ApiV1EndpointEndpointIdStatsGetResponsesContentApplicationJsonSchemaLastHour

## Examples

**Response**

```json
{
  "last_month": {
    "data": {
      "cost": 6.10483935,
      "currency": {
        "code": "EUR",
        "id": 1,
        "symbol": "€"
      },
      "currency_id": 1,
      "endpoint_id": 166,
      "id": 311,
      "last_updated": "2020-11-30T14:56:25.000Z",
      "month": "2020-11-01T00:00:00.000Z",
      "traffic_type": {
        "description": "Data",
        "id": 5,
        "unit": "MB"
      },
      "traffic_type_id": 5,
      "volume": "29.166235",
      "volume_rx": "23.589006",
      "volume_tx": "5.577229"
    },
    "sms": {
      "cost": 3.32,
      "currency": {
        "code": "EUR",
        "id": 1,
        "symbol": "€"
      },
      "currency_id": 1,
      "endpoint_id": 166,
      "id": 312,
      "last_updated": "2019-11-26T10:52:42.000Z",
      "month": "2019-11-01T00:00:00.000Z",
      "traffic_type": {
        "description": "SMS",
        "id": 6,
        "unit": "SMS"
      },
      "traffic_type_id": 6,
      "volume": "51.000000",
      "volume_rx": "15.000000",
      "volume_tx": "36.000000"
    }
  },
  "current_month": {
    "data": {
      "cost": 0.21203925,
      "currency": {
        "code": "EUR",
        "id": 1,
        "symbol": "€"
      },
      "currency_id": 1,
      "endpoint_id": 166,
      "id": 435,
      "last_updated": "2020-03-01T15:12:53.000Z",
      "month": "2020-03-01T00:00:00.000Z",
      "traffic_type": {
        "description": "Data",
        "id": 5,
        "unit": "MB"
      },
      "traffic_type_id": 5,
      "volume": "0.848157",
      "volume_rx": "0.675311",
      "volume_tx": "0.172846"
    },
    "sms": {
      "cost": 0.17,
      "currency": {
        "code": "EUR",
        "id": 1,
        "symbol": "€"
      },
      "currency_id": 1,
      "endpoint_id": 166,
      "id": 439,
      "last_updated": "2020-03-01T14:20:42.000Z",
      "month": "2020-03-01T00:00:00.000Z",
      "traffic_type": {
        "description": "SMS",
        "id": 6,
        "unit": "SMS"
      },
      "traffic_type_id": 6,
      "volume": "3.000000",
      "volume_rx": "1.000000",
      "volume_tx": "2.000000"
    }
  },
  "last_hour": {
    "data": {
      "rx": [
        [
          "06:38",
          0
        ],
        [
          "06:39",
          0
        ],
        [
          "06:40",
          0
        ],
        [
          "06:41",
          0
        ],
        [
          "06:42",
          0
        ],
        [
          "06:43",
          0
        ],
        [
          "06:44",
          0
        ],
        [
          "06:45",
          0
        ],
        [
          "06:46",
          0
        ],
        [
          "06:47",
          0
        ],
        [
          "06:48",
          0
        ],
        [
          "06:49",
          0
        ],
        [
          "06:50",
          0
        ],
        [
          "06:51",
          0
        ],
        [
          "06:52",
          0
        ],
        [
          "06:53",
          0
        ],
        [
          "06:54",
          0
        ],
        [
          "06:55",
          0
        ],
        [
          "06:56",
          0
        ],
        [
          "06:57",
          0
        ],
        [
          "06:58",
          0
        ],
        [
          "06:59",
          0
        ],
        [
          "07:00",
          0
        ],
        [
          "07:01",
          0
        ],
        [
          "07:02",
          0
        ],
        [
          "07:03",
          0
        ],
        [
          "07:04",
          0
        ],
        [
          "07:05",
          0
        ],
        [
          "07:06",
          0
        ],
        [
          "07:07",
          0
        ],
        [
          "07:08",
          0
        ],
        [
          "07:09",
          0
        ],
        [
          "07:10",
          0
        ],
        [
          "07:11",
          0
        ],
        [
          "07:12",
          0
        ],
        [
          "07:13",
          0
        ],
        [
          "07:14",
          0
        ],
        [
          "07:15",
          0
        ],
        [
          "07:16",
          0
        ],
        [
          "07:17",
          0
        ],
        [
          "07:18",
          0
        ],
        [
          "07:19",
          0
        ],
        [
          "07:20",
          0
        ],
        [
          "07:21",
          0
        ],
        [
          "07:22",
          0
        ],
        [
          "07:23",
          0
        ],
        [
          "07:24",
          0
        ],
        [
          "07:25",
          0
        ],
        [
          "07:26",
          0
        ],
        [
          "07:27",
          0
        ],
        [
          "07:28",
          0
        ],
        [
          "07:29",
          0
        ],
        [
          "07:30",
          0
        ],
        [
          "07:31",
          0
        ],
        [
          "07:32",
          0
        ],
        [
          "07:33",
          0
        ],
        [
          "07:34",
          0
        ],
        [
          "07:35",
          0
        ],
        [
          "07:36",
          0
        ]
      ],
      "tx": [
        [
          "06:38",
          0
        ],
        [
          "06:39",
          0
        ],
        [
          "06:40",
          0
        ],
        [
          "06:41",
          0
        ],
        [
          "06:42",
          0
        ],
        [
          "06:43",
          0
        ],
        [
          "06:44",
          0
        ],
        [
          "06:45",
          0
        ],
        [
          "06:46",
          0
        ],
        [
          "06:47",
          0
        ],
        [
          "06:48",
          0
        ],
        [
          "06:49",
          0
        ],
        [
          "06:50",
          0
        ],
        [
          "06:51",
          0
        ],
        [
          "06:52",
          0
        ],
        [
          "06:53",
          0
        ],
        [
          "06:54",
          0
        ],
        [
          "06:55",
          0
        ],
        [
          "06:56",
          0
        ],
        [
          "06:57",
          0
        ],
        [
          "06:58",
          0
        ],
        [
          "06:59",
          0
        ],
        [
          "07:00",
          0
        ],
        [
          "07:01",
          0
        ],
        [
          "07:02",
          0
        ],
        [
          "07:03",
          0
        ],
        [
          "07:04",
          0
        ],
        [
          "07:05",
          0
        ],
        [
          "07:06",
          0
        ],
        [
          "07:07",
          0
        ],
        [
          "07:08",
          0
        ],
        [
          "07:09",
          0
        ],
        [
          "07:10",
          0
        ],
        [
          "07:11",
          0
        ],
        [
          "07:12",
          0
        ],
        [
          "07:13",
          0
        ],
        [
          "07:14",
          0
        ],
        [
          "07:15",
          0
        ],
        [
          "07:16",
          0
        ],
        [
          "07:17",
          0
        ],
        [
          "07:18",
          0
        ],
        [
          "07:19",
          0
        ],
        [
          "07:20",
          0
        ],
        [
          "07:21",
          0
        ],
        [
          "07:22",
          0
        ],
        [
          "07:23",
          0
        ],
        [
          "07:24",
          0
        ],
        [
          "07:25",
          0
        ],
        [
          "07:26",
          0
        ],
        [
          "07:27",
          0
        ],
        [
          "07:28",
          0
        ],
        [
          "07:29",
          0
        ],
        [
          "07:30",
          0
        ],
        [
          "07:31",
          0
        ],
        [
          "07:32",
          0
        ],
        [
          "07:33",
          0
        ],
        [
          "07:34",
          0
        ],
        [
          "07:35",
          0
        ],
        [
          "07:36",
          0
        ]
      ]
    },
    "sms": {
      "rx": [
        [
          "06:38",
          0
        ],
        [
          "06:39",
          0
        ],
        [
          "06:40",
          0
        ],
        [
          "06:41",
          0
        ],
        [
          "06:42",
          0
        ],
        [
          "06:43",
          0
        ],
        [
          "06:44",
          0
        ],
        [
          "06:45",
          0
        ],
        [
          "06:46",
          0
        ],
        [
          "06:47",
          0
        ],
        [
          "06:48",
          0
        ],
        [
          "06:49",
          0
        ],
        [
          "06:50",
          0
        ],
        [
          "06:51",
          0
        ],
        [
          "06:52",
          0
        ],
        [
          "06:53",
          0
        ],
        [
          "06:54",
          0
        ],
        [
          "06:55",
          0
        ],
        [
          "06:56",
          0
        ],
        [
          "06:57",
          0
        ],
        [
          "06:58",
          0
        ],
        [
          "06:59",
          0
        ],
        [
          "07:00",
          0
        ],
        [
          "07:01",
          0
        ],
        [
          "07:02",
          0
        ],
        [
          "07:03",
          0
        ],
        [
          "07:04",
          0
        ],
        [
          "07:05",
          0
        ],
        [
          "07:06",
          0
        ],
        [
          "07:07",
          0
        ],
        [
          "07:08",
          0
        ],
        [
          "07:09",
          0
        ],
        [
          "07:10",
          0
        ],
        [
          "07:11",
          0
        ],
        [
          "07:12",
          0
        ],
        [
          "07:13",
          0
        ],
        [
          "07:14",
          0
        ],
        [
          "07:15",
          0
        ],
        [
          "07:16",
          0
        ],
        [
          "07:17",
          0
        ],
        [
          "07:18",
          0
        ],
        [
          "07:19",
          0
        ],
        [
          "07:20",
          0
        ],
        [
          "07:21",
          0
        ],
        [
          "07:22",
          0
        ],
        [
          "07:23",
          0
        ],
        [
          "07:24",
          0
        ],
        [
          "07:25",
          0
        ],
        [
          "07:26",
          0
        ],
        [
          "07:27",
          0
        ],
        [
          "07:28",
          0
        ],
        [
          "07:29",
          0
        ],
        [
          "07:30",
          0
        ],
        [
          "07:31",
          0
        ],
        [
          "07:32",
          0
        ],
        [
          "07:33",
          0
        ],
        [
          "07:34",
          0
        ],
        [
          "07:35",
          0
        ],
        [
          "07:36",
          0
        ]
      ],
      "tx": [
        [
          "06:38",
          0
        ],
        [
          "06:39",
          0
        ],
        [
          "06:40",
          0
        ],
        [
          "06:41",
          0
        ],
        [
          "06:42",
          0
        ],
        [
          "06:43",
          0
        ],
        [
          "06:44",
          0
        ],
        [
          "06:45",
          0
        ],
        [
          "06:46",
          0
        ],
        [
          "06:47",
          0
        ],
        [
          "06:48",
          0
        ],
        [
          "06:49",
          0
        ],
        [
          "06:50",
          0
        ],
        [
          "06:51",
          0
        ],
        [
          "06:52",
          0
        ],
        [
          "06:53",
          0
        ],
        [
          "06:54",
          0
        ],
        [
          "06:55",
          0
        ],
        [
          "06:56",
          0
        ],
        [
          "06:57",
          0
        ],
        [
          "06:58",
          0
        ],
        [
          "06:59",
          0
        ],
        [
          "07:00",
          0
        ],
        [
          "07:01",
          0
        ],
        [
          "07:02",
          0
        ],
        [
          "07:03",
          0
        ],
        [
          "07:04",
          0
        ],
        [
          "07:05",
          0
        ],
        [
          "07:06",
          0
        ],
        [
          "07:07",
          0
        ],
        [
          "07:08",
          0
        ],
        [
          "07:09",
          0
        ],
        [
          "07:10",
          0
        ],
        [
          "07:11",
          0
        ],
        [
          "07:12",
          0
        ],
        [
          "07:13",
          0
        ],
        [
          "07:14",
          0
        ],
        [
          "07:15",
          0
        ],
        [
          "07:16",
          0
        ],
        [
          "07:17",
          0
        ],
        [
          "07:18",
          0
        ],
        [
          "07:19",
          0
        ],
        [
          "07:20",
          0
        ],
        [
          "07:21",
          0
        ],
        [
          "07:22",
          0
        ],
        [
          "07:23",
          0
        ],
        [
          "07:24",
          0
        ],
        [
          "07:25",
          0
        ],
        [
          "07:26",
          0
        ],
        [
          "07:27",
          0
        ],
        [
          "07:28",
          0
        ],
        [
          "07:29",
          0
        ],
        [
          "07:30",
          0
        ],
        [
          "07:31",
          0
        ],
        [
          "07:32",
          0
        ],
        [
          "07:33",
          0
        ],
        [
          "07:34",
          0
        ],
        [
          "07:35",
          0
        ],
        [
          "07:36",
          0
        ]
      ]
    }
  }
}
```

**SDK Code**

```python Retrieved
import requests

url = "https://iot.telia.lt/api/v1/endpoint/1/stats"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```javascript Retrieved
const url = 'https://iot.telia.lt/api/v1/endpoint/1/stats';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Retrieved
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://iot.telia.lt/api/v1/endpoint/1/stats"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Retrieved
require 'uri'
require 'net/http'

url = URI("https://iot.telia.lt/api/v1/endpoint/1/stats")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java Retrieved
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://iot.telia.lt/api/v1/endpoint/1/stats")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php Retrieved
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://iot.telia.lt/api/v1/endpoint/1/stats', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

echo $response->getBody();
```

```csharp Retrieved
using RestSharp;

var client = new RestClient("https://iot.telia.lt/api/v1/endpoint/1/stats");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift Retrieved
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://iot.telia.lt/api/v1/endpoint/1/stats")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```