• Negócios
  • Guias
  • Estudos de caso
  • Remote SIM provisioning explained: SM-DP+, LPA and activation codes

Remote SIM provisioning explained: SM-DP+, LPA and activation codes

Remote SIM provisioning is the GSMA standard that lets a phone download its SIM profile over the internet. The SM-DP+ server holds the encrypted profile, the phone's LPA downloads it, and the activation code tells the LPA where it is.

Vince Vissers13 min de leitura

Remote SIM provisioning (RSP) is the GSMA system that lets a phone download a mobile operator's SIM profile over the internet instead of receiving a plastic card. On consumer devices, three parts do the work. The SM-DP+ is the server that holds the encrypted profile. The LPA is the software on the phone that fetches it. The activation code is the string that points one to the other.

You're adding eSIM to your app. Your backend orders an eSIM and gets back a string like LPA:1$smdp.example.com$K2-1A2B3C-4D5E6F. A few minutes later the customer either has working data or opens a support ticket. This guide explains what happens in between, which parts your code controls, and where the flow breaks.

In short

  • The SM-DP+ prepares the profile, encrypts it for one specific chip and delivers it.

  • The LPA is part of the phone's OS. It reads the activation code, talks to the SM-DP+ and passes the profile to the chip.

  • The activation code has three required parts: a format number, the SM-DP+ address and a matching ID that identifies the prepared profile.

  • Download, installation, enabling the profile and the line going live on the network are separate events. Track each one.

  • Your app decides how the activation code reaches the phone: QR code, manual entry, a deep link, or an in-app install if Apple or Google lets you.

Which remote SIM provisioning standard applies to you

Phones, tablets and watches use SGP.22, the GSMA's consumer eSIM specification. If you're building for people with smartphones, that's the one that matters. The GSMA maintains three RSP families, and they move control to different places:

Standard

Built for

Who starts a profile download

SGP.02

Machine-to-machine devices (older)

The operator pushes profiles to the device

SGP.22

Consumer devices: phones, tablets, watches

The user's device pulls the profile, usually from an activation code

SGP.32

IoT devices without a screen

A remote manager (the eIM) tells the device what to download

SGP.32 reuses much of the SGP.22 design but swaps the user-facing LPA for an IoT Profile Assistant (IPA) and an eSIM IoT remote manager, because a sensor in a shipping container has no one to scan a QR code. If you manage device fleets rather than people's phones, read the IoT specification instead. Everything below follows SGP.22.

The parts of a consumer eSIM system

Five parts are involved. You only touch some of them directly.

Part

What it is

Who runs it

What you control

eUICC

The secure chip in the phone that stores profiles. Each chip has a 32-digit EID.

Device maker and chip vendor

Nothing

eSIM profile

The subscription itself: the identity the network authenticates (IMSI and keys), plus its ICCID

Operator or provider

Which plan it carries

SM-DP+ (Subscription Manager Data Preparation +)

Server that creates, encrypts and delivers profiles

Operator or eSIM provider

Indirectly, through your provider's API

LPA (Local Profile Assistant)

Software on the device that downloads profiles and lets the user manage them

The OS (iOS, Android)

How you hand it the activation code

SM-DS (Subscription Manager Discovery Server)

Directory a device can query to find out which SM-DP+ has a profile waiting for it

Discovery service operators in the eSIM ecosystem

Usually nothing in an app flow

The SM-DS is worth one note. SGP.22 gives a device three ways to find its SM-DP+:

  • an activation code

  • a default SM-DP+ address preloaded on the chip

  • a lookup through the SM-DS

Carriers use the last two for flows where the phone finds its profile without the user typing anything. Apps that sell or embed eSIMs almost always use activation codes, because the code works on any eSIM-capable phone without carrier-specific setup.

How an activation code is built

An activation code is a $-separated string with three required fields and two optional ones. It's defined in section 4.1 of SGP.22:

