Skip to main content
PUT
/
api
/
v1
/
users
/
{user_id}
Update user
curl --request PUT \
  --url http://localhost:9001/api/v1/users/{user_id} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'x-account-id: <x-account-id>' \
  --data '
{
  "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "email": "jsmith@example.com",
  "external_id": "<string>",
  "name": "<string>",
  "profile_pic_url": "<string>",
  "is_verified": true,
  "metadata": {},
  "authentication_partner": "AUTH0",
  "authentication_partner_id": "<string>",
  "created_at": "2023-11-07T05:31:56Z",
  "updated_at": "2023-11-07T05:31:56Z"
}
'
import requests

url = "http://localhost:9001/api/v1/users/{user_id}"

payload = {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"email": "jsmith@example.com",
"external_id": "<string>",
"name": "<string>",
"profile_pic_url": "<string>",
"is_verified": True,
"metadata": {},
"authentication_partner": "AUTH0",
"authentication_partner_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
headers = {
"x-account-id": "<x-account-id>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

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

print(response.text)
const options = {
method: 'PUT',
headers: {
'x-account-id': '<x-account-id>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
email: 'jsmith@example.com',
external_id: '<string>',
name: '<string>',
profile_pic_url: '<string>',
is_verified: true,
metadata: {},
authentication_partner: 'AUTH0',
authentication_partner_id: '<string>',
created_at: '2023-11-07T05:31:56Z',
updated_at: '2023-11-07T05:31:56Z'
})
};

fetch('http://localhost:9001/api/v1/users/{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_PORT => "9001",
CURLOPT_URL => "http://localhost:9001/api/v1/users/{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([
'id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'email' => 'jsmith@example.com',
'external_id' => '<string>',
'name' => '<string>',
'profile_pic_url' => '<string>',
'is_verified' => true,
'metadata' => [

],
'authentication_partner' => 'AUTH0',
'authentication_partner_id' => '<string>',
'created_at' => '2023-11-07T05:31:56Z',
'updated_at' => '2023-11-07T05:31:56Z'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"x-account-id: <x-account-id>"
],
]);

$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 := "http://localhost:9001/api/v1/users/{user_id}"

payload := strings.NewReader("{\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"email\": \"jsmith@example.com\",\n \"external_id\": \"<string>\",\n \"name\": \"<string>\",\n \"profile_pic_url\": \"<string>\",\n \"is_verified\": true,\n \"metadata\": {},\n \"authentication_partner\": \"AUTH0\",\n \"authentication_partner_id\": \"<string>\",\n \"created_at\": \"2023-11-07T05:31:56Z\",\n \"updated_at\": \"2023-11-07T05:31:56Z\"\n}")

req, _ := http.NewRequest("PUT", url, payload)

req.Header.Add("x-account-id", "<x-account-id>")
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("http://localhost:9001/api/v1/users/{user_id}")
.header("x-account-id", "<x-account-id>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"email\": \"jsmith@example.com\",\n \"external_id\": \"<string>\",\n \"name\": \"<string>\",\n \"profile_pic_url\": \"<string>\",\n \"is_verified\": true,\n \"metadata\": {},\n \"authentication_partner\": \"AUTH0\",\n \"authentication_partner_id\": \"<string>\",\n \"created_at\": \"2023-11-07T05:31:56Z\",\n \"updated_at\": \"2023-11-07T05:31:56Z\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("http://localhost:9001/api/v1/users/{user_id}")

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

request = Net::HTTP::Put.new(url)
request["x-account-id"] = '<x-account-id>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"email\": \"jsmith@example.com\",\n \"external_id\": \"<string>\",\n \"name\": \"<string>\",\n \"profile_pic_url\": \"<string>\",\n \"is_verified\": true,\n \"metadata\": {},\n \"authentication_partner\": \"AUTH0\",\n \"authentication_partner_id\": \"<string>\",\n \"created_at\": \"2023-11-07T05:31:56Z\",\n \"updated_at\": \"2023-11-07T05:31:56Z\"\n}"

response = http.request(request)
puts response.read_body
{
  "message": "user updated successfully"
}
{
"success": false,
"error": {
"code": "AUTH_002",
"type": "unauthorized",
"message": "Invalid or expired authentication token",
"details": "<string>"
}
}
{
"success": false,
"error": {
"code": "AUTH_002",
"type": "unauthorized",
"message": "Invalid or expired authentication token",
"details": "<string>"
}
}
{
"success": false,
"error": {
"code": "AUTH_002",
"type": "unauthorized",
"message": "Invalid or expired authentication token",
"details": "<string>"
}
}

Authorizations

Authorization
string
header
required

JWT token from Auth0

Headers

x-account-id
string
required

Account external ID for context

Example:

"acct-xyz789-v1"

Path Parameters

user_id
string<uuid>
required

User's internal UUID

Body

application/json
id
string<uuid>
email
string<email>
external_id
string
name
string
profile_pic_url
string<uri>
status
enum<string>

User account status

Available options:
ACTIVE,
INACTIVE,
SUSPENDED,
WAITLISTED,
INVITED,
PENDING
is_verified
boolean
metadata
object
authentication_type
enum<string>

Type of authentication used

Available options:
google-oauth2,
auth0,
github,
unknown
authentication_partner
enum<string>

Authentication provider

Available options:
AUTH0
authentication_partner_id
string
created_at
string<date-time>
updated_at
string<date-time>

Response

User updated successfully

message
string
Example:

"user updated successfully"