JavaScript
import Mobilerun from '@mobilerun/sdk';
const client = new Mobilerun({
apiKey: process.env['MOBILERUN_CLOUD_API_KEY'], // This is the default and can be omitted
});
await client.devices.esim.enable('deviceId', { subId: 0 });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
)
client.devices.esim.enable(
device_id="deviceId",
sub_id=0,
)package main
import (
"context"
"github.com/stainless-sdks/droidrun-cloud-go"
"github.com/stainless-sdks/droidrun-cloud-go/option"
)
func main() {
client := mobileruncloud.NewClient(
option.WithAPIKey("My API Key"),
)
err := client.Devices.Esim.Enable(
context.TODO(),
"deviceId",
mobileruncloud.DeviceEsimEnableParams{
SubID: 0,
},
)
if err != nil {
panic(err.Error())
}
}mobilerun-cloud devices:esim enable \
--api-key 'My API Key' \
--device-id deviceId \
--sub-id 0curl --request PUT \
--url https://api.mobilerun.ai/devices/{deviceId}/esim \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"subId": 123
}'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.mobilerun.ai/devices/{deviceId}/esim",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'subId' => 123
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.put("https://api.mobilerun.ai/devices/{deviceId}/esim")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"subId\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mobilerun.ai/devices/{deviceId}/esim")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"subId\": 123\n}"
response = http.request(request)
puts response.read_body{
"$schema": "<string>",
"detail": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
],
"instance": "<string>",
"status": 123,
"title": "<string>",
"type": "about:blank"
}SIM
Enable an eSIM subscription
Enables the eSIM subscription identified by the subId in the request body so it becomes the active subscription.
PUT
/
devices
/
{deviceId}
/
esim
JavaScript
import Mobilerun from '@mobilerun/sdk';
const client = new Mobilerun({
apiKey: process.env['MOBILERUN_CLOUD_API_KEY'], // This is the default and can be omitted
});
await client.devices.esim.enable('deviceId', { subId: 0 });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
)
client.devices.esim.enable(
device_id="deviceId",
sub_id=0,
)package main
import (
"context"
"github.com/stainless-sdks/droidrun-cloud-go"
"github.com/stainless-sdks/droidrun-cloud-go/option"
)
func main() {
client := mobileruncloud.NewClient(
option.WithAPIKey("My API Key"),
)
err := client.Devices.Esim.Enable(
context.TODO(),
"deviceId",
mobileruncloud.DeviceEsimEnableParams{
SubID: 0,
},
)
if err != nil {
panic(err.Error())
}
}mobilerun-cloud devices:esim enable \
--api-key 'My API Key' \
--device-id deviceId \
--sub-id 0curl --request PUT \
--url https://api.mobilerun.ai/devices/{deviceId}/esim \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"subId": 123
}'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.mobilerun.ai/devices/{deviceId}/esim",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'subId' => 123
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.put("https://api.mobilerun.ai/devices/{deviceId}/esim")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"subId\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mobilerun.ai/devices/{deviceId}/esim")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"subId\": 123\n}"
response = http.request(request)
puts response.read_body{
"$schema": "<string>",
"detail": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
],
"instance": "<string>",
"status": 123,
"title": "<string>",
"type": "about:blank"
}Use the
subId from list-esim or from the configure-esim response. If you passed enable: true to configure-esim, the new profile is already active and this call is unnecessary.
On iOS this re-requests the plan from the carrier rather than switching profiles — iOS provides no way to deactivate an active eSIM.
Was this page helpful?
⌘I