LPA:1$smdp.example.com$K2-1A2B3C-4D5E6F$1.3.6.1.4.1.xxxx$1
│   │ │                │                │                └ Confirmation code required flag (optional)
│   │ │                │                └ SM-DP+ OID (optional)
│   │ │                └ Matching ID, also called the AC token (required)
│   │ └ SM-DP+ address (required)
│   └ Format (always 1 today)
└ Prefix used when the code is encoded as a QR code

Field

Example

What it does

LPA:

LPA:

Marks the string as an eSIM activation code. It's added for QR codes.

Format

1

The activation code format version

SM-DP+ address

smdp.example.com

The server the phone connects to

Matching ID

K2-1A2B3C-4D5E6F

Tells the SM-DP+ which prepared profile this request is for

SM-DP+ OID

(often empty)

An object identifier for the SM-DP+, which the phone can check against the server's certificate

Confirmation code flag

1

Tells the phone to ask the user for a separate confirmation code

The matching ID is the part people get wrong. It's tied to one profile download. Treat it like a single-use token: don't log it in plain text, don't put it in a URL you share in analytics, and don't show it to anyone except the customer it belongs to.

The confirmation code is a second factor some operators require before they release a profile. It isn't inside the activation code. If your provider uses one, it has to reach the customer through a separate channel, such as an email after an SMS.

There's a naming trap here too. When a customer installs manually, iOS and Android usually ask for two fields: "SM-DP+ address" and "Activation code". The "Activation code" field wants only the matching ID, not the whole LPA:1$… string. Show the two values separately, each with its own copy button.

If you need to split the string yourself, for display or for manual entry, it's a simple parse. This is illustrative TypeScript. It doesn't validate the address or OID:

ts

// Illustrative: split an SGP.22 activation code into the fields a user types.
function splitActivationCode(raw: string) {
  const ac = raw.startsWith("LPA:") ? raw.slice(4) : raw;
  const [format, smdpAddress, matchingId, smdpOid, ccFlag] = ac.split("$");
  if (format !== "1" || !smdpAddress || !matchingId) {
    throw new Error("Unsupported or incomplete activation code");
  }
  return {
    smdpAddress,                 // "SM-DP+ address" field on the device
    matchingId,                  // "Activation code" field on the device
    smdpOid: smdpOid || null,
    confirmationCodeRequired: ccFlag === "1",
  };
}

What happens when the customer installs the eSIM

The phone pulls the profile from the SM-DP+ over HTTPS, proves its identity, and receives a copy encrypted for its chip alone. Here's the sequence, simplified from SGP.22, with the interface names you'll see in specifications:

  1. Your backend orders the eSIM. The provider's SM-DP+ prepares a profile and reserves it under a matching ID. In the standard, the operator does this over the ES2+ interface (DownloadOrder, then ConfirmOrder). Your API returns the activation code. Nothing has touched a phone yet.

  2. The customer hands the code to the LPA. They scan a QR code, type the two fields, tap a deep link, or your app passes the code to the OS directly.

  3. The LPA connects to the SM-DP+ address over the ES9+ interface. This is an ordinary internet connection, so the phone needs Wi-Fi or another working data line at this point.

  4. The chip and the server authenticate each other. The SM-DP+ presents a certificate that chains up to a GSMA eSIM root certificate stored on the chip. The chip presents its own certificate, issued through its manufacturer. If either check fails, the download stops. The matching ID tells the server which reserved profile this phone is asking for. If a confirmation code is required, the user enters it now.

  5. The SM-DP+ builds a Bound Profile Package. It encrypts the profile with session keys agreed with this one chip, so the package can't be installed anywhere else. The LPA downloads it (GetBoundProfilePackage).

  6. The LPA passes the package to the chip over ES10b. The LPA can't read it. Decryption and installation happen inside the eUICC, on an end-to-end channel from the SM-DP+ (ES8+).

  7. The profile is enabled. The OS switches it on, usually after the user confirms, and the phone attaches to a network with the new identity.

  8. Notifications flow back. The chip records the result, the LPA reports it to the SM-DP+ (HandleNotification), and the operator or provider learns what happened. In a provider API, that's when your webhook fires.

