Skip to contentSkip to navigationSkip to topbar
Rate this page:
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 nameTypePIIDescription
sidstring
Not PII

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


sim_sidstring

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


account_sidSID<AC>

The SID of the Account that created the DataSession resource.

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

radio_linkstring

The generation of wireless technology that the device was using.


operator_mccstring

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

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


operator_countrystring

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

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

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

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

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


packets_downloadedinteger

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


last_updatedstring<date-time>

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>

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


endstring<date-time>

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


imeistring

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
PageSizeintegerOptional

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

Minimum: 1Maximum: 1000

PageintegerOptional

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

Minimum: 0

PageTokenstringOptional

The page token. This is provided by the API.

Read multiple DataSession resources

read-multiple-datasession-resources-1 page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_14
// Download the helper library from https://www.twilio.com/docs/node/install
_14
import twilio from "twilio";
_14
_14
// Find your Account SID and Auth Token at twilio.com/console
_14
// and set the environment variables. See http://twil.io/secure
_14
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_14
const authToken = process.env.TWILIO_AUTH_TOKEN;
_14
const client = twilio(accountSid, authToken);
_14
_14
const dataSessions = await client.wireless.v1
_14
.sims("SimSid")
_14
.dataSessions.list({ limit: 20 });
_14
_14
dataSessions.forEach((d) => console.log(d.sid));

Output

_49
{
_49
"data_sessions": [
_49
{
_49
"sid": "WNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_49
"sim_sid": "DEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_49
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_49
"radio_link": "LTE",
_49
"operator_mcc": "",
_49
"operator_mnc": "",
_49
"operator_country": "",
_49
"operator_name": "",
_49
"cell_id": "",
_49
"cell_location_estimate": {},
_49
"packets_uploaded": 0,
_49
"packets_downloaded": 0,
_49
"last_updated": "2015-07-30T20:00:00Z",
_49
"start": "2015-07-30T20:00:00Z",
_49
"end": null,
_49
"imei": null
_49
},
_49
{
_49
"sid": "WNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_49
"sim_sid": "DEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_49
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_49
"radio_link": "3G",
_49
"operator_mcc": "",
_49
"operator_mnc": "",
_49
"operator_country": "",
_49
"operator_name": "",
_49
"cell_id": "",
_49
"cell_location_estimate": {},
_49
"packets_uploaded": 0,
_49
"packets_downloaded": 0,
_49
"last_updated": "2015-07-30T20:00:00Z",
_49
"start": "2015-07-30T20:00:00Z",
_49
"end": "2015-07-30T20:00:00Z",
_49
"imei": "014931000129700"
_49
}
_49
],
_49
"meta": {
_49
"first_page_url": "https://wireless.twilio.com/v1/Sims/DEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/DataSessions?PageSize=50&Page=0",
_49
"key": "data_sessions",
_49
"next_page_url": null,
_49
"page": 0,
_49
"page_size": 50,
_49
"previous_page_url": null,
_49
"url": "https://wireless.twilio.com/v1/Sims/DEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/DataSessions?PageSize=50&Page=0"
_49
}
_49
}


Rate this page: