The Super SIM's UsageRecords
API might have some unimplemented features or others that might change before Twilio declares it Generally Available. Twilio SLAs don't cover Beta products. To learn more, consult beta product support.
A UsageRecords
response represents the aggregated usage data incurred over a specified period of time. With this API call, you can filter or group usage by resource and slice the results by increments of time.
Sim
resource.Twilio sends usage events to the aggregation engine that powers the UsageRecords API and Twilio's billing system. These events include how much data your SIMs used.
Twilio sends usage data to the UsageRecords aggregation engine and Twilio's billing system at the same time. This results in UsageRecords displaying the current data usage, but not the current amount billed. Within 24 hours of usage event occurring, the billing system processes your data usage then returns the cost data to the aggregation engine. The UsageRecords
call then reflects the current costs in its data_total_billed
property.
If you use this API to generate critical spending reports, wait at least 24 hours after the reported period ends. This allows time to process and charge usage events so your results reflect that billing.
The SID of the Account that incurred the usage.
^AC[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
SID of a Sim resource to which the UsageRecord belongs. Value will only be present when either a value for the Sim
query parameter is provided or when UsageRecords are grouped by sim
. Otherwise, the value will be null
.
^HS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
SID of the Network resource the usage occurred on. Value will only be present when either a value for the Network
query parameter is provided or when UsageRecords are grouped by network
. Otherwise, the value will be null
.
^HW[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
SID of the Fleet resource the usage occurred on. Value will only be present when either a value for the Fleet
query parameter is provided or when UsageRecords are grouped by fleet
. Otherwise, the value will be null
.
^HF[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
Alpha-2 ISO Country Code that the usage occurred in. Value will only be present when either a value for the IsoCountry
query parameter is provided or when UsageRecords are grouped by isoCountry
. Otherwise, the value will be null
.
The time period for which the usage is reported. The period is represented as a pair of start_time
and end_time
timestamps specified in ISO 8601 format.
Total data uploaded in bytes, aggregated by the query parameters.
Total data downloaded in bytes, aggregated by the query parameters.
Total amount in the billed_unit
that was charged for the data uploaded or downloaded. Will return 0 for usage prior to February 1, 2022. Value may be 0 despite data_total
being greater than 0 if the data usage is still being processed by Twilio's billing system. Refer to Data Usage Processing for more details.
The currency in which the billed amounts are measured, specified in the 3 letter ISO 4127 format (e.g. USD
, EUR
, JPY
). This can be null when data_toal_billed is 0 and we do not yet have billing information for the corresponding data usage. Refer to Data Usage Processing for more details.
GET https://supersim.twilio.com/v1/UsageRecords
Return a list of UsageRecords
entries. These entries cover a specified period and aggregated to a specified granularity.
SID or unique name of a Sim resource. Only show UsageRecords representing usage incurred by this Super SIM.
SID or unique name of a Fleet resource. Only show UsageRecords representing usage for Super SIMs belonging to this Fleet resource at the time the usage occurred.
SID of a Network resource. Only show UsageRecords representing usage on this network.
^HW[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
Alpha-2 ISO Country Code. Only show UsageRecords representing usage in this country.
Dimension over which to aggregate usage records. Can be: sim
, fleet
, network
, isoCountry
. Default is to not aggregate across any of these dimensions, UsageRecords will be aggregated into the time buckets described by the Granularity
parameter.
sim
fleet
network
isoCountry
Time-based grouping that UsageRecords should be aggregated by. Can be: hour
, day
, or all
. Default is all
. all
returns one UsageRecord that describes the usage for the entire period.
hour
day
all
Only include usage that occurred at or after this time, specified in ISO 8601 format. Default is one month before the end_time
.
Only include usage that occurred before this time (exclusive), specified in ISO 8601 format. Default is the current time.
How many resources to return in each list page. The default is 50, and the maximum is 1000.
1
Maximum: 1000
The page token. This is provided by the API.
The end_time
query parameter is exclusive. This means a response to this API call excludes any usage records that occur on or after its date and time.
To request all of the usage that occurred on February 20, 2022, you should use the following start_time
and end_time
request parameters:
start_time
: 2022-02-20T00:00:00Z
end_time
: 2022-02-21T00:00:00Z
As Twilio excludes usage from end_time
and later, the response omits any usage that occurred at midnight on February 21, 2022.
You can request usage data for a single SIM or for all SIMs in your account.
Queries for a single SIM require less compute time than queries for all SIMs on your account. Single SIM queries may have fewer limits for this reason.
StartTime
and EndTime
parameters.When applicable, the following sections include both a Single SIM Usage Request and an Account Usage Request. To query one Super SIM, set a value for the Sim
request parameter.
This example returns the aggregated usage data for the account. The response is neither filtered or grouped.
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function listUsageRecord() {11const usageRecords = await client.supersim.v1.usageRecords.list({12limit: 20,13});1415usageRecords.forEach((u) => console.log(u.accountSid));16}1718listUsageRecord();
1{2"usage_records": [3{4"period": {5"start_time": "2015-05-01T20:00:00Z",6"end_time": "2015-06-01T20:00:00Z"7},8"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",9"data_upload": 150000,10"data_download": 150000,11"data_total": 300000,12"data_total_billed": "0.03",13"billed_unit": "USD",14"sim_sid": null,15"fleet_sid": null,16"network_sid": null,17"iso_country": null18}19],20"meta": {21"first_page_url": "https://supersim.twilio.com/v1/UsageRecords?PageSize=50&Page=0",22"key": "usage_records",23"next_page_url": null,24"page": 0,25"page_size": 50,26"previous_page_url": null,27"url": "https://supersim.twilio.com/v1/UsageRecords?PageSize=50&Page=0"28}29}
To filter usage data to a specific resource type, add parameters to your UsageRecords
requests. To filter your UsageRecords
request, include one or more of the following request parameters:
Parameter | Limits response to records | Allowed value |
---|---|---|
Sim | Requested Sim resource | Sim resource's Sid or UniqueName |
Fleet | Super SIMs assigned to this Fleet resource | Fleet resource's Sid or UniqueName |
Network | This cellular network | Network resource's Sid |
IsoCountry | Cellular networks in this country | IsoCountry of the Network resource |
When you set a filtering parameter, the UsageRecords
entry returns this value in its corresponding property.
If your request includes a Sim
name-value pair, the UsageRecords
response returns an entry for one Super SIM. Set the value of the Super SIM in the Sim
parameter. The response returns this parameter in the value of its sim_sid
property.
This example returns the aggregated usage data for the Super SIM specified in the Sim
parameter displayed in its sim_sid
property. In the following example, that value equals HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
.
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function listUsageRecord() {11const usageRecords = await client.supersim.v1.usageRecords.list({12granularity: "day",13sim: "HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",14limit: 20,15});1617usageRecords.forEach((u) => console.log(u.accountSid));18}1920listUsageRecord();
1{2"usage_records": [3{4"period": {5"start_time": "2019-05-03T00:00:00Z",6"end_time": "2019-05-04T00:00:00Z"7},8"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",9"sim_sid": "HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",10"data_upload": 150000,11"data_download": 150000,12"data_total": 300000,13"data_total_billed": "0.03",14"billed_unit": "USD",15"fleet_sid": null,16"network_sid": null,17"iso_country": null18},19{20"period": {21"start_time": "2019-05-02T00:00:00Z",22"end_time": "2019-05-03T00:00:00Z"23},24"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",25"data_upload": 150000,26"data_download": 150000,27"data_total": 300000,28"data_total_billed": "0.03",29"billed_unit": "USD",30"sim_sid": "HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",31"fleet_sid": null,32"network_sid": null,33"iso_country": null34}35],36"meta": {37"first_page_url": "https://supersim.twilio.com/v1/UsageRecords?Sim=HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&Granularity=day&PageSize=50&Page=0",38"key": "usage_records",39"next_page_url": null,40"page": 0,41"page_size": 50,42"previous_page_url": null,43"url": "https://supersim.twilio.com/v1/UsageRecords?Sim=HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&Granularity=day&PageSize=50&Page=0"44}45}
If your request includes a Fleet
name-value pair, the UsageRecords
response returns an entry for one fleet of Super SIMs. Set the value of the fleet in the Fleet
parameter. The response returns this parameter in the value of its fleet_sid
property.
This example returns the aggregated usage data for the group of Super SIMs specified in the Fleet
parameter displayed in its fleet_sid
property. In the following example, that value equals HFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
.
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function listUsageRecord() {11const usageRecords = await client.supersim.v1.usageRecords.list({12fleet: "HFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",13granularity: "day",14limit: 20,15});1617usageRecords.forEach((u) => console.log(u.fleetSid));18}1920listUsageRecord();
1{2"usage_records": [3{4"period": {5"start_time": "2019-05-03T00:00:00Z",6"end_time": "2019-05-04T00:00:00Z"7},8"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",9"data_upload": 150000,10"data_download": 150000,11"data_total": 300000,12"data_total_billed": "0.03",13"billed_unit": "USD",14"sim_sid": null,15"fleet_sid": "HFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",16"network_sid": null,17"iso_country": null18},19{20"period": {21"start_time": "2019-05-02T00:00:00Z",22"end_time": "2019-05-03T00:00:00Z"23},24"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",25"data_upload": 150000,26"data_download": 150000,27"data_total": 300000,28"data_total_billed": "0.03",29"billed_unit": "USD",30"sim_sid": null,31"fleet_sid": "HFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",32"network_sid": null,33"iso_country": null34}35],36"meta": {37"first_page_url": "https://supersim.twilio.com/v1/UsageRecords?Fleet=HFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&Granularity=day&PageSize=50&Page=0",38"key": "usage_records",39"next_page_url": null,40"page": 0,41"page_size": 50,42"previous_page_url": null,43"url": "https://supersim.twilio.com/v1/UsageRecords?Fleet=HFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&Granularity=day&PageSize=50&Page=0"44}45}
If your request includes a Network
name-value pair, the UsageRecords
response returns an entry for one carrier network. Set the value of the carrier network in the Network
parameter. The response returns this parameter in the value of its network_sid
property.
This example returns the aggregated usage data for the carrier network specified in the Network
parameter displayed in its network_sid
property. In the following example, that value equals HWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
.
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function listUsageRecord() {11const usageRecords = await client.supersim.v1.usageRecords.list({12granularity: "day",13network: "HWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",14limit: 20,15});1617usageRecords.forEach((u) => console.log(u.networkSid));18}1920listUsageRecord();
1{2"usage_records": [3{4"period": {5"start_time": "2019-05-03T00:00:00Z",6"end_time": "2019-05-04T00:00:00Z"7},8"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",9"data_upload": 150000,10"data_download": 150000,11"data_total": 300000,12"data_total_billed": "0.03",13"billed_unit": "USD",14"sim_sid": null,15"fleet_sid": null,16"network_sid": "HWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",17"iso_country": null18},19{20"period": {21"start_time": "2019-05-03T00:00:00Z",22"end_time": "2019-05-04T00:00:00Z"23},24"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",25"data_upload": 150000,26"data_download": 150000,27"data_total": 300000,28"data_total_billed": "0.03",29"billed_unit": "USD",30"sim_sid": null,31"fleet_sid": null,32"network_sid": "HWbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",33"iso_country": null34}35],36"meta": {37"first_page_url": "https://supersim.twilio.com/v1/UsageRecords?Group=network&PageSize=50&Page=0",38"key": "usage_records",39"next_page_url": null,40"page": 0,41"page_size": 50,42"previous_page_url": null,43"url": "https://supersim.twilio.com/v1/UsageRecords?Group=network&PageSize=50&Page=0"44}45}
If your request includes a IsoCountry
name-value pair, the UsageRecords
response returns an entry for one carrier network. Set the value of the carrier network in the IsoCountry
parameter. The response returns this parameter in the value of its iso_country
property.
This example returns the aggregated usage data for the carrier network specified in the IsoCountry
parameter displayed in its iso_country
property. In the following example, that value equals FR
(for France).
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function listUsageRecord() {11const usageRecords = await client.supersim.v1.usageRecords.list({12granularity: "day",13isoCountry: "FR",14limit: 20,15});1617usageRecords.forEach((u) => console.log(u.isoCountry));18}1920listUsageRecord();
1{2"usage_records": [3{4"period": {5"start_time": "2019-05-03T00:00:00Z",6"end_time": "2019-05-04T00:00:00Z"7},8"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",9"data_upload": 150000,10"data_download": 150000,11"data_total": 300000,12"data_total_billed": "0.03",13"billed_unit": "USD",14"sim_sid": null,15"fleet_sid": null,16"network_sid": null,17"iso_country": "FR"18},19{20"period": {21"start_time": "2019-05-02T00:00:00Z",22"end_time": "2019-05-03T00:00:00Z"23},24"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",25"data_upload": 150000,26"data_download": 150000,27"data_total": 300000,28"data_total_billed": "0.03",29"billed_unit": "USD",30"sim_sid": null,31"fleet_sid": null,32"network_sid": null,33"iso_country": "FR"34}35],36"meta": {37"first_page_url": "https://supersim.twilio.com/v1/UsageRecords?IsoCountry=FR&Granularity=day&PageSize=50&Page=0",38"key": "usage_records",39"next_page_url": null,40"page": 0,41"page_size": 50,42"previous_page_url": null,43"url": "https://supersim.twilio.com/v1/UsageRecords?IsoCountry=FR&Granularity=day&PageSize=50&Page=0"44}45}
You can apply multiple filters to one request. To see the usage that a single Super SIM incurred on the requested cellular network, provide values for both Sim
and Network
.
1curl -X GET "https://supersim.twilio.com/v1/UsageRecords?Sim=HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&Network=HWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&Granularity=day&PageSize=20" \2-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN34{5"usage_records": [6{7"period": {8"start_time": "2019-05-03T00:00:00Z",9"end_time": "2019-05-04T00:00:00Z"10},11"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",12"sim_sid": "HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",13"data_upload": 150000,14"data_download": 150000,15"data_total": 300000,16"data_total_billed": "0.03",17"billed_unit": "USD",18"fleet_sid": null,19"network_sid": "HWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",20"iso_country": null21},22{23"period": {24"start_time": "2019-05-02T00:00:00Z",25"end_time": "2019-05-03T00:00:00Z"26},27"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",28"data_upload": 150000,29"data_download": 150000,30"data_total": 300000,31"data_total_billed": "0.03",32"billed_unit": "USD",33"sim_sid": "HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",34"fleet_sid": null,35"network_sid": "HWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",36"iso_country": null37}38],39"meta": {40"first_page_url": "https://supersim.twilio.com/v1/UsageRecords?Sim=HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&Network=HWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&Granularity=day&PageSize=20&Page=0",41"key": "usage_records",42"next_page_url": null,43"page": 0,44"page_size": 20,45"previous_page_url": null,46"url": "https://supersim.twilio.com/v1/UsageRecords?Sim=HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&Network=HWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&Granularity=day&PageSize=20&Page=0"47}48}
Each UsageRecords
request returns the usage incurred over a period of time. The period of time covers a range within the following limits:
StartTime
but omits the EndTime
as noted previously.Granularity
parameter. The Granularity
accepts all
, day
, or hour
and defaults to all
.Granularity
and Sim
.For a single SIM's usage, the Granularity
parameter applies the following limits based on its value.
Value | Returns One Record for | Accepted UTC timestamps | Maximum Query Period |
---|---|---|---|
all | The entire period* | Any valid UTC timestamp | 18 months |
day | Each UTC day | Midnight for any day at UTC | 3 months |
hour | Each UTC hour | Top of any hour at UTC | 31 days |
* For periods over 24 hours, UsageRecords
calls using Granularity
of all
include usage for the entire first and last hour. It rounds StartTime
down to the start of the UTC hour and EndTime
up to the next UTC hour.
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function listUsageRecord() {11const usageRecords = await client.supersim.v1.usageRecords.list({12granularity: "day",13sim: "HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",14limit: 20,15});1617usageRecords.forEach((u) => console.log(u.accountSid));18}1920listUsageRecord();
1{2"usage_records": [3{4"period": {5"start_time": "2019-05-03T00:00:00Z",6"end_time": "2019-05-04T00:00:00Z"7},8"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",9"sim_sid": "HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",10"data_upload": 150000,11"data_download": 150000,12"data_total": 300000,13"data_total_billed": "0.03",14"billed_unit": "USD",15"fleet_sid": null,16"network_sid": null,17"iso_country": null18},19{20"period": {21"start_time": "2019-05-02T00:00:00Z",22"end_time": "2019-05-03T00:00:00Z"23},24"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",25"data_upload": 150000,26"data_download": 150000,27"data_total": 300000,28"data_total_billed": "0.03",29"billed_unit": "USD",30"sim_sid": "HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",31"fleet_sid": null,32"network_sid": null,33"iso_country": null34}35],36"meta": {37"first_page_url": "https://supersim.twilio.com/v1/UsageRecords?Sim=HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&Granularity=day&PageSize=50&Page=0",38"key": "usage_records",39"next_page_url": null,40"page": 0,41"page_size": 50,42"previous_page_url": null,43"url": "https://supersim.twilio.com/v1/UsageRecords?Sim=HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&Granularity=day&PageSize=50&Page=0"44}45}
You can group UsageRecords entries around a type of resource. Resource types include SIM, Fleet, Network, and Country. Each UsageRecords
entry represents how much the account used the chosen record type over a period of time. Each UsageRecords
entry returns data aggregated for each type of resource.
To group your UsageRecords
entries by SIM or by Fleet, you must join a Private Beta. To join, contact your Twilio Account Executive.
To group your UsageRecords
entries, set Group
to one of the following values:
Value | Groups by | Covers usage for | Availability | Notes |
---|---|---|---|---|
sim | Super SIM | one Super SIM | Private Beta | maximum query period 31 days |
fleet | Fleet | all Super SIMs assigned to one Fleet | Private Beta | |
network | Network | one Network | GA | |
isoCountry | Country | all Networks in one country | GA |
When you set a Group
, the response includes the resource type's parameter on each UsageRecords
entry to the Group
value.
You can filter grouped UsageRecords.
When your request sets a Group
to sim
, the UsageRecords
response returns an entry for each Super SIM. The response returns each Super SIM value in its sim_sid
property.
This example returns the aggregated usage data for each Super SIM displayed in its sim_sid
property. In the following example, that value covers HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
and HSbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
.
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function listUsageRecord() {11const usageRecords = await client.supersim.v1.usageRecords.list({12group: "sim",13limit: 20,14});1516usageRecords.forEach((u) => console.log(u.simSid));17}1819listUsageRecord();
1{2"usage_records": [3{4"period": {5"start_time": "2019-05-03T00:00:00Z",6"end_time": "2019-05-04T00:00:00Z"7},8"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",9"data_upload": 150000,10"data_download": 150000,11"data_total": 300000,12"data_total_billed": "0.03",13"billed_unit": "USD",14"sim_sid": "HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",15"fleet_sid": null,16"network_sid": null,17"iso_country": null18},19{20"period": {21"start_time": "2019-05-03T00:00:00Z",22"end_time": "2019-05-04T00:00:00Z"23},24"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",25"data_upload": 150000,26"data_download": 150000,27"data_total": 300000,28"data_total_billed": "0.03",29"billed_unit": "USD",30"sim_sid": "HSbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",31"fleet_sid": null,32"network_sid": null,33"iso_country": null34}35],36"meta": {37"first_page_url": "https://supersim.twilio.com/v1/UsageRecords?Group=sim&PageSize=50&Page=0",38"key": "usage_records",39"next_page_url": null,40"page": 0,41"page_size": 50,42"previous_page_url": null,43"url": "https://supersim.twilio.com/v1/UsageRecords?Group=sim&PageSize=50&Page=0"44}45}
When your request sets a Group
to fleet
, the UsageRecords
response returns an entry for each group of Super SIMs identified as a Fleet. The response returns each Fleet
value in its fleet_sid
property.
This example returns the aggregated usage data for each Super SIM displayed in its fleet_sid
property. In the following example, that value covers HFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
and HFbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
.
When your request sets a Group
to fleet
, the fleet_sid
property of each UsageRecords
entry returned includes a unique value for the fleet_sid
.
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function listUsageRecord() {11const usageRecords = await client.supersim.v1.usageRecords.list({12group: "fleet",13limit: 20,14});1516usageRecords.forEach((u) => console.log(u.fleetSid));17}1819listUsageRecord();
1{2"usage_records": [3{4"period": {5"start_time": "2019-05-03T00:00:00Z",6"end_time": "2019-05-04T00:00:00Z"7},8"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",9"data_upload": 150000,10"data_download": 150000,11"data_total": 300000,12"data_total_billed": "0.03",13"billed_unit": "USD",14"sim_sid": null,15"fleet_sid": "HFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",16"network_sid": null,17"iso_country": null18},19{20"period": {21"start_time": "2019-05-03T00:00:00Z",22"end_time": "2019-05-04T00:00:00Z"23},24"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",25"data_upload": 150000,26"data_download": 150000,27"data_total": 300000,28"data_total_billed": "0.03",29"billed_unit": "USD",30"sim_sid": null,31"fleet_sid": "HFbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",32"network_sid": null,33"iso_country": null34}35],36"meta": {37"first_page_url": "https://supersim.twilio.com/v1/UsageRecords?Group=fleet&PageSize=50&Page=0",38"key": "usage_records",39"next_page_url": null,40"page": 0,41"page_size": 50,42"previous_page_url": null,43"url": "https://supersim.twilio.com/v1/UsageRecords?Group=fleet&PageSize=50&Page=0"44}45}
When your request sets a Group
to network
, the network_sid
property of each UsageRecords
entry returned includes a unique value for network_sid
.
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function listUsageRecord() {11const usageRecords = await client.supersim.v1.usageRecords.list({12group: "network",13limit: 20,14});1516usageRecords.forEach((u) => console.log(u.networkSid));17}1819listUsageRecord();
1{2"usage_records": [3{4"period": {5"start_time": "2019-05-03T00:00:00Z",6"end_time": "2019-05-04T00:00:00Z"7},8"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",9"data_upload": 150000,10"data_download": 150000,11"data_total": 300000,12"data_total_billed": "0.03",13"billed_unit": "USD",14"sim_sid": null,15"fleet_sid": null,16"network_sid": "HWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",17"iso_country": null18},19{20"period": {21"start_time": "2019-05-03T00:00:00Z",22"end_time": "2019-05-04T00:00:00Z"23},24"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",25"data_upload": 150000,26"data_download": 150000,27"data_total": 300000,28"data_total_billed": "0.03",29"billed_unit": "USD",30"sim_sid": null,31"fleet_sid": null,32"network_sid": "HWbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",33"iso_country": null34}35],36"meta": {37"first_page_url": "https://supersim.twilio.com/v1/UsageRecords?Group=network&PageSize=50&Page=0",38"key": "usage_records",39"next_page_url": null,40"page": 0,41"page_size": 50,42"previous_page_url": null,43"url": "https://supersim.twilio.com/v1/UsageRecords?Group=network&PageSize=50&Page=0"44}45}
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function listUsageRecord() {11const usageRecords = await client.supersim.v1.usageRecords.list({12group: "isoCountry",13limit: 20,14});1516usageRecords.forEach((u) => console.log(u.isoCountry));17}1819listUsageRecord();
1{2"usage_records": [3{4"period": {5"start_time": "2019-05-03T00:00:00Z",6"end_time": "2019-05-04T00:00:00Z"7},8"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",9"data_upload": 150000,10"data_download": 150000,11"data_total": 300000,12"data_total_billed": "0.03",13"billed_unit": "USD",14"sim_sid": null,15"fleet_sid": null,16"network_sid": null,17"iso_country": "FR"18},19{20"period": {21"start_time": "2019-05-03T00:00:00Z",22"end_time": "2019-05-04T00:00:00Z"23},24"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",25"data_upload": 150000,26"data_download": 150000,27"data_total": 300000,28"data_total_billed": "0.03",29"billed_unit": "USD",30"sim_sid": null,31"fleet_sid": null,32"network_sid": null,33"iso_country": "US"34}35],36"meta": {37"first_page_url": "https://supersim.twilio.com/v1/UsageRecords?Group=isoCountry&PageSize=50&Page=0",38"key": "usage_records",39"next_page_url": null,40"page": 0,41"page_size": 50,42"previous_page_url": null,43"url": "https://supersim.twilio.com/v1/UsageRecords?Group=isoCountry&PageSize=50&Page=0"44}45}
When your request sets a Group
to isoCountry
, the iso_country
property of each UsageRecords
entry returned includes a unique value for the iso_country
.
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function listUsageRecord() {11const usageRecords = await client.supersim.v1.usageRecords.list({12group: "sim",13limit: 20,14});1516usageRecords.forEach((u) => console.log(u.simSid));17}1819listUsageRecord();
1{2"usage_records": [3{4"period": {5"start_time": "2019-05-03T00:00:00Z",6"end_time": "2019-05-04T00:00:00Z"7},8"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",9"data_upload": 150000,10"data_download": 150000,11"data_total": 300000,12"data_total_billed": "0.03",13"billed_unit": "USD",14"sim_sid": "HSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",15"fleet_sid": null,16"network_sid": null,17"iso_country": "FR"18},19{20"period": {21"start_time": "2019-05-03T00:00:00Z",22"end_time": "2019-05-04T00:00:00Z"23},24"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",25"data_upload": 150000,26"data_download": 150000,27"data_total": 300000,28"data_total_billed": "0.03",29"billed_unit": "USD",30"sim_sid": "HSbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",31"fleet_sid": null,32"network_sid": null,33"iso_country": "FR"34}35],36"meta": {37"first_page_url": "https://supersim.twilio.com/v1/UsageRecords?IsoCountry=FR&Group=sim&PageSize=50&Page=0",38"key": "usage_records",39"next_page_url": null,40"page": 0,41"page_size": 50,42"previous_page_url": null,43"url": "https://supersim.twilio.com/v1/UsageRecords?IsoCountry=FR&Group=sim&PageSize=50&Page=0"44}45}
Private beta users might experience different behavior. To prevent disrupting your application by changing the expected response from the API, Twilio added flags added to your account. This section explains these changes.
If you used this API before the StartTime
and EndTime
request parameters requirements, Twilio added a flag to your account. This flag kept your app returning a 200 response instead of throwing an exception. When Twilio accepted your request, the timestamps used to request data from our systems were transformed as described in the following sections. To ensure that data returned matches your request parameters, our team may contact you to adjust your application.
If your StartTime
and EndTime
values don't fall on a UTC hour boundary, values round up to the next UTC hour.
You make a UsageRecords
API call with the following parameters and values:
Granularity
=hour
StartTime
=2021-07-01T00:30:00Z
(July 1, 2021 12:30am UTC)EndTime
=2021-07-01T10:30:00Z
(July 1, 2021 10:30am UTC)The call returns usage data from 1:00am UTC to 11:00am UTC.
To ensure that you receive the expected results, make all requests with Granularity=hour
with StartTime
and EndTime
values that fall on a UTC hour boundary (like StartTime=2021-07-01T00:00:00Z
).
If your StartTime
and EndTime
values don't fall on a UTC day boundary, values round up to the next UTC day.
You make a UsageRecords
API call with the following parameters and values:
Granularity
=day
StartTime
=2021-07-01T00:30:00Z
(July 1, 2021 12:30am UTC)EndTime
=2021-07-15T14:00:00Z
(July 15, 2021 2:00pm UTC)The call returns usage data from the start of July 2 through the end of July 15.
To ensure that you receive the expected results, make all requests with Granularity=day
with StartTime
and EndTime
values that fall on midnight UTC like EndTime=2021-07-16T00:00:00Z
.
Account Usage requests return different results depending on the duration between StartTime
and EndTime
values.
StartTime
and EndTime
values differ by less than one hour, the API call aggregates all raw usage records.StartTime
and EndTime
parameters differ by more than one hour, both the StartTime
and EndTime
parameters round up to the nearest UTC hour as described in the previous section.To receive your expected results, make all Account Usage requests with StartTime
and EndTime
values that fall on a UTC hour boundary.