Two consequences matter for your product. The profile can't be intercepted and reused, because it's bound to one chip. And step 3 needs connectivity, which is why customers should install before they lose their home data, for example before a flight.

Provisioning, installation and activation are different stages

"The eSIM is activated" can mean four different things. Treat each as its own state. Each stage happens in a different place and produces a different signal:

Stage

Where it happens

What it means

Signal in Firsty's API

Provisioned

Provider and SM-DP+

A profile is reserved and an activation code exists

status: released, lifecycleStatus: preactive

Downloaded

Phone ↔ SM-DP+

The phone has fetched the profile

esim.downloaded webhook

Installed

Inside the eUICC

The profile is stored on the chip

esim.installed

Enabled

Phone

The profile is switched on. The user has working data.

esim.enabled

Active on the network

Mobile network

The line is allowed to work

lifecycleStatus: active

Firsty's API exposes these as two state machines. status follows the profile on the device, the SM-DP+ side. lifecycleStatus follows the line on the network. They move independently.

One more clock matters for billing: a package's validity starts when it activates, not when it's bought. A 30-day plan bought in January and first used in March expires in April. Reconcile revenue against activatedAt, not the order date.

What this means for your UI: "Payment received", "eSIM ready to install", "Installed" and "Connected" are four different screens or notification states. Collapsing them into one "Activated" label is how customers end up confused about why a paid eSIM isn't showing data.

How to get the activation code onto the device

Lead with the smoothest method the device supports, and always offer manual install alongside it. Manual install works on every eSIM-capable phone. The other methods depend on OS version or platform approval:

Method

iOS

Android

Notes

QR code

Always

Always

Needs a second screen, because a phone can't scan its own display

Manual entry

Always

Always

Two fields: SM-DP+ address and matching ID

Deep link to the system installer

iOS 17.4 and later

Android 10 and later

Opens the OS's own eSIM setup with the code pre-filled. No approval needed.

In-app install

Requires Apple's eSIM entitlement

Requires your app's signing certificate on the profile's access rules

Smoothest flow, longest lead time

The deep links put the activation code in a carddata parameter:

https://esimsetup.apple.com/esim_qrcode_provisioning?carddata=<activationCode>
https://esimsetup.android.com/esim_qrcode_provisioning?carddata=<activationCode>

Check the OS version before you show the link. Below iOS 17.4 or Android 10 it doesn't work, so fall back to manual install.

In-app install hands the code straight to the LPA from your app. On iOS, that's Apple's CTCellularPlanProvisioning API, which only works for apps holding Apple's carrier-provisioning entitlement. Apple sets the timeline for that approval, not you. On Android, EuiccManager installs a profile only if your app's signing certificate hash is in that profile's access rules, so your provider has to add it. Firsty's docs cover the install methods per platform in detail, including runtime checks and fallbacks.

What fails, and what your app should do about it

Most failed installs come from a handful of causes. Each one has a fix you can design in:

What goes wrong

What the customer sees

What to build

They try to scan the QR code on the same phone

Nothing happens

Show the QR code for a second screen, with manual fields and a deep link next to it

No internet during download

Install stalls or fails

Tell customers to install on Wi-Fi before they travel or switch lines

Phone isn't eSIM-capable or is carrier-locked

"Add eSIM" missing or refused

Check compatibility before checkout

Whole LPA:1$… string pasted into "Activation code"

Invalid code error

Show the SM-DP+ address and matching ID as separate copyable fields

A download or install attempt faults

Error on the phone, then often a retry

Don't fail the order on the first fault event. Wait for a following success.

Download attempts run out

Code stops working

Issue a replacement eSIM and tell the customer why

