> ## Documentation Index
> Fetch the complete documentation index at: https://help.withallo.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Obtenir le code d'activation d'une eSIM

> 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 with `ESIM_NOT_READY`. Requires the `PARTNER` scope.

<Note>
  **Scope requis :** `PARTNER`
</Note>

Renvoie ce dont votre client a besoin pour installer une eSIM prête sur son téléphone : le code d'activation complet (`lpa`), ses deux parties (`smdp_address` et `matching_id`) et un QR code. Tant que l'eSIM n'est pas prête, la requête échoue avec `409 ESIM_NOT_READY`. Attendez le webhook [`partner.esim.ready`](/fr/v2/api-reference/webhooks/event-catalog#partneresimready), ou le statut `ACTIVE` sur [Obtenir une eSIM](/fr/v2/api-reference/partner/get-esim).

Le code d'activation n'est jamais envoyé dans un webhook. Récupérez-le au moment de remettre l'eSIM à votre client.

<Warning>
  Toute personne qui installe l'eSIM avec ce code prend le contrôle de la ligne. Envoyez-le uniquement à votre client.
</Warning>

## Champs de la réponse

| Champ | Description |
| - | - |
| `lpa` | Le code d'activation complet, au format `LPA:1$<smdp_address>$<matching_id>` |
| `smdp_address` | L'adresse SM-DP+, pour la saisie manuelle |
| `matching_id` | Le code d'activation, pour la saisie manuelle |
| `qr_code` | Une data URI PNG d'un QR code qui encode `lpa`. Utilisez-la comme `src` d'une balise `<img>`. |

## Comment remettre l'eSIM à votre client

Donnez à votre client l'une de ces options, selon son téléphone :

* **QR code** : affichez `qr_code`. Votre client le scanne depuis les réglages eSIM de son téléphone.
* **Android, saisie manuelle** : donnez `smdp_address` et `matching_id`. Votre client les saisit dans les réglages eSIM de son téléphone.
* **iPhone (iOS 17.4 et versions ultérieures), lien d'installation** : construisez un lien à partir de `lpa`. Votre client l'ouvre sur l'iPhone et l'eSIM s'installe en un geste.

Le lien iPhone est `https://esimsetup.apple.com/esim_qrcode_provisioning?carddata=` suivi de `lpa` encodé pour une URL. Les caractères `$` et `:` doivent être encodés.

