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

# Purchase eSIM

> Buy a travel eSIM after listing packages on List billers. `packageId` must be the package UUID (`id`), never `packageCode`. Scope: `vas:write`. Requires `Idempotency-Key`.

> [!NOTE]
>
> Part of **VAS**. Discover destinations and packages with **List billers** first, then call this endpoint.

**1. Pick a destination**

`GET /api/v1/merchant/vas/billers?category=esim` → choose a `locationCode` (e.g. `NG`).

**2. Pick a package**

`GET /api/v1/merchant/vas/billers?category=esim&locationCode=NG` → copy `packages[].id` (UUID).

**3. Purchase**

`POST /api/v1/merchant/vas/esim` with that UUID as `packageId`, customer fields, `deviceType`, and an `Idempotency-Key`.

> [!WARNING]
>
> `packageCode` values like `P0Q24KI1C` are **not** valid `packageId`s and will fail. Always use the UUID `id` from the billers response.

> [!NOTE]
>
> **Pricing:** the package `price` from List billers is in USD. Your NGN wallet is debited the equivalent at the current rate — `details.amount` in the response is the NGN amount charged.

> [!NOTE]
>
> Sample below uses the cheapest Nigeria package from the live catalog (`Nigeria 100MB 7Days`, `price` 0.7755 USD).


## OpenAPI

````yaml POST /api/v1/merchant/vas/esim
openapi: 3.1.0
info:
  title: SendPadi Merchant API
  version: 1.0.0
  description: >-
    Merchant REST API. Authenticate with HMAC headers (`X-Api-Key`,
    `X-Timestamp`, `X-Signature`). Generate playground headers with [Sign
    requests (playground)](/guides/sign-requests).
servers:
  - url: https://api.sendpadi.com
    description: Production (test + live keys)
security: []
paths:
  /api/v1/merchant/vas/esim:
    post:
      tags:
        - vas
      summary: Purchase eSIM
      description: >-
        Buy a travel eSIM after listing packages on List billers. `packageId`
        must be the package UUID (`id`), never `packageCode`. **Scope:**
        `vas:write`. Requires `Idempotency-Key` on this write.
      operationId: api-reference_esim_purchase-esim
      parameters:
        - name: X-Timestamp
          in: header
          required: true
          description: Unix time in seconds
          schema:
            type: string
        - name: X-Signature
          in: header
          required: true
          description: HMAC-SHA256 signature
          schema:
            type: string
        - name: Idempotency-Key
          in: header
          required: true
          description: UUID. Required on money-moving writes.
          schema:
            type: string
            format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                packageId:
                  type: string
                  description: >-
                    UUID from List billers → `data.esim.packages[].id` (e.g.
                    after `category=esim&locationCode=NG`). Not `packageCode`.
                  format: uuid
                customerName:
                  type: string
                customerPhone:
                  type: string
                customerEmail:
                  type: string
                deviceType:
                  type: string
                  enum:
                    - SMARTPHONE
                    - TABLET
                    - LAPTOP
                    - WATCH
                  description: Device that will install the eSIM profile
              required:
                - packageId
                - customerName
                - customerPhone
                - customerEmail
                - deviceType
            example:
              packageId: 129285fd-553a-455e-a1f8-8f0d79d30aad
              customerName: Jane Doe
              customerPhone: +234********34
              customerEmail: user@example.com
              deviceType: SMARTPHONE
      responses:
        '201':
          description: OK
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
              example:
                success: true
                data:
                  transactionId: vas_esim_001
                  reference: ESIM-vas_esim_001
                  status: COMPLETED
                  message: 'eSIM activated successfully. Package: Nigeria 100MB 7Days'
                  details:
                    orderNo: B**************
                    packageName: Nigeria 100MB 7Days
                    dataSize: 100.00 MB
                    validity: 7 days
                    amount: 1082
                    profit: 426
                    currency: NGN
                    esimProfile: null
                    activationDetails: null
                    estimatedActivationTime: Activated
              examples:
                success:
                  summary: Success
                  value:
                    success: true
                    data:
                      transactionId: vas_esim_001
                      reference: ESIM-vas_esim_001
                      status: COMPLETED
                      message: >-
                        eSIM activated successfully. Package: Nigeria 100MB
                        7Days
                      details:
                        orderNo: B**************
                        packageName: Nigeria 100MB 7Days
                        dataSize: 100.00 MB
                        validity: 7 days
                        amount: 1082
                        profit: 426
                        currency: NGN
                        esimProfile: null
                        activationDetails: null
                        estimatedActivationTime: Activated
        '400':
          description: Invalid packageCode (use UUID id)
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
              examples:
                invalid_packagecode_use_uuid_id_:
                  summary: Invalid packageCode (use UUID id)
                  value:
                    success: false
                    data:
                      transactionId: null
                      reference: null
                      status: FAILED
                      message: >-
                        Internal server error occurred while processing eSIM
                        subscription
              example:
                success: false
                data:
                  transactionId: null
                  reference: null
                  status: FAILED
                  message: >-
                    Internal server error occurred while processing eSIM
                    subscription
      security:
        - ApiKeyAuth: []
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-Api-Key
      description: API key id (sp_test_… / sp_live_…)

````

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