Webhooks arrive twice or out of order

Duplicate emails, wrong status

Make the handler idempotent and treat each event on its own

Two of these are worth spelling out.

Faults aren't always final. A phone can retry a failed download on its own. In Firsty's API, an esim.faulted event followed by esim.installed means the retry worked. The exception is the fault reason download_order_expired: the download used up its attempts, and the customer needs a new eSIM. Build your support flow around that distinction instead of escalating every fault.

Webhook delivery is at-least-once. The same event can arrive twice, and ordering is best-effort. A package.activated can land before esim.enabled. Key your handler on the delivery ID, store the latest state per eSIM, and verify webhook signatures before trusting a payload. An unverified webhook endpoint is an unauthenticated write endpoint.

Most of this shows up in support volume, not error logs. The activation page your customers see does as much to stop failed installs as your backend does.

Where Firsty fits

Firsty handles the operator and SM-DP+ side of provisioning and gives you an API and webhooks for the rest. Here's the split:

Firsty handles

You implement

Preparing the profile and issuing the activation code when you order an eSIM

Delivering the code: QR, manual fields, deep link or in-app install

Network access, plans and the line's lifecycle (suspend, reactivate, terminate)

Your checkout and the moment you call the order endpoint

Status webhooks for download, install, enable and faults, signed to the Standard Webhooks spec

A webhook handler that's idempotent and verifies signatures

Adding your Android signing certificate hash to profiles, on request

Requesting Apple's eSIM entitlement for in-app install on iOS

You can try the full flow on a free test account. Sandbox eSIMs are free and return a real-shaped response with an activationCode. Their activation codes are mock data, so they won't install on a phone, and only order, package and lifecycle webhooks fire. To test an install on a real device, top up the test account (€5 minimum) and order a real eSIM. The Quickstart walks through ordering, attaching a plan and handing the code to a user.

If you're still choosing a provider, the questions in this guide double as an evaluation checklist. Does the provider expose download, install and enable as separate events? Does it support in-app install on both platforms? What happens when download attempts run out? Our guide to compare eSIM API providers covers the rest.

FAQ

What is an SM-DP+ address?

An SM-DP+ address is the domain name of the server that holds a prepared eSIM profile, such as smdp.example.com. The phone connects to it to download the profile. It's the second field of an activation code, and phones ask for it separately during manual install. For setup help on a phone, see our SM-DP+ address guide.

Is the activation code the same as the matching ID?

No. The full activation code is the whole LPA:1$address$matchingId string. The matching ID is just the token that identifies one prepared profile. Phones label the matching ID field "Activation code" during manual entry, which is why customers mix them up.

Can an eSIM activation code be used twice?

Usually not. The matching ID is tied to one profile download, and once the profile is bound to a phone's chip it can't be installed on another device. Whether a deleted profile can be downloaded again depends on the provider's SM-DP+ policy, so check before you promise customers a reinstall.

Does a phone need internet to install an eSIM?

Yes. The phone's LPA downloads the profile from the SM-DP+ over an ordinary internet connection, so it needs Wi-Fi or another working data line during install. That's why travellers should install before they leave home.

What is the LPA on an iPhone or Android phone?

The Local Profile Assistant is the part of the operating system that handles eSIM profiles. It reads activation codes, downloads profiles from the SM-DP+ and lets the user switch or delete them in settings. SGP.22 also allows the LPA to live on the eUICC chip itself, but phones run it in the OS.

What is the difference between SGP.22 and SGP.32?

SGP.22 is the GSMA's consumer eSIM specification, where the user's device pulls a profile, usually from an activation code. SGP.32 is the IoT specification for devices without a screen, where a remote manager called the eIM tells the device which profile to download. Apps for smartphone users work with SGP.22.

Order your first eSIM in five minutes

Create a free test account and run the QuickStart: pick a plan, order a sandbox eSIM and attach data. No card, no sales call.

Todos os guias