# Get eSIM activation code

> Returns the activation code of a ready eSIM: the LPA string, the SM-DP+ address, the matching id and a QR code. Before the eSIM is ready, the request fails…

`GET /v2/api/partner/esims/{id}/activation_code`

<Note>
**Required scope:** `PARTNER`
</Note>

Returns what your client needs to install a ready eSIM on their phone: the full activation code (`lpa`), its two parts (`smdp_address` and `matching_id`) and a QR code. Before the eSIM is ready, the request fails with `409 ESIM_NOT_READY`. Wait for the [`partner.esim.ready`](/docs/webhooks/event-catalog#partneresimready) webhook, or for `status: ACTIVE` on [Get eSIM](/docs/white-label/get-esim).

The activation code is never sent in a webhook. Fetch it when you deliver the eSIM to your client.

<Warning>
Anyone who installs the eSIM with this code takes over the line. Send it only to your client.
</Warning>

## Response fields

| Field | Description |
|-------|-------------|
| `lpa` | The full activation code, in the form `LPA:1$<smdp_address>$<matching_id>` |
| `smdp_address` | The SM-DP+ address, for manual entry |
| `matching_id` | The activation code, for manual entry |
| `qr_code` | A PNG data URI of a QR code that encodes `lpa`. Use it as the `src` of an `<img>` tag. |

## How to deliver the eSIM to your client

Give your client one of these, depending on their phone:

- **QR code**: show `qr_code`. Your client scans it from their phone's eSIM settings.
- **Android, manual entry**: give `smdp_address` and `matching_id`. Your client types them in their phone's eSIM settings.
- **iPhone (iOS 17.4 and later), one-tap link**: build a link from `lpa`. Your client opens it on the iPhone and the eSIM installs from there.

The iPhone link is `https://esimsetup.apple.com/esim_qrcode_provisioning?carddata=` followed by the URL-encoded `lpa`. The `$` and `:` characters must be encoded.

<Tabs>
  <Tab title="JavaScript">
    ```javascript
    const { lpa } = activationCode;
    const link =
      "https://esimsetup.apple.com/esim_qrcode_provisioning?carddata=" +
      encodeURIComponent(lpa);
    ```
  </Tab>
  <Tab title="Python">
    ```python
    from urllib.parse import quote

    lpa = activation_code["lpa"]
    link = "https://esimsetup.apple.com/esim_qrcode_provisioning?carddata=" + quote(lpa, safe="")
    ```
  </Tab>
</Tabs>

Your client must be in France when they activate the eSIM. See [eSIM (France)](/help/phone-numbers/esim) for the install steps on each phone.

Allo does not detect when the eSIM is installed on the phone. The line already rings the eSIM from the moment it is ready.

## Errors

| Code | What it means |
|------|---------------|
| `ESIM_NOT_READY` | The eSIM is not ready to install yet. Always `retryable: true`. |
| `PARTNER_ESIM_REVOKED` | The eSIM was [revoked](/docs/white-label/revoke-esim) (`409`): its activation code is no longer available. |
| `PARTNER_ESIM_NOT_FOUND` | No eSIM with this id was ordered on an account your API key created. |
| `ESIM_UNAVAILABLE` | The activation code cannot be read right now. Retry later. |
