Skip to contentSkip to navigationSkip to topbar
On this page

Wireless Sim Resource


A Sim resource represents a physical SIM that can connect to a wireless network.

(information)

Info

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.

(warning)

Warning

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.


Asynchronous resources

asynchronous-resources page anchor

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.


Property nameTypeRequiredDescriptionChild properties
sidSID<DE>

Optional

Not PII

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

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

unique_namestring

Optional

PII MTL: 30 days

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.


account_sidSID<AC>

Optional

The SID of the Account to which the Sim resource belongs.

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

rate_plan_sidSID<WP>

Optional

The SID of the RatePlan resource to which the Sim resource is assigned.

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

friendly_namestring

Optional

The string that you assigned to describe the Sim resource.


e_idstring

Optional

Deprecated.


statusenum<string>

Optional

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.

Possible values:
newreadyactivesuspendeddeactivatedcanceledscheduledupdating

reset_statusenum<string>

Optional

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.

Possible values:
resetting

commands_callback_urlstring<uri>

Optional

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.


commands_callback_methodenum<http-method>

Optional

The HTTP method we use to call commands_callback_url. Can be: POST or GET. Default is POST.

Possible values:
GETPOST

sms_fallback_methodenum<http-method>

Optional

Deprecated.

Possible values:
GETPOST

sms_fallback_urlstring<uri>

Optional

Deprecated.


sms_methodenum<http-method>

Optional

Deprecated.

Possible values:
GETPOST

sms_urlstring<uri>

Optional

Deprecated.


voice_fallback_methodenum<http-method>

Optional

Deprecated. The HTTP method we use to call voice_fallback_url. Can be: GET or POST. Default is POST.

Possible values:
GETPOST

voice_fallback_urlstring<uri>

Optional

Deprecated. The URL we call using the voice_fallback_method when an error occurs while retrieving or executing the TwiML requested from voice_url.


voice_methodenum<http-method>

Optional

Deprecated. The HTTP method we use to call voice_url. Can be: GET or POST. Default is POST.

Possible values:
GETPOST

voice_urlstring<uri>

Optional

Deprecated. The URL we call using the voice_method when the SIM-connected device makes a voice call.


date_createdstring<date-time>

Optional

The date and time in GMT when the resource was created specified in ISO 8601(link takes you to an external page) format.


date_updatedstring<date-time>

Optional

The date and time in GMT when the Sim resource was last updated specified in ISO 8601(link takes you to an external page) format.


urlstring<uri>

Optional

The absolute URL of the resource.


linksobject<uri-map>

Optional

The URLs of related subresources.


ip_addressstring

Optional

Deprecated.

Status Values

status-values page anchor

The table below describes the available status values of a SIM represented by a Sim instance.

StatusDescription
newThe 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.
readyThe 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.
activeThe SIM can connect to the network and is capable of consuming network resources in accordance with its Rate Plan.
suspendedThe 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.
deactivatedThe 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.
canceledTerminal status. The SIM is blocked from connecting to the network and can never be reactivated.
scheduledThe 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.
updatingThe 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.

Property nameTypeRequiredPIIDescription
Sidstringrequired

The SID or the unique_name of the Sim resource to fetch.

Fetch a Sim resourceLink to code sample: Fetch a Sim resource
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 fetchSim() {
11
const sim = await client.wireless.v1.sims("Sid").fetch();
12
13
console.log(sim.sid);
14
}
15
16
fetchSim();

Output

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/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 fetchSim() {
11
const sim = await client.wireless.v1.sims("AliceSmithSmartMeter").fetch();
12
13
console.log(sim.uniqueName);
14
}
15
16
fetchSim();

Output

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
}

Read multiple Sim resources

read-multiple-sim-resources page anchor
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.

Property nameTypeRequiredPIIDescription
Statusenum<string>

Optional

Only return Sim resources with this status.

Possible values:
newreadyactivesuspendeddeactivatedcanceledscheduledupdating

Iccidstring

Optional

Only return Sim resources with this ICCID. This will return a list with a maximum size of 1.


RatePlanstring

Optional

The SID or unique name of a RatePlan resource. Only return Sim resources assigned to this RatePlan resource.


EIdstring

