SIMs
Learn some of the details around SIMs and how to use them with Gigs API!
The following sections assume you have an API key, your first project and familiarized your self with some basics of the Gigs API. All of this is covered by working through the introduction guide.
pSIM vs eSIM
At this time, the Gigs API supports two types of SIMs: embedded (eSIM) and physical (pSIM). A plan dictates what kind of SIMs it supports. A plan that only supports pSIMs will require you to distribute known SIMs to your users, or install them in your devices prior to shipping them out. A quick call to the plans endpoint can provide these details:
Retrieving plan details with the Gigs Core API - cURL.
curl --request "GET" \
--url "https://api.gigs.com/projects/${GIGS_PROJECT}/plans/${PLAN_ID}" \
--header "Accept: application/json" \
--header "Authorization: Bearer ${GIGS_TOKEN}"
From the above, ${GIGS_PROJECT} and ${PLAN_ID} are unique identifiers for your project and plan respectively. The ${GIGS_TOKEN} is your API key. A successful request will result in the following truncated response:
A successful plan response.
{
"object": "plan",
"id": "pln_0SNlurA049MEWV3V0q7gjQbM4EVo",
"name": "Gigs Global",
"description": "A data plan you will love! Operates in most countries of the world.",
"coverage": {
"object": "coverage",
"id": "de",
"name": "Europe",
"networks": [{"country": "DE", ...}]
},
"data": 10000000000,
"dataUnit": "byte",
"sms": 100,
"smsUnit": "message",
"voice": 30000,
"voiceUnit": "second",
"price": {...},
"provider": "p4",
"requirements": { "address": "none" },
"simTypes": ["eSIM", "pSIM"],
"status": "active",
"tags": ["smartphone", "travel"],
"validity": {...}
}
From the above plan we can see that it supports both pSIM and eSIMs in Germany (DE). You will need to have your pSIMs associated to your Gigs project before pairing them with a compatible plan. The SIMs linked to a project can be retrieved via the SIMs endpoint:
Listing project SIMs with the Gigs Core API - cURL.
curl --request "GET" \
--url "https://api.gigs.com/projects/${GIGS_PROJECT}/sims" \
--header "Accept: application/json" \
--header "Authorization: Bearer ${GIGS_TOKEN}"
An example response for requesting all SIMs linked to a specific project:
{
"object": "list",
"items": [
{
"object": "sim",
"id": "sim_0SNlurA049MEWV1BAAmWZULA4lf6",
"type": "pSIM",
"iccid": "89883070000007537119",
"provider": "p4",
"status": "inactive",
"createdAt": "2021-01-21T19:38:34Z"
}
],
"moreItemsAfter": null,
"moreItemsBefore": null
}
eSIMs do not share the same requirement of being associated to a specific project before being used. An eSIM is provisioned on demand via the Gigs API and returned to the caller. You can follow along with our guide on creating a subscription for more details regarding connectivity supplied via eSIMs.
Provisioning Time
Depending on the network provider it can take several minutes before a SIM is fully provisioned.
eSIM profile lifecycle
Every eSIM has an eSIM profile: the profile that is downloaded onto the user's device and provides connectivity there. Its status tells you how far along that process the profile is, and you can read it at any time with the retrieve an eSIM profile endpoint.
A profile typically progresses like this:
Do not rely on these state transitions. Not every network provider reports every stage, so a profile can skip one entirely, and the first status you observe is not necessarily the earliest stage in the diagram. Treat any status as a possible starting point, and handle the status you actually receive rather than the step you expect to come next.
The diagram does not include unknown, because it is not a stage that a profile passes through. It means we have no information about the profile yet, and it is listed in the table below alongside the stages.
| Status | Meaning |
|---|---|
unknown | We have no lifecycle information for this eSIM. This is the status of a newly provisioned eSIM before anything has happened to it, and it is also what you get for eSIMs on network providers that do not report profile lifecycle information. It is not an error. |
downloaded | The profile has been downloaded to the device but is not installed yet. Only some network providers report this intermediate stage; others go straight to installed. |
installed | The profile is installed on the device. This is the point at which the user has successfully added the eSIM. |
enabled | The profile is installed and switched on, so the device can use it for connectivity. |
disabled | The profile is still installed but switched off, usually because the user turned it off or switched to a different profile. It can be enabled again. |
deleted | The profile has been removed from the device. This is not necessarily final: the same profile can be installed again, which moves the status back to installed. |
status vs sim.status
An eSIM profile embeds the sim it belongs to, so the response contains two status fields that describe different things.
The profile's own status describes the profile on the user's device, as above. The nested sim.status describes the SIM record in your project and follows its own separate lifecycle.
The two move independently. In particular, a profile status of deleted means the profile was removed from the device. It says nothing about the SIM record, which may well still be active.
Events
Instead of polling the endpoint, you can subscribe to events and react to each change as it happens:
| Event | When it fires |
|---|---|
com.gigs.eSimProfile.downloaded | The profile has been downloaded to the device, but not installed yet. |
com.gigs.eSimProfile.installed | The profile has been installed on the device. |
com.gigs.eSimProfile.enabled | The profile has been switched on. |
com.gigs.eSimProfile.disabled | The profile has been switched off. |
com.gigs.eSimProfile.deleted | The profile has been removed from the device. |
com.gigs.eSimProfile.updated | Fires alongside each of the events above whenever the status changes. Its previousData contains the status the profile had before. |
A status that is reported again without having changed does not produce a new event.
Bear in mind that these events depend on the device telling the network what happened. If switching a profile off leaves the device without connectivity, com.gigs.eSimProfile.disabled can arrive noticeably later than the change itself, because the device has to regain connectivity first.
Test SIMs
We provide placeholder SIMs which allow you to test various flows in the API. See our testing guide for more information.
Follow our "Create a subscription" guide for more details regarding subscriptions.
If you have any further questions or need any assistance please reach out to support@gigs.com.