Update an IAM role
Changes a role’s name, its description, or both. A field left out keeps its value. What a role allows is changed through its statements.
Only the organization owner can call this endpoint. Its action is iam_roles.update. Other users and service account tokens get 403.
PATCH
/
iam
/
roles
/
{id}
Update an IAM role
curl --request PATCH \
--url https://api.telnyx.com/v2/iam/roles/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"description": "Searches, orders, updates and assigns test numbers"
}
'import requests
url = "https://api.telnyx.com/v2/iam/roles/{id}"
payload = { "description": "Searches, orders, updates and assigns test numbers" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({description: 'Searches, orders, updates and assigns test numbers'})
};
fetch('https://api.telnyx.com/v2/iam/roles/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.telnyx.com/v2/iam/roles/{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([
'description' => 'Searches, orders, updates and assigns test numbers'
]),
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.telnyx.com/v2/iam/roles/{id}"
payload := strings.NewReader("{\n \"description\": \"Searches, orders, updates and assigns test numbers\"\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.telnyx.com/v2/iam/roles/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"description\": \"Searches, orders, updates and assigns test numbers\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.telnyx.com/v2/iam/roles/{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 \"description\": \"Searches, orders, updates and assigns test numbers\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "8c4a9715-0246-4c6f-9eca-390e13bd8af0",
"organization_id": "6e9d4c3a-2f8b-4a71-9c05-3b8e1f2d7a64",
"name": "test-number-provisioner",
"description": "Searches, orders, updates and assigns test numbers",
"record_type": "iam_role",
"created_at": "2026-11-24T10:15:30.123456Z",
"updated_at": "2026-11-25T08:41:07.000000Z"
}
}Authorizations
Body
application/json
Was this page helpful?
Update an IAM role
curl --request PATCH \
--url https://api.telnyx.com/v2/iam/roles/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"description": "Searches, orders, updates and assigns test numbers"
}
'import requests
url = "https://api.telnyx.com/v2/iam/roles/{id}"
payload = { "description": "Searches, orders, updates and assigns test numbers" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({description: 'Searches, orders, updates and assigns test numbers'})
};
fetch('https://api.telnyx.com/v2/iam/roles/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.telnyx.com/v2/iam/roles/{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([
'description' => 'Searches, orders, updates and assigns test numbers'
]),
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.telnyx.com/v2/iam/roles/{id}"
payload := strings.NewReader("{\n \"description\": \"Searches, orders, updates and assigns test numbers\"\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.telnyx.com/v2/iam/roles/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"description\": \"Searches, orders, updates and assigns test numbers\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.telnyx.com/v2/iam/roles/{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 \"description\": \"Searches, orders, updates and assigns test numbers\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "8c4a9715-0246-4c6f-9eca-390e13bd8af0",
"organization_id": "6e9d4c3a-2f8b-4a71-9c05-3b8e1f2d7a64",
"name": "test-number-provisioner",
"description": "Searches, orders, updates and assigns test numbers",
"record_type": "iam_role",
"created_at": "2026-11-24T10:15:30.123456Z",
"updated_at": "2026-11-25T08:41:07.000000Z"
}
}