Update User
curl --request POST \
--url https://api.example.com/api/users/{user_id}/update \
--header 'Content-Type: application/json' \
--data '
{
"role": "<string>",
"name": "<string>",
"email": "<string>",
"profile_image_url": "<string>",
"password": "<string>"
}
'import requests
url = "https://api.example.com/api/users/{user_id}/update"
payload = {
"role": "<string>",
"name": "<string>",
"email": "<string>",
"profile_image_url": "<string>",
"password": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
role: '<string>',
name: '<string>',
email: '<string>',
profile_image_url: '<string>',
password: '<string>'
})
};
fetch('https://api.example.com/api/users/{user_id}/update', 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.example.com/api/users/{user_id}/update",
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([
'role' => '<string>',
'name' => '<string>',
'email' => '<string>',
'profile_image_url' => '<string>',
'password' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"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.example.com/api/users/{user_id}/update"
payload := strings.NewReader("{\n \"role\": \"<string>\",\n \"name\": \"<string>\",\n \"email\": \"<string>\",\n \"profile_image_url\": \"<string>\",\n \"password\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.example.com/api/users/{user_id}/update")
.header("Content-Type", "application/json")
.body("{\n \"role\": \"<string>\",\n \"name\": \"<string>\",\n \"email\": \"<string>\",\n \"profile_image_url\": \"<string>\",\n \"password\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/users/{user_id}/update")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"role\": \"<string>\",\n \"name\": \"<string>\",\n \"email\": \"<string>\",\n \"profile_image_url\": \"<string>\",\n \"password\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"email": "<string>",
"username": "<string>",
"role": "<string>",
"name": "<string>",
"profile_image_url": "<string>",
"last_active_at": 123,
"updated_at": 123,
"created_at": 123
}Users & Groups
Update User
POST
/
api
/
users
/
{user_id}
/
update
Update User
curl --request POST \
--url https://api.example.com/api/users/{user_id}/update \
--header 'Content-Type: application/json' \
--data '
{
"role": "<string>",
"name": "<string>",
"email": "<string>",
"profile_image_url": "<string>",
"password": "<string>"
}
'import requests
url = "https://api.example.com/api/users/{user_id}/update"
payload = {
"role": "<string>",
"name": "<string>",
"email": "<string>",
"profile_image_url": "<string>",
"password": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
role: '<string>',
name: '<string>',
email: '<string>',
profile_image_url: '<string>',
password: '<string>'
})
};
fetch('https://api.example.com/api/users/{user_id}/update', 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.example.com/api/users/{user_id}/update",
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([
'role' => '<string>',
'name' => '<string>',
'email' => '<string>',
'profile_image_url' => '<string>',
'password' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"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.example.com/api/users/{user_id}/update"
payload := strings.NewReader("{\n \"role\": \"<string>\",\n \"name\": \"<string>\",\n \"email\": \"<string>\",\n \"profile_image_url\": \"<string>\",\n \"password\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.example.com/api/users/{user_id}/update")
.header("Content-Type", "application/json")
.body("{\n \"role\": \"<string>\",\n \"name\": \"<string>\",\n \"email\": \"<string>\",\n \"profile_image_url\": \"<string>\",\n \"password\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/users/{user_id}/update")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"role\": \"<string>\",\n \"name\": \"<string>\",\n \"email\": \"<string>\",\n \"profile_image_url\": \"<string>\",\n \"password\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"email": "<string>",
"username": "<string>",
"role": "<string>",
"name": "<string>",
"profile_image_url": "<string>",
"last_active_at": 123,
"updated_at": 123,
"created_at": 123
}Updates user information including role, name, email, profile image, and password.
Authentication
Requires admin authentication.Path Parameters
string
required
The unique identifier of the user to update
Request Body
string
required
User role:
admin, user, or pendingstring
required
User display name
string
required
User email address (will be converted to lowercase)
string
required
URL to user’s profile image (validated for security)
string
New password for the user (will be hashed). If provided, must meet password requirements.
Response
Returns the updated user object.string
Unique user identifier
string
Updated email address
string
Username
string
Updated user role
string
Updated display name
string
Updated profile image URL
integer
Unix timestamp of last activity
integer
Unix timestamp of last update
integer
Unix timestamp of creation
Example Request
curl -X POST "https://your-domain.com/api/users/user-123/update" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"role": "admin",
"name": "John Doe",
"email": "johndoe@example.com",
"profile_image_url": "https://example.com/avatar.jpg",
"password": "newSecurePassword123!"
}'
Example Response
{
"id": "user-123",
"email": "johndoe@example.com",
"username": "johndoe",
"role": "admin",
"name": "John Doe",
"profile_image_url": "https://example.com/avatar.jpg",
"last_active_at": 1709424000,
"updated_at": 1709424500,
"created_at": 1709337600
}
Errors
400- Email already taken by another user400- Password does not meet requirements400- User not found403- Cannot modify primary admin user (if you’re not the primary admin)403- Primary admin cannot change their own role from admin
Notes
- Email addresses are automatically converted to lowercase
- Email uniqueness is enforced - returns error if email is already in use by another user
- Password is validated and hashed securely if provided
- Primary admin user (first user created) has special protections:
- Cannot be modified by other admins
- Cannot change their own role from admin
- Profile image URLs are validated for security
- Both user table and auth table are updated when changing email or password