---
updatedAt: 2026-01-26T15:50:20.000Z
agentTools:
  projectIndex: https://docs.nextpertise.nl/llms.txt
---

# Getting mobile connection usage information

```python Python
import requests

# Configure the Nextpertise API
NEXTPERTISE_API = "https://api.nextpertise.nl"
NEXTPERTISE_TOKEN = "xxx"


# Get all active mobile connections and select one to find its usage:
response = requests.get(
    f"{NEXTPERTISE_API}/mixed-broadband/connections/",
    headers={"Authorization": f"Bearer {NEXTPERTISE_TOKEN}"},
    params={"page_size": 10, "page": 1, "view": "mobile_broadband_active_only"},
)
response.raise_for_status()
pagination_info = response.json()["pagination"]
connection_list = response.json()["results"]
if pagination_info["total_count"] == 0:
    print("There are no active mobile connections!")
    exit(0)
print(f"Found {pagination_info['total_count']} active mobile connections.")
# Found 17 active mobile connections.

# Get month-to-date usage for the first active mobile connection
connection_uuid = connection_list[0]["uuid"]
response = requests.get(
    f"{NEXTPERTISE_API}/mobile-broadband/connections/{connection_uuid}/usage/month-to-date/",
    headers={"Authorization": f"Bearer {NEXTPERTISE_TOKEN}"},
)
response.raise_for_status()
usage_data = response.json()

print(usage_data)
# {'data': {'usage_in_bytes': 26275840, 'i18n_usage': '26,28 MB'}, 'sms': None}

print(f"Mobile connection usage this month: {usage_data['data']['i18n_usage']} ({usage_data['data']['usage_in_bytes']} bytes).")
# Mobile connection usage this month: 26,28 MB (26275840 bytes).

```

# Configure the API

<!-- python@3-6 -->

Set the Nextpertise API location and your API token. More information about obtaining a new API token can be found on the [Authentication](https://docs.nextpertise.nl/reference/authentication) page.

# Find active mobile connections

<!-- python@8-21 -->

We start by find all currently active mobile connections, using the `mobile_broadband_active_only` view on the [Get Connections](https://docs.nextpertise.nl/reference/get-connections) endpoint.

# Get the usage of a mobile connection

<!-- python@23-88 -->

Using the UUID of the selected connection, we can look up it's usage in the current month with the [Get Connection Month To Date Usage](https://docs.nextpertise.nl/reference/get_connection_month_to_date_usage) endpoint.