Numbers
Update a phone number's display label
Updates the display label. Omitting label leaves it unchanged; null or an empty string clears it.
PATCH
/
numbers
/
phones
/
{id}
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
});
const number = await client.numbers.update('550e8400-e29b-41d4-a716-446655440000');
console.log(number.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
)
number = client.numbers.update(
id="550e8400-e29b-41d4-a716-446655440000",
)
print(number.data)curl --request PATCH \
--url https://api.mobilerun.ai/v1/numbers/phones/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"label": "Support line"
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.mobilerun.ai/v1/numbers/phones/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'label' => 'Support line'
]),
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/phones/{id}"
payload := strings.NewReader("{\n \"label\": \"Support line\"\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.mobilerun.ai/v1/numbers/phones/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"label\": \"Support line\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mobilerun.ai/v1/numbers/phones/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"label\": \"Support line\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"actions": {
"cancel": true,
"send": true
},
"canSend": true,
"cancelAtPeriodEnd": true,
"cancellable": true,
"capabilities": [
"sms"
],
"checkoutUrl": "<string>",
"countryCode": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"currentPeriodEnd": "2023-11-07T05:31:56Z",
"failureReason": "out_of_stock",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"label": "<string>",
"lineCapabilities": {
"sms": {
"inbound": true,
"outbound": true
}
},
"phoneNumber": "<string>",
"purpose": "<string>",
"state": "awaiting_payment",
"updatedAt": "2023-11-07T05:31:56Z"
}
}{
"code": "<string>",
"message": "<string>",
"details": "<unknown>",
"retryAfterSeconds": 123,
"traceId": "<string>"
}{
"code": "<string>",
"message": "<string>",
"details": "<unknown>",
"retryAfterSeconds": 123,
"traceId": "<string>"
}{
"code": "<string>",
"message": "<string>",
"details": "<unknown>",
"retryAfterSeconds": 123,
"traceId": "<string>"
}{
"code": "<string>",
"message": "<string>",
"details": "<unknown>",
"retryAfterSeconds": 123,
"traceId": "<string>"
}{
"code": "product_disabled",
"message": "<string>",
"details": {
"esimId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}Body
application/json
Was this page helpful?
⌘I
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
});
const number = await client.numbers.update('550e8400-e29b-41d4-a716-446655440000');
console.log(number.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
)
number = client.numbers.update(
id="550e8400-e29b-41d4-a716-446655440000",
)
print(number.data)curl --request PATCH \
--url https://api.mobilerun.ai/v1/numbers/phones/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"label": "Support line"
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.mobilerun.ai/v1/numbers/phones/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'label' => 'Support line'
]),
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/phones/{id}"
payload := strings.NewReader("{\n \"label\": \"Support line\"\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.mobilerun.ai/v1/numbers/phones/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"label\": \"Support line\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mobilerun.ai/v1/numbers/phones/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"label\": \"Support line\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"actions": {
"cancel": true,
"send": true
},
"canSend": true,
"cancelAtPeriodEnd": true,
"cancellable": true,
"capabilities": [
"sms"
],
"checkoutUrl": "<string>",
"countryCode": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"currentPeriodEnd": "2023-11-07T05:31:56Z",
"failureReason": "out_of_stock",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"label": "<string>",
"lineCapabilities": {
"sms": {
"inbound": true,
"outbound": true
}
},
"phoneNumber": "<string>",
"purpose": "<string>",
"state": "awaiting_payment",
"updatedAt": "2023-11-07T05:31:56Z"
}
}{
"code": "<string>",
"message": "<string>",
"details": "<unknown>",
"retryAfterSeconds": 123,
"traceId": "<string>"
}{
"code": "<string>",
"message": "<string>",
"details": "<unknown>",
"retryAfterSeconds": 123,
"traceId": "<string>"
}{
"code": "<string>",
"message": "<string>",
"details": "<unknown>",
"retryAfterSeconds": 123,
"traceId": "<string>"
}{
"code": "<string>",
"message": "<string>",
"details": "<unknown>",
"retryAfterSeconds": 123,
"traceId": "<string>"
}{
"code": "product_disabled",
"message": "<string>",
"details": {
"esimId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}