Skip to contentSkip to navigationSkip to topbar
On this page

DataSession Resource


The SIM DataSession resource returns data session information for a SIM over a period of 30 days or less in an aggregated list.

A data session represents an individual data connectivity session between the SIM-connected device and a service that interfaces between the cellular network and the Internet. This will be a PDP context(link takes you to an external page) either via a PDN connection or a Packet Gateway.

You can think of a data session as a representation of your device's Internet connection, whenever such a connection exists.

Data sessions can be used to troubleshoot device issues and understand the network setup and teardown behavior of a device in the wild.


DataSession Properties

datasession-properties page anchor
Property nameTypeRequiredDescriptionChild properties
sidstring

Optional

Not PII

The unique string that we created to identify the DataSession resource.


sim_sidstring

Optional

The SID of the Sim resource that the Data Session is for.


account_sidSID<AC>

Optional

The SID of the Account that created the DataSession resource.

Pattern: ^AC[0-9a-fA-F]{32}$Min length: 34Max length: 34

radio_linkstring

Optional

The generation of wireless technology that the device was using.


operator_mccstring

Optional

The 'mobile country code' is the unique ID of the home country where the Data Session took place. See: MCC/MNC lookup(link takes you to an external page).


operator_mncstring

Optional

The 'mobile network code' is the unique ID specific to the mobile operator network where the Data Session took place.


operator_countrystring

Optional

The three letter country code representing where the device's Data Session took place. This is determined by looking up the operator_mcc.


operator_namestring

Optional

The friendly name of the mobile operator network that the SIM-connected device is attached to. This is determined by looking up the operator_mnc.


cell_idstring

Optional

The unique ID of the cellular tower that the device was attached to at the moment when the Data Session was last updated.


cell_location_estimateobject

Optional

An object that describes the estimated location in latitude and longitude where the device's Data Session took place. The location is derived from the cell_id when the Data Session was last updated. See Cell Location Estimate Object.


packets_uploadedinteger

Optional

The number of packets uploaded by the device between the start time and when the Data Session was last updated.

Default: 0

packets_downloadedinteger

Optional

The number of packets downloaded by the device between the start time and when the Data Session was last updated.

Default: 0

last_updatedstring<date-time>

Optional

The date that the resource was last updated, given as GMT in ISO 8601(link takes you to an external page) format.


startstring<date-time>

Optional

The date that the Data Session started, given as GMT in ISO 8601(link takes you to an external page) format.


endstring<date-time>

Optional

The date that the record ended, given as GMT in ISO 8601(link takes you to an external page) format.


imeistring

Optional

The 'international mobile equipment identity' is the unique ID of the device using the SIM to connect. An IMEI is a 15-digit string: 14 digits for the device identifier plus a check digit calculated using the Luhn formula.


Cell Location Estimate Object

cell-location-estimate-object page anchor

The Cell location estimate object reports the approximate location of the cellular tower that the device was connected to when the Data Session was last updated. This is based on a lookup of public cellular tower data, and is not necessarily an accurate description of the cellular tower. It is not intended to describe the location of the SIM-connected device itself.

PropertyDescriptionEmpty Value
latIntegerLatitude. The spherical coordinate value of the estimated cellular tower location parallel to the Equator.0
lon IntegerLongitude. The spherical coordinate value of the estimated cellular tower location from the geographical North Pole to the geographical South Pole.0

Read multiple DataSession resources

read-multiple-datasession-resources page anchor
GET https://wireless.twilio.com/v1/Sims/{SimSid}/DataSessions

Path parameters

path-parameters page anchor
Property nameTypeRequiredPIIDescription
SimSidstringrequired

The SID of the Sim resource with the Data Sessions to read.

Property nameTypeRequiredPIIDescription
PageSizeinteger

Optional

How many resources to return in each list page. The default is 50, and the maximum is 1000.

Minimum: 1Maximum: 1000

Pageinteger

Optional

The page index. This value is simply for client state.

Minimum: 0

PageTokenstring

Optional

The page token. This is provided by the API.

Read multiple DataSession resourcesLink to code sample: Read multiple DataSession resources
1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function listDataSession() {
11
const dataSessions = await client.wireless.v1
12
.sims("SimSid")
13
.dataSessions.list({ limit: 20 });
14
15
dataSessions.forEach((d) => console.log(d.sid));
16
}
17
18
listDataSession();

Output

1
{
2
"data_sessions": [
3
{
4
"sid": "WNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
5
"sim_sid": "DEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
6
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
7
"radio_link": "LTE",
8
"operator_mcc": "",
9
"operator_mnc": "",
10
"operator_country": "",
11
"operator_name": "",
12
"cell_id": "",
13
"cell_location_estimate": {},
14
"packets_uploaded": 0,
15
"packets_downloaded": 0,
16
"last_updated": "2015-07-30T20:00:00Z",
17
"start": "2015-07-30T20:00:00Z",
18
"end": null,
19
"imei": null
20
},
21
{
22
"sid": "WNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
23
"sim_sid": "DEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
24
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
25
"radio_link": "3G",
26
"operator_mcc": "",
27
"operator_mnc": "",
28
"operator_country": "",
29
"operator_name": "",
30
"cell_id": "",
31
"cell_location_estimate": {},
32
"packets_uploaded": 0,
33
"packets_downloaded": 0,
34
"last_updated": "2015-07-30T20:00:00Z",
35
"start": "2015-07-30T20:00:00Z",
36
"end": "2015-07-30T20:00:00Z",
37
"imei": "014931000129700"
38
}
39
],
40
"meta": {
41
"first_page_url": "https://wireless.twilio.com/v1/Sims/DEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/DataSessions?PageSize=50&Page=0",
42
"key": "data_sessions",
43
"next_page_url": null,
44
"page": 0,
45
"page_size": 50,
46
"previous_page_url": null,
47
"url": "https://wireless.twilio.com/v1/Sims/DEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/DataSessions?PageSize=50&Page=0"
48
}
49
}

Need some help?

Terms of service

Copyright © 2024 Twilio Inc.