Skip to main content
PATCH
/
users
/
{user}
Update user
curl --request PATCH \
  --url https://api.example.com/users/{user} \
  --header 'Content-Type: application/json' \
  --data '
{
  "first_name": "<string>",
  "last_name": "<string>",
  "email": "jsmith@example.com",
  "reference": "<string>",
  "show_email": true,
  "unit": 123,
  "userTypes": [
    123
  ],
  "title": "<string>",
  "phone": "<string>",
  "show_phone": true,
  "alt_phone": "<string>",
  "show_alt_phone": true,
  "specialties": [
    123
  ],
  "birthday": "<string>",
  "admin": 0,
  "settings": {
    "show_birthdays": "<string>",
    "birthdays_optout": true,
    "privatemsg": [
      123
    ],
    "language": "<string>",
    "timezone": "<string>",
    "text_to_speech_enabled": true
  },
  "meta_field_0": "<string>",
  "meta_field_1": "<string>",
  "meta_field_2": "<string>",
  "meta_field_3": "<string>",
  "meta_field_4": "<string>"
}
'
import requests

url = "https://api.example.com/users/{user}"

payload = {
"first_name": "<string>",
"last_name": "<string>",
"email": "jsmith@example.com",
"reference": "<string>",
"show_email": True,
"unit": 123,
"userTypes": [123],
"title": "<string>",
"phone": "<string>",
"show_phone": True,
"alt_phone": "<string>",
"show_alt_phone": True,
"specialties": [123],
"birthday": "<string>",
"admin": 0,
"settings": {
"show_birthdays": "<string>",
"birthdays_optout": True,
"privatemsg": [123],
"language": "<string>",
"timezone": "<string>",
"text_to_speech_enabled": True
},
"meta_field_0": "<string>",
"meta_field_1": "<string>",
"meta_field_2": "<string>",
"meta_field_3": "<string>",
"meta_field_4": "<string>"
}
headers = {"Content-Type": "application/json"}

response = requests.patch(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'PATCH',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
first_name: '<string>',
last_name: '<string>',
email: 'jsmith@example.com',
reference: '<string>',
show_email: true,
unit: 123,
userTypes: [123],
title: '<string>',
phone: '<string>',
show_phone: true,
alt_phone: '<string>',
show_alt_phone: true,
specialties: [123],
birthday: '<string>',
admin: 0,
settings: {
show_birthdays: '<string>',
birthdays_optout: true,
privatemsg: [123],
language: '<string>',
timezone: '<string>',
text_to_speech_enabled: true
},
meta_field_0: '<string>',
meta_field_1: '<string>',
meta_field_2: '<string>',
meta_field_3: '<string>',
meta_field_4: '<string>'
})
};

