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

# Install a physical eSIM on a device

> Installs the eSIM's activation code onto a device. `deviceId` is optional — omit it to use an available device from the pool. This call is asynchronous: it returns 202 with `{esim, operationId, statusUrl}` immediately, and the result is available by polling `GET /esims/{id}/install-status`. Retrying with the same request is safe if a response is lost.

Returns 409 when the eSIM is not in the `owned` state, or when no device is currently available (see `reason`). When rent-first billing is enabled, a BYO eSIM whose rent isn't active returns 402 with `{esim, rentStatus, checkoutUrl}` instead.



## OpenAPI

````yaml /api-reference/mobilerun-numbers.yaml post /numbers/esims/{id}/install
openapi: 3.1.0
info:
  title: Mobilerun Numbers
  version: v1
servers:
  - description: Droidrun Cloud API
    url: https://api.mobilerun.ai/v1
security:
  - bearerAuth: []
paths:
  /numbers/esims/{id}/install:
    post:
      tags:
        - Esims
      summary: Install a physical eSIM on a device
      description: >-
        Installs the eSIM's activation code onto a device. `deviceId` is
        optional — omit it to use an available device from the pool. This call
        is asynchronous: it returns 202 with `{esim, operationId, statusUrl}`
        immediately, and the result is available by polling `GET
        /esims/{id}/install-status`. Retrying with the same request is safe if a
        response is lost.


        Returns 409 when the eSIM is not in the `owned` state, or when no device
        is currently available (see `reason`). When rent-first billing is
        enabled, a BYO eSIM whose rent isn't active returns 402 with `{esim,
        rentStatus, checkoutUrl}` instead.
      operationId: installEsim
      parameters:
        - in: path
          name: id
          required: true
          schema:
            example: 550e8400-e29b-41d4-a716-446655440000
            format: uuid
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InstallEsimInput'
      responses:
        '201':
          content:
            application/json:
              schema:
                properties:
                  data:
                    $ref: '#/components/schemas/PublicEsim'
                required:
                  - data
                type: object
          description: eSIM installed (the device resolved `active`)
        '202':
          content:
            application/json:
              schema:
                properties:
                  data:
                    $ref: '#/components/schemas/EsimInstallPendingResponse'
                required:
                  - data
                type: object
          description: >-
            Install accepted but not yet resolved to `active` — poll `GET
            /esims/{id}/install-status` after `Retry-After` seconds
          headers:
            Retry-After:
              description: Seconds to wait before polling GET .../install-status again.
              required: true
              schema:
                description: Seconds to wait before polling GET .../install-status again.
                example: '5'
                type: string
        '400':
          description: Bad Request
        '401':
          description: Unauthorized
        '402':
          content:
            application/json:
              schema:
                properties:
                  data:
                    $ref: '#/components/schemas/EsimAwaitingPaymentResponse'
                required:
                  - data
                type: object
          description: >-
            BYO rent payment required before this eSIM can be installed — see
            `checkoutUrl` (poll `GET /esims/{id}` if `null`)
        '404':
          content:
            application/json:
              schema:
                properties:
                  error:
                    type: string
                required:
                  - error
                type: object
          description: Not Found
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EsimErrorResponse'
          description: Conflict — see `reason` for the stable, machine-readable cause
        '500':
          description: Internal Server Error
        '503':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EsimErrorResponse'
          description: >-
            Service Unavailable — esims are disabled for this deployment (see
            `reason`)
      x-codeSamples:
        - lang: JavaScript
          source: >-
            import Mobilerun from '@mobilerun/sdk';


            const client = new Mobilerun({
              apiKey: process.env['MOBILERUN_CLOUD_API_KEY'], // This is the default and can be omitted
            });


            const response = await
            client.esims.install('550e8400-e29b-41d4-a716-446655440000');


            console.log(response.data);
        - lang: Python
          source: |-
            import os
            from mobilerun_sdk import Mobilerun

            client = Mobilerun(
                api_key=os.environ.get("MOBILERUN_CLOUD_API_KEY"),  # This is the default and can be omitted
            )
            response = client.esims.install(
                id="550e8400-e29b-41d4-a716-446655440000",
            )
            print(response.data)
components:
  schemas:
    InstallEsimInput:
      properties:
        deviceId:
          description: >-
            physedge device id to install the eSIM onto; omit for a random pool
            device
          example: physedge-dev-8f3a2c
          minLength: 1
          type: string
      type: object
    PublicEsim:
      properties:
        cancellationScheduled:
          type: boolean
        carrierName:
          type:
            - string
            - 'null'
        checkoutUrl:
          type:
            - string
            - 'null'
        countryCode:
          type:
            - string
            - 'null'
        createdAt:
          format: date-time
          type:
            - string
            - 'null'
        createdBy:
          type:
            - string
            - 'null'
        currentPeriodEnd:
          format: date-time
          type:
            - string
            - 'null'
        deviceId:
          format: uuid
          type:
            - string
            - 'null'
        deviceUuid:
          type:
            - string
            - 'null'
        exempt:
          type: boolean
        iccid:
          type:
            - string
            - 'null'
        id:
          format: uuid
          type: string
        msisdn:
          type:
            - string
            - 'null'
        name:
          type:
            - string
            - 'null'
        networkStatus:
          enum:
            - degraded
            - null
          type:
            - string
            - 'null'
        rentStatus:
          enum:
            - not_applicable
            - exempt
            - inactive
            - awaiting_payment
            - active
            - cancel_pending
            - refund_pending
            - retiring
            - billing_error
          type: string
        source:
          enum:
            - stocked
            - byo
          type: string
        status:
          enum:
            - in_stock
            - owned
            - installing
            - installed
            - install_failed
            - retired
          type: string
        subscriptionId:
          type:
            - integer
            - 'null'
        updatedAt:
          format: date-time
          type:
            - string
            - 'null'
      required:
        - id
        - status
        - source
        - carrierName
        - countryCode
        - iccid
        - subscriptionId
        - deviceId
        - deviceUuid
        - msisdn
        - name
        - createdBy
        - networkStatus
        - createdAt
        - updatedAt
      type: object
    EsimInstallPendingResponse:
      properties:
        esim:
          $ref: '#/components/schemas/PublicEsim'
        operationId:
          type:
            - string
            - 'null'
        statusUrl:
          type: string
      required:
        - esim
        - operationId
        - statusUrl
      type: object
    EsimAwaitingPaymentResponse:
      properties:
        checkoutUrl:
          type:
            - string
            - 'null'
        esim:
          $ref: '#/components/schemas/PublicEsim'
        rentStatus:
          enum:
            - awaiting_payment
          type: string
      required:
        - esim
        - rentStatus
        - checkoutUrl
      type: object
    EsimErrorResponse:
      properties:
        message:
          type: string
        reason:
          enum:
            - out_of_stock
            - owner_esim_cap
            - byo_disabled
            - byo_esim_cap
            - byo_daily_import_limit
            - byo_failed_limit
            - esim_not_owned
            - device_pool_empty
            - device_claim_cap
            - operator_resolution_required
            - idempotency_conflict
            - byo_awaiting_payment_cap
            - operator_review_required
            - byo_not_reassignable
            - product_disabled
          type: string
        success:
          enum:
            - false
          type: boolean
      required:
        - success
        - reason
        - message
      type: object
  securitySchemes:
    bearerAuth:
      bearerFormat: Opaque
      description: Bearer token via Authorization header
      scheme: bearer
      type: http

````