<Tabs>
  <Tab title="JavaScript">
    ```javascript theme={null}
    const { lpa } = activationCode;
    const link =
      "https://esimsetup.apple.com/esim_qrcode_provisioning?carddata=" +
      encodeURIComponent(lpa);
    ```
  </Tab>

  <Tab title="Python">
    ```python theme={null}
    from urllib.parse import quote

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

Votre client doit se trouver en France au moment d'activer l'eSIM. Consultez [eSIM (France)](/fr/phone-numbers/esim) pour les étapes d'installation sur chaque téléphone.

Allo ne détecte pas l'installation de l'eSIM sur le téléphone. La ligne sonne déjà sur l'eSIM dès qu'elle est prête.

## Erreurs

| Code | Signification |
| - | - |
| `ESIM_NOT_READY` | L'eSIM n'est pas encore prête à installer. Toujours `retryable: true`. |
| `PARTNER_ESIM_NOT_FOUND` | Aucune eSIM avec cet id n'a été commandée sur un compte créé par votre clé API. |
| `ESIM_UNAVAILABLE` | Le code d'activation ne peut pas être lu pour le moment. Réessayez plus tard. |


## OpenAPI

````yaml GET /v2/api/partner/esims/{id}/activation_code
openapi: 3.0.3
info:
  title: Allo API
  description: >-
    Allo API provides programmatic access to your Allo account, allowing you to
    manage webhooks, retrieve calls and contacts, and send SMS messages.


    All requests to `/v1/api/**` endpoints automatically go through quota
    checking and scope validation.
  version: 1.0.0
  contact:
    name: Allo Support
servers:
  - url: https://api.withallo.com
    description: Production server
security: []
tags:
  - name: Summary Templates
    description: >-
      Manage call summary templates that control how AI-generated call summaries
      are structured for your team.
  - name: Webhooks
    description: >-
      Manage webhook endpoints to receive real-time notifications about events
      in your Allo account. Each endpoint subscribes to one or more event topics
      and is verified with a signing secret.
  - name: Calls
    description: >-
      Retrieve and search call records with filtering and pagination. Filter
      calls by your Allo phone number.
  - name: Contacts
    description: >-
      Search and retrieve contact information with sorting and pagination.
      Includes engagement level tracking.
  - name: SMS
    description: Send SMS messages to phone numbers using your Allo numbers.
  - name: Phone Numbers
    description: Retrieve information about your Allo phone numbers.
  - name: Analytics
    description: Pre-computed call metrics, team performance, and outbound dial funnel
  - name: CRM
    description: Manage people, companies, and deals in your CRM.
  - name: Notes
    description: >-
      Internal team notes on conversations and CRM people, with @mention
      support. Notes are never visible to the contact.
  - name: Threads
    description: >-
      Team discussion threads attached to a conversation item (call, SMS, or
      conversation note). One thread per item.
  - name: AI Receptionist
    description: >-
      Read and write the AI receptionist configuration of a phone line: business
      details, voice, prompt, capabilities, business hours, transfer rules,
      scheduling calendars and knowledge sources.
paths:
  /v2/api/partner/esims/{id}/activation_code:
    get:
      tags:
        - Partner
      summary: Get eSIM activation code
      description: >-
        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 with `ESIM_NOT_READY`. Requires the `PARTNER` scope.
      operationId: getPartnerEsimActivationCode
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
          description: The eSIM id returned by Order eSIM (`eso-*`).
      responses:
        '200':
          description: Activation code
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      lpa:
                        type: string
                        description: >-
                          Full activation code,
                          `LPA:1$<smdp_address>$<matching_id>`.
                        example: LPA:1$smdp.example.com$ABCD-1234-EFGH-5678
                      smdp_address:
                        type: string
                        description: SM-DP+ address, for manual entry on Android.
                        example: smdp.example.com
                      matching_id:
                        type: string
                        description: >-
                          Matching id (activation code), for manual entry on
                          Android.
                        example: ABCD-1234-EFGH-5678
                      qr_code:
                        type: string
                        description: PNG data URI of a QR code that encodes `lpa`.
                        example: data:image/png;base64,iVBORw0KGgo...
              example:
                data:
                  lpa: LPA:1$smdp.example.com$ABCD-1234-EFGH-5678
                  smdp_address: smdp.example.com
                  matching_id: ABCD-1234-EFGH-5678
                  qr_code: data:image/png;base64,iVBORw0KGgo...
        '401':
          $ref: '#/components/responses/ApiUnauthorized'
        '403':
          description: The API key lacks the PARTNER scope.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
        '404':
          description: >-
            No eSIM with this id was ordered on an account your API key
            provisioned (PARTNER_ESIM_NOT_FOUND).
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
        '409':
          description: >-
            The eSIM is not ready to install yet (ESIM_NOT_READY). Wait for the
            `partner.esim.ready` webhook.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
        '429':
          $ref: '#/components/responses/ApiRateLimited'
        '500':
          description: The activation code cannot be read right now (ESIM_UNAVAILABLE).
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
      security:
        - ApiKeyAuth: []
components:
  responses:
    ApiUnauthorized:
      description: Invalid or missing API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    ApiRateLimited:
      description: Rate limit exceeded
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
  schemas:
    ApiError:
      type: object
      properties:
        error:
          type: object
          properties:
            type:
              type: string
            code:
              type: string
            message:
              type: string
            retryable:
              type: boolean
            request_id:
              type: string
            retry_after_seconds:
              type: integer
              nullable: true
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.