fetch('https://api.example.com/users/{user}', 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/users/{user}",
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([
'first_name' => '<string>',
'last_name' => '<string>',
'email' => 'jsmith@example.com',
'reference' => '<string>',
'show_email' => true,
'unit' => 123,
'userTypes' => [
123
],
'title' => '<string>',
'phone' => '<string>',
'show_phone' => true,
'alt_phone' => '<string>',
'show_alt_phone' => true,
'specialties' => [
123
],
'birthday' => '<string>',
'admin' => 0,
'settings' => [
'show_birthdays' => '<string>',
'birthdays_optout' => true,
'privatemsg' => [
123
],
'language' => '<string>',
'timezone' => '<string>',
'text_to_speech_enabled' => true
],
'meta_field_0' => '<string>',
'meta_field_1' => '<string>',
'meta_field_2' => '<string>',
'meta_field_3' => '<string>',
'meta_field_4' => '<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/users/{user}"

payload := strings.NewReader("{\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"email\": \"jsmith@example.com\",\n \"reference\": \"<string>\",\n \"show_email\": true,\n \"unit\": 123,\n \"userTypes\": [\n 123\n ],\n \"title\": \"<string>\",\n \"phone\": \"<string>\",\n \"show_phone\": true,\n \"alt_phone\": \"<string>\",\n \"show_alt_phone\": true,\n \"specialties\": [\n 123\n ],\n \"birthday\": \"<string>\",\n \"admin\": 0,\n \"settings\": {\n \"show_birthdays\": \"<string>\",\n \"birthdays_optout\": true,\n \"privatemsg\": [\n 123\n ],\n \"language\": \"<string>\",\n \"timezone\": \"<string>\",\n \"text_to_speech_enabled\": true\n },\n \"meta_field_0\": \"<string>\",\n \"meta_field_1\": \"<string>\",\n \"meta_field_2\": \"<string>\",\n \"meta_field_3\": \"<string>\",\n \"meta_field_4\": \"<string>\"\n}")

req, _ := http.NewRequest("PATCH", 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.patch("https://api.example.com/users/{user}")
.header("Content-Type", "application/json")
.body("{\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"email\": \"jsmith@example.com\",\n \"reference\": \"<string>\",\n \"show_email\": true,\n \"unit\": 123,\n \"userTypes\": [\n 123\n ],\n \"title\": \"<string>\",\n \"phone\": \"<string>\",\n \"show_phone\": true,\n \"alt_phone\": \"<string>\",\n \"show_alt_phone\": true,\n \"specialties\": [\n 123\n ],\n \"birthday\": \"<string>\",\n \"admin\": 0,\n \"settings\": {\n \"show_birthdays\": \"<string>\",\n \"birthdays_optout\": true,\n \"privatemsg\": [\n 123\n ],\n \"language\": \"<string>\",\n \"timezone\": \"<string>\",\n \"text_to_speech_enabled\": true\n },\n \"meta_field_0\": \"<string>\",\n \"meta_field_1\": \"<string>\",\n \"meta_field_2\": \"<string>\",\n \"meta_field_3\": \"<string>\",\n \"meta_field_4\": \"<string>\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.example.com/users/{user}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"email\": \"jsmith@example.com\",\n \"reference\": \"<string>\",\n \"show_email\": true,\n \"unit\": 123,\n \"userTypes\": [\n 123\n ],\n \"title\": \"<string>\",\n \"phone\": \"<string>\",\n \"show_phone\": true,\n \"alt_phone\": \"<string>\",\n \"show_alt_phone\": true,\n \"specialties\": [\n 123\n ],\n \"birthday\": \"<string>\",\n \"admin\": 0,\n \"settings\": {\n \"show_birthdays\": \"<string>\",\n \"birthdays_optout\": true,\n \"privatemsg\": [\n 123\n ],\n \"language\": \"<string>\",\n \"timezone\": \"<string>\",\n \"text_to_speech_enabled\": true\n },\n \"meta_field_0\": \"<string>\",\n \"meta_field_1\": \"<string>\",\n \"meta_field_2\": \"<string>\",\n \"meta_field_3\": \"<string>\",\n \"meta_field_4\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body

Path Parameters

user
integer
required

User ID

Body

application/json
first_name
string
Required string length: 2 - 255
last_name
string
Required string length: 2 - 255
email
string<email> | null
reference
string | null
show_email
boolean
unit
integer | null
userTypes
integer[]

IDs of user types

title
string
Maximum string length: 255
phone
string
Maximum string length: 255
show_phone
boolean
alt_phone
string
Maximum string length: 255
show_alt_phone
boolean
specialties
integer[]

IDs of user specialty categories

birthday
string | null

Birthdate string or null

admin
integer
Required range: 0 <= x <= 1
settings
object
meta_field_0
string | null

Custom meta field 0

Maximum string length: 255
meta_field_1
string | null

Custom meta field 1

Maximum string length: 255
meta_field_2
string | null

Custom meta field 2

Maximum string length: 255
meta_field_3
string | null

Custom meta field 3

Maximum string length: 255
meta_field_4
string | null

Custom meta field 4

Maximum string length: 255

Response

User updated