Optional

Deprecated.


SimRegistrationCodestring

Optional

Only return Sim resources with this registration code. This will return a list with a maximum size of 1.


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.

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 listSim() {
11
const sims = await client.wireless.v1.sims.list({ limit: 20 });
12
13
sims.forEach((s) => console.log(s.sid));
14
}
15
16
listSim();

Output

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.

Property nameTypeRequiredPIIDescription
Sidstringrequired

The SID or the unique_name of the Sim resource to update.

Encoding type:application/x-www-form-urlencoded
SchemaExample
Property nameTypeRequiredDescriptionChild properties
UniqueNamestring

Optional

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.


CallbackMethodenum<http-method>

Optional

The HTTP method we should use to call callback_url. Can be: POST or GET. The default is POST.

Possible values:
GETPOST

CallbackUrlstring<uri>

Optional

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).


FriendlyNamestring

Optional

A descriptive string that you create to describe the Sim resource. It does not need to be unique.


RatePlanstring

Optional

The SID or unique name of the RatePlan resource to which the Sim resource should be assigned.


Statusenum<string>

Optional

The new status of the Sim resource. Can be: ready, active, suspended, or deactivated.

Possible values:
newreadyactivesuspendeddeactivatedcanceledscheduledupdating

CommandsCallbackMethodenum<http-method>

Optional

The HTTP method we should use to call commands_callback_url. Can be: POST or GET. The default is POST.

Possible values:
GETPOST

CommandsCallbackUrlstring<uri>

Optional

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.


SmsFallbackMethodenum<http-method>

Optional

The HTTP method we should use to call sms_fallback_url. Can be: GET or POST. Default is POST.

Possible values:
GETPOST

SmsFallbackUrlstring<uri>

Optional

The URL we should call using the sms_fallback_method when an error occurs while retrieving or executing the TwiML requested from sms_url.


SmsMethodenum<http-method>

Optional

The HTTP method we should use to call sms_url. Can be: GET or POST. Default is POST.

Possible values:
GETPOST

SmsUrlstring<uri>

Optional

The URL we should call using the sms_method when the SIM-connected device sends an SMS message that is not a Command.


VoiceFallbackMethodenum<http-method>

Optional

Deprecated.

Possible values:
GETPOST

VoiceFallbackUrlstring<uri>

Optional

Deprecated.


VoiceMethodenum<http-method>

Optional

Deprecated.

Possible values:
GETPOST

VoiceUrlstring<uri>

Optional

Deprecated.


ResetStatusenum<string>

Optional

Initiate a connectivity reset on the SIM. Set to resetting to initiate a connectivity reset on the SIM. No other value is valid.

Possible values:
resetting

AccountSidstring

Optional

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/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 updateSim() {
11
const sim = await client.wireless.v1.sims("Sid").update({
12
callbackMethod: "POST",
13
callbackUrl:
14
"https://sim-manager.mycompany.com/sim-update-callback/AliceSmithSmartMeter",
15
status: "active",
16
});
17
18
console.log(sim.uniqueName);
19
}
20
21
updateSim();

Output

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.

ParameterDescription
SimSidThe SID of the SIM that this callback is in reference to.
SimUniqueNameThe SIM's UniqueName, if it has one.
SimStatusAn updated string representing the new status of the SIM.
ErrorCodeIf an error occurred, an error code is provided.
ErrorMessageIf an error occurred, an error message is provided.
ApiVersionThe version of the API that your initial request was made to.
AccountSidThe 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.

Move SIMs between Subaccounts

move-sims-between-subaccounts page anchor

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:

  • From the master account to a subaccount.
  • From a subaccount to the master account.
  • From a subaccount to another subaccount.
(warning)

Warning

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.

Reset a SIM's connectivity

reset-a-sims-connectivity page anchor

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.

Property nameTypeRequiredPIIDescription
Sidstringrequired

The SID or the unique_name of the Sim resource to delete.

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 deleteSim() {
11
await client.wireless.v1.sims("Sid").remove();
12
}
13
14
deleteSim();

View SIM lifecycle events

view-sim-lifecycle-events page anchor

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
}

Need some help?

Terms of service

Copyright © 2024 Twilio Inc.