---
title: Query Active Session
slug: query-active-session
createdAt: 2026-02-05T09:33:58.280Z
---

## Purpose

Returns the start time of a currently active data session for the SIM specified in the \<iccid> element.

If the device is actively connected, the timestamp of the session start will be returned. If no active session exists, the \<timestamp> element will be empty.

### Endpoint

```xml
POST https://api.m2miportal.com
Content-Type: application/xml
Accept: application/xml
```



### Request (XML)

```xml
<query-active-session version="1" api-id="123456">
  <authentication>
    <username>username</username>
    <password>password</password>
  </authentication>
  <iccid>1234567890123456789</iccid>
</query-active-session>
```

### Response (Success)

```xml
<query-active-session-response api-id="123456">
  <api-outcome>Success</api-outcome>  
  <timestamp>22/03/2020 13:55:30</timestamp>
</query-active-session-response>
```

### Response Elements

| Element      | Description                                                                                   |
| ------------ | --------------------------------------------------------------------------------------------- |
| \<timestamp> | The start time of the current data session. Format: DD/MM/YYYY hh\:mm\:ss. All times are UTC. |

If the device is not currently in an active session, the \<timestamp> element will be returned empty.

:::hint{type="warning"}
## Usage Guidance

This query performs a live request to operator platforms.

It is not intended for constant or high-frequency polling. It should be used on an ad-hoc basis for individual SIMs where confirmation of an active session is required.

For higher-scale monitoring requirements, please contact support to discuss appropriate approaches.
:::



:::hint{type="info"}
## Response (Failure)

If a request cannot be processed, the response will include:

- api-outcome indicating failure&#x20;
- An error description explaining the reason&#x20;

Failure responses may occur due to:

- Invalid authentication credentials&#x20;
- Invalid or unknown identifiers (for example ICCID or MSISDN)&#x20;
- Invalid or missing parameters&#x20;
- Values not permitted for the specified SIM type or account configuration&#x20;
- Insufficient permissions&#x20;

Integrating systems should validate input data before submission and implement appropriate error handling and logging.
:::

