curl --request PUT \
--url https://your-instance.example.com/api/user/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"fullName": "Alex Rep",
"accessRole": "DEPARTMENT_HEAD",
"departmentId": "64eea1110000000000000020"
}
'import requests
url = "https://your-instance.example.com/api/user/{id}"
payload = {
"fullName": "Alex Rep",
"accessRole": "DEPARTMENT_HEAD",
"departmentId": "64eea1110000000000000020"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
fullName: 'Alex Rep',
accessRole: 'DEPARTMENT_HEAD',
departmentId: '64eea1110000000000000020'
})
};
fetch('https://your-instance.example.com/api/user/{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://your-instance.example.com/api/user/{id}",
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([
'fullName' => 'Alex Rep',
'accessRole' => 'DEPARTMENT_HEAD',
'departmentId' => '64eea1110000000000000020'
]),
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://your-instance.example.com/api/user/{id}"
payload := strings.NewReader("{\n \"fullName\": \"Alex Rep\",\n \"accessRole\": \"DEPARTMENT_HEAD\",\n \"departmentId\": \"64eea1110000000000000020\"\n}")
req, _ := http.NewRequest("PUT", 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.put("https://your-instance.example.com/api/user/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"fullName\": \"Alex Rep\",\n \"accessRole\": \"DEPARTMENT_HEAD\",\n \"departmentId\": \"64eea1110000000000000020\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://your-instance.example.com/api/user/{id}")
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 \"fullName\": \"Alex Rep\",\n \"accessRole\": \"DEPARTMENT_HEAD\",\n \"departmentId\": \"64eea1110000000000000020\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "User updated successfully",
"data": {
"_id": "5f7b1c2e8a1d4e0012c3b4a6",
"fullName": "Sam Patel",
"email": "sam.patel.new@acme.example",
"accessRole": "AGENT",
"organizationId": "64a1b2c3d4e5f60012345678",
"loginDisabled": false
}
}{
"success": false,
"error": "Unauthorized",
"details": "ADMIN role required"
}{
"success": false,
"error": "Unauthorized",
"details": "ADMIN role required"
}{
"success": false,
"error": "Unauthorized",
"details": "ADMIN role required"
}{
"success": false,
"error": "Unauthorized",
"details": "ADMIN role required"
}Update a user by ID (admin)
Admin endpoint: updates a target user fields (name, email, phone, designation, access role, department). Returns 409 if the new email is already in use.
curl --request PUT \
--url https://your-instance.example.com/api/user/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"fullName": "Alex Rep",
"accessRole": "DEPARTMENT_HEAD",
"departmentId": "64eea1110000000000000020"
}
'import requests
url = "https://your-instance.example.com/api/user/{id}"
payload = {
"fullName": "Alex Rep",
"accessRole": "DEPARTMENT_HEAD",
"departmentId": "64eea1110000000000000020"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
fullName: 'Alex Rep',
accessRole: 'DEPARTMENT_HEAD',
departmentId: '64eea1110000000000000020'
})
};
fetch('https://your-instance.example.com/api/user/{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://your-instance.example.com/api/user/{id}",
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([
'fullName' => 'Alex Rep',
'accessRole' => 'DEPARTMENT_HEAD',
'departmentId' => '64eea1110000000000000020'
]),
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://your-instance.example.com/api/user/{id}"
payload := strings.NewReader("{\n \"fullName\": \"Alex Rep\",\n \"accessRole\": \"DEPARTMENT_HEAD\",\n \"departmentId\": \"64eea1110000000000000020\"\n}")
req, _ := http.NewRequest("PUT", 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.put("https://your-instance.example.com/api/user/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"fullName\": \"Alex Rep\",\n \"accessRole\": \"DEPARTMENT_HEAD\",\n \"departmentId\": \"64eea1110000000000000020\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://your-instance.example.com/api/user/{id}")
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 \"fullName\": \"Alex Rep\",\n \"accessRole\": \"DEPARTMENT_HEAD\",\n \"departmentId\": \"64eea1110000000000000020\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "User updated successfully",
"data": {
"_id": "5f7b1c2e8a1d4e0012c3b4a6",
"fullName": "Sam Patel",
"email": "sam.patel.new@acme.example",
"accessRole": "AGENT",
"organizationId": "64a1b2c3d4e5f60012345678",
"loginDisabled": false
}
}{
"success": false,
"error": "Unauthorized",
"details": "ADMIN role required"
}{
"success": false,
"error": "Unauthorized",
"details": "ADMIN role required"
}{
"success": false,
"error": "Unauthorized",
"details": "ADMIN role required"
}{
"success": false,
"error": "Unauthorized",
"details": "ADMIN role required"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Body
Display name shown across the UI for the target user.
New login email; endpoint returns 409 if another user already has this email.
Target user personal mobile number (E.164 preferred).
Assigned Sinch outbound number; used as the from-number on user-attributed SMS.
Free-form job title (e.g., "Senior Account Executive"); display only.
Role granted to the user: SUPERADMIN, ADMIN, DEPARTMENT_HEAD, SALES_REP. Only SUPERADMIN callers may change this field.
ObjectId of the Department the user belongs to; changes are mirrored to the department managerIds list for DEPARTMENT_HEAD users.
Response
User updated
Returned by admin PUT /api/user/{id}.
true Compact user payload returned by POST /api/user/list (bare array — no envelope).
Show child attributes
Show child attributes
{
"_id": "5f7b1c2e8a1d4e0012c3b4a6",
"fullName": "Sam Patel",
"email": "sam.patel@acme.example",
"phoneNumber": "+14165550100",
"accessRole": "AGENT",
"organizationId": "64a1b2c3d4e5f60012345678",
"loginDisabled": false
}