A Sim resource represents a physical SIM that can connect to a wireless network.
To avoid ambiguity, Sim (initial cap) refers to the Sim API resource. SIM (all caps) refers to the physical Subscriber Identity Module (that is, a SIM card) associated with a Sim resource.
A Sim resource must have a Rate Plan before it can become active. The Rate Plan describes the capabilities and restrictions that apply to the SIM.
The Sim resource operates asynchronously. To receive a notification when a Sim resource has finished updating, you should provide a callback URL and a callback method with your initial HTTP request. This is demonstrated in an example below.
The unique string that we created to identify the Sim resource.
^DE[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
An application-defined string that uniquely identifies the resource. It can be used in place of the resource's sid
in the URL to address the resource.
The SID of the Account to which the Sim resource belongs.
^AC[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The SID of the RatePlan resource to which the Sim resource is assigned.
^WP[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The string that you assigned to describe the Sim resource.
The status of the Sim resource. Can be: new
, ready
, active
, deactivated
, canceled
, deleted
, scheduled
, or updating
. See Status Values for the description of each status.
new
ready
active
suspended
deactivated
canceled
scheduled
updating
The connectivity reset status of the SIM. Can be: null or resetting
. When a connectivity reset is initiated on a SIM, this property is resetting
. After the reset completes, it is null.
resetting
The URL we call using the commands_callback_method
when the SIM originates a machine-to-machine Command. Your server should respond with an HTTP status code in the 200 range; any response body will be ignored.
The HTTP method we use to call commands_callback_url
. Can be: POST
or GET
. Default is POST
.
GET
POST
Deprecated. The HTTP method we use to call voice_fallback_url
. Can be: GET
or POST
. Default is POST
.
GET
POST
Deprecated. The URL we call using the voice_fallback_method
when an error occurs while retrieving or executing the TwiML requested from voice_url
.
Deprecated. The HTTP method we use to call voice_url
. Can be: GET
or POST
. Default is POST
.
GET
POST
Deprecated. The URL we call using the voice_method
when the SIM-connected device makes a voice call.
The date and time in GMT when the resource was created specified in ISO 8601 format.
The date and time in GMT when the Sim resource was last updated specified in ISO 8601 format.
Deprecated.
The table below describes the available status
values of a SIM represented by a Sim instance.
Status | Description |
---|---|
new | The SIM is waiting to be activated so that it can join the network. A Sim can remain new indefinitely at no charge, but once it becomes ready or active , it cannot be returned to new . |
ready | The SIM can connect to the network and is capable of consuming network resources in accordance with its Rate Plan , but no monthly fee will be charged .Once the SIM has consumed 250KB of data, or three months have passed, the SIM will transition automatically to active status. On the fifth Command sent to_sim or from_sim , the device will automatically become active .Use the ready status when shipping your device to a customer if you aren't exactly sure when they will start using it.Note This status is not available for the Narrowband developer plan. |
active | The SIM can connect to the network and is capable of consuming network resources in accordance with its Rate Plan . |
suspended | The SIM is blocked from connecting to the network. After three months of suspension at no charge, a suspended monthly fee will be initiated. See Suspended SIM Fees in Programmable Wireless Pricing for more details. |
deactivated | The SIM is blocked from connecting to the network. After 72 hours, the SIM will transition automatically to the terminal status canceled . Use this status when you never want the SIM to reconnect — for example, if it has been lost or stolen. |
canceled | Terminal status. The SIM is blocked from connecting to the network and can never be reactivated. |
scheduled | The upstream network operator is temporarily unable to update the status of this SIM. Its status will be automatically updated to the requested status when the upstream network operator resumes accepting transactions. |
updating | The SIM is in the process of being asynchronously updated. While the Sim is updating, it may not be possible to modify some fields. In these cases, you will receive a 409 Conflict response. |
GET https://wireless.twilio.com/v1/Sims/{Sid}
The {Sid}
parameter can be the SID or the UniqueName
property of the Sim resource that you want to fetch.
The SID or the unique_name
of the Sim resource to fetch.
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 fetchSim() {11const sim = await client.wireless.v1.sims("Sid").fetch();1213console.log(sim.sid);14}1516fetchSim();
1{2"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"unique_name": "unique_name",4"commands_callback_method": "POST",5"commands_callback_url": "http://www.example.com",6"date_created": "2015-07-30T20:00:00Z",7"date_updated": "2015-07-30T20:00:00Z",8"friendly_name": "friendly_name",9"sms_fallback_method": "POST",10"sms_fallback_url": "http://www.example.com",11"sms_method": "POST",12"sms_url": "http://www.example.com",13"voice_fallback_method": "POST",14"voice_fallback_url": "http://www.example.com",15"voice_method": "POST",16"voice_url": "http://www.example.com",17"links": {18"data_sessions": "https://wireless.twilio.com/v1/Sims/DEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/DataSessions",19"rate_plan": "https://wireless.twilio.com/v1/RatePlans/WPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",20"usage_records": "https://wireless.twilio.com/v1/Sims/DEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/UsageRecords"21},22"rate_plan_sid": "WPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",23"sid": "Sid",24"iccid": "iccid",25"e_id": "e_id",26"status": "new",27"reset_status": null,28"url": "https://wireless.twilio.com/v1/Sims/DEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",29"ip_address": "192.168.1.1"30}
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 fetchSim() {11const sim = await client.wireless.v1.sims("AliceSmithSmartMeter").fetch();1213console.log(sim.uniqueName);14}1516fetchSim();
1{2"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"unique_name": "unique_name",4"commands_callback_method": "POST",5"commands_callback_url": "http://www.example.com",6"date_created": "2015-07-30T20:00:00Z",7"date_updated": "2015-07-30T20:00:00Z",8"friendly_name": "friendly_name",9"sms_fallback_method": "POST",10"sms_fallback_url": "http://www.example.com",11"sms_method": "POST",12"sms_url": "http://www.example.com",13"voice_fallback_method": "POST",14"voice_fallback_url": "http://www.example.com",15"voice_method": "POST",16"voice_url": "http://www.example.com",17"links": {18"data_sessions": "https://wireless.twilio.com/v1/Sims/DEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/DataSessions",19"rate_plan": "https://wireless.twilio.com/v1/RatePlans/WPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",20"usage_records": "https://wireless.twilio.com/v1/Sims/DEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/UsageRecords"21},22"rate_plan_sid": "WPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",23"sid": "AliceSmithSmartMeter",24"iccid": "iccid",25"e_id": "e_id",26"status": "new",27"reset_status": null,28"url": "https://wireless.twilio.com/v1/Sims/DEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",29"ip_address": "192.168.1.1"30}
GET https://wireless.twilio.com/v1/Sims
Returns a list of SIMs within an account, each represented as a Sim instance. The list is paginated.
Only return Sim resources with this status.
new
ready
active
suspended
deactivated
canceled
scheduled
updating
Only return Sim resources with this ICCID. This will return a list with a maximum size of 1.
The SID or unique name of a RatePlan resource. Only return Sim resources assigned to this RatePlan resource.
Only return Sim resources with this registration code. This will return a list with a maximum size of 1.
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.
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 listSim() {11const sims = await client.wireless.v1.sims.list({ limit: 20 });1213sims.forEach((s) => console.log(s.sid));14}1516listSim();
1{2"sims": [],3"meta": {4"first_page_url": "https://wireless.twilio.com/v1/Sims?Status=new&Iccid=iccid&RatePlan=rate_plan&PageSize=50&Page=0",5"key": "sims",6"next_page_url": null,7"page": 0,8"page_size": 50,9"previous_page_url": null,10"url": "https://wireless.twilio.com/v1/Sims?Status=new&Iccid=iccid&RatePlan=rate_plan&PageSize=50&Page=0"11}12}
POST https://wireless.twilio.com/v1/Sims/{Sid}
The {Sid}
parameter can be the SID or the UniqueName
of the Sim resource to update.
The SID or the unique_name
of the Sim resource to update.
application/x-www-form-urlencoded
An application-defined string that uniquely identifies the resource. It can be used in place of the sid
in the URL path to address the resource.
The HTTP method we should use to call callback_url
. Can be: POST
or GET
. The default is POST
.
GET
POST
The URL we should call using the callback_url
when the SIM has finished updating. When the SIM transitions from new
to ready
or from any status to deactivated
, we call this URL when the status changes to an intermediate status (ready
or deactivated
) and again when the status changes to its final status (active
or canceled
).
A descriptive string that you create to describe the Sim resource. It does not need to be unique.
The SID or unique name of the RatePlan resource to which the Sim resource should be assigned.
The new status of the Sim resource. Can be: ready
, active
, suspended
, or deactivated
.
new
ready
active
suspended
deactivated
canceled
scheduled
updating
The HTTP method we should use to call commands_callback_url
. Can be: POST
or GET
. The default is POST
.
GET
POST
The URL we should call using the commands_callback_method
when the SIM sends a Command. Your server should respond with an HTTP status code in the 200 range; any response body is ignored.
The HTTP method we should use to call sms_fallback_url
. Can be: GET
or POST
. Default is POST
.
GET
POST
The URL we should call using the sms_fallback_method
when an error occurs while retrieving or executing the TwiML requested from sms_url
.
The HTTP method we should use to call sms_url
. Can be: GET
or POST
. Default is POST
.
GET
POST
The URL we should call using the sms_method
when the SIM-connected device sends an SMS message that is not a Command.
Initiate a connectivity reset on the SIM. Set to resetting
to initiate a connectivity reset on the SIM. No other value is valid.
resetting
The SID of the Account to which the Sim resource should belong. The Account SID can only be that of the requesting Account or that of a Subaccount of the requesting Account. Only valid when the Sim resource's status is new
. For more information, see the Move SIMs between Subaccounts documentation.
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 updateSim() {11const sim = await client.wireless.v1.sims("Sid").update({12callbackMethod: "POST",13callbackUrl:14"https://sim-manager.mycompany.com/sim-update-callback/AliceSmithSmartMeter",15status: "active",16});1718console.log(sim.uniqueName);19}2021updateSim();
1{2"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"unique_name": "unique_name",4"commands_callback_method": "POST",5"commands_callback_url": "http://www.example.com",6"date_created": "2015-07-30T20:00:00Z",7"date_updated": "2015-07-30T20:00:00Z",8"friendly_name": "friendly_name",9"links": {10"data_sessions": "https://wireless.twilio.com/v1/Sims/DEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/DataSessions",11"rate_plan": "https://wireless.twilio.com/v1/RatePlans/WPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",12"usage_records": "https://wireless.twilio.com/v1/Sims/DEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/UsageRecords"13},14"rate_plan_sid": "WPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",15"sid": "Sid",16"iccid": "iccid",17"e_id": "e_id",18"status": "active",19"reset_status": null,20"sms_fallback_method": "POST",21"sms_fallback_url": "http://www.example.com",22"sms_method": "POST",23"sms_url": "http://www.example.com",24"voice_fallback_method": "POST",25"voice_fallback_url": "http://www.example.com",26"voice_method": "POST",27"voice_url": "http://www.example.com",28"url": "https://wireless.twilio.com/v1/Sims/DEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",29"ip_address": "192.168.1.30"30}
If a callback URL is present in your request, the asynchronous request made to that URL will contain the following parameters.
Parameter | Description |
---|---|
SimSid | The SID of the SIM that this callback is in reference to. |
SimUniqueName | The SIM's UniqueName, if it has one. |
SimStatus | An updated string representing the new status of the SIM. |
ErrorCode | If an error occurred, an error code is provided. |
ErrorMessage | If an error occurred, an error message is provided. |
ApiVersion | The version of the API that your initial request was made to. |
AccountSid | The unique SID of the Account that this SIM belongs to. |
If the callback method was set to POST
or not provided, the callback parameters will be delivered as HTML form parameters. If the callback method was set to GET
, the callback parameters will be delivered as a query string.
If you are using Subaccounts, you can transfer new SIMs between your accounts.
While using the master account's credentials, use the AccountSid
parameter to provide the Account SID of the account you wish to own that SIM. SIMs can be moved between accounts the following ways:
If the SIM you are moving is assigned to a Rate Plan, you must also pass the SID or unique name of a Rate Plan that belongs to the new account, or null
, in the RatePlan
parameter of your Update request.
You can force your SIM to detach from the cellular network and reconnect by updating the Sim resource's ResetStatus
to resetting
.
Once the reset request is accepted by our downstream provider, the ResetStatus
will return to null
. You cannot issue another reset request while the ResetStatus
is resetting
.
DELETE https://wireless.twilio.com/v1/Sims/{Sid}
Deleting a Sim resource causes the referenced SIM to be removed from your account and placed in the terminal Canceled state, i.e., it will no longer function.
The {Sid}
parameter can be the SID or the UniqueName
of the Sim resource to be deleted.
The SID or the unique_name
of the Sim resource to delete.
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 deleteSim() {11await client.wireless.v1.sims("Sid").remove();12}1314deleteSim();
A SIM's lifecycle events are audited and reported by Monitor Events. An update to a Sim resource results in a Monitor Event with an Event Type
of wireless-sim.updated
.
The valid resource_properties
that can be reported are rate_plan_sid
and status
. For each, a previous
and updated
value may be provided. For example:
1"event_data": {2"resource_properties": {3"rate_plan_sid": {4"previous": "WP0195dea2f0b1e00dbc54d0715e36e2db",5"updated": "WP3b921b4711ee21ac01c7075a7eb19fcf"6},7"status": {8"previous": "new",9"updated": "active"10}11}12}