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.messages.send('550e8400-e29b-41d4-a716-446655440000', {
body: 'x',
to: '+15551230001',
});
console.log(response.data);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.messages.send(
id="550e8400-e29b-41d4-a716-446655440000",
body="x",
to="+15551230001",
)
print(response.data)curl --request POST \
--url https://api.mobilerun.ai/v1/numbers/esims/{id}/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"body": "<string>",
"to": "+15551230001",
"clientRequestId": "<string>",
"deliveryReport": false
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.mobilerun.ai/v1/numbers/esims/{id}/messages",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'body' => '<string>',
'to' => '+15551230001',
'clientRequestId' => '<string>',
'deliveryReport' => false
]),
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;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.mobilerun.ai/v1/numbers/esims/{id}/messages"
payload := strings.NewReader("{\n \"body\": \"<string>\",\n \"to\": \"+15551230001\",\n \"clientRequestId\": \"<string>\",\n \"deliveryReport\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.mobilerun.ai/v1/numbers/esims/{id}/messages")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"body\": \"<string>\",\n \"to\": \"+15551230001\",\n \"clientRequestId\": \"<string>\",\n \"deliveryReport\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mobilerun.ai/v1/numbers/esims/{id}/messages")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"body\": \"<string>\",\n \"to\": \"+15551230001\",\n \"clientRequestId\": \"<string>\",\n \"deliveryReport\": false\n}"
response = http.request(request)
puts response.read_body{
"data": {
"body": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"deliveryStatus": "<string>",
"detectedSender": "<string>",
"direction": "inbound",
"esimId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"occurredAt": "2023-11-07T05:31:56Z",
"peerKey": "<string>",
"peerNumber": "<string>",
"providerCode": "<string>",
"status": "received"
}
}{
"message": "<string>",
"reason": "not_installed",
"success": false
}{
"error": "<string>"
}{
"message": "<string>",
"reason": "not_installed",
"success": false
}{
"message": "<string>",
"reason": "not_installed",
"success": false
}{
"message": "<string>",
"reason": "out_of_stock",
"success": false
}Send an SMS through one eSIM
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.messages.send('550e8400-e29b-41d4-a716-446655440000', {
body: 'x',
to: '+15551230001',
});
console.log(response.data);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.messages.send(
id="550e8400-e29b-41d4-a716-446655440000",
body="x",
to="+15551230001",
)
print(response.data)curl --request POST \
--url https://api.mobilerun.ai/v1/numbers/esims/{id}/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"body": "<string>",
"to": "+15551230001",
"clientRequestId": "<string>",
"deliveryReport": false
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.mobilerun.ai/v1/numbers/esims/{id}/messages",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'body' => '<string>',
'to' => '+15551230001',
'clientRequestId' => '<string>',
'deliveryReport' => false
]),
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;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.mobilerun.ai/v1/numbers/esims/{id}/messages"
payload := strings.NewReader("{\n \"body\": \"<string>\",\n \"to\": \"+15551230001\",\n \"clientRequestId\": \"<string>\",\n \"deliveryReport\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.mobilerun.ai/v1/numbers/esims/{id}/messages")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"body\": \"<string>\",\n \"to\": \"+15551230001\",\n \"clientRequestId\": \"<string>\",\n \"deliveryReport\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mobilerun.ai/v1/numbers/esims/{id}/messages")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"body\": \"<string>\",\n \"to\": \"+15551230001\",\n \"clientRequestId\": \"<string>\",\n \"deliveryReport\": false\n}"
response = http.request(request)
puts response.read_body{
"data": {
"body": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"deliveryStatus": "<string>",
"detectedSender": "<string>",
"direction": "inbound",
"esimId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"occurredAt": "2023-11-07T05:31:56Z",
"peerKey": "<string>",
"peerNumber": "<string>",
"providerCode": "<string>",
"status": "received"
}
}{
"message": "<string>",
"reason": "not_installed",
"success": false
}{
"error": "<string>"
}{
"message": "<string>",
"reason": "not_installed",
"success": false
}{
"message": "<string>",
"reason": "not_installed",
"success": false
}{
"message": "<string>",
"reason": "out_of_stock",
"success": false
}Authorizations
Bearer token via Authorization header
Path Parameters
"550e8400-e29b-41d4-a716-446655440000"
Body
SMS body text (max 320 chars — smaller than the admin tier's cap; see the schema's own doc comment for why)
1 - 320Recipient phone number — normalized to E.164 (spaces/dashes/dots stripped); rejected with 400 if it doesn't validate as E.164 afterward.
1"+15551230001"
Client-supplied idempotency key, scoped to (owner, esimId, key). Replaying the same key + identical payload returns the original send; the same key with a DIFFERENT payload is a 409 conflict.
1 - 128Wait for physedge to confirm carrier delivery before completing the send (adds executor-side latency, never on this request — sends are always async/202). Defaults to false for the public tier (opt-in, unlike the admin tier's default-true).
Response
Outbound message queued
Show child attributes
Show child attributes
Was this page helpful?