PUT /users/{id} Bearer

Update User

Update an existing user's profile information, email, role, or other fields via authenticated PUT request

Overview

Updates an existing user’s information. You can update any subset of fields - only the provided fields will be modified.

Authorization

Path Parameters

Path Parameters

id required
integer

The unique identifier of the user to update

Request Body

All fields are optional. Only provided fields will be updated.

Body Parameters

name
string

Full name of the user

email
string

Email address. Must be a valid email format.

username
string

Unique username

phone
string

Phone number

website
string

Personal website URL

Response

Returns the updated user object.

Error Responses

StatusDescription
400Invalid request body
401Unauthorized - missing or invalid authentication
404User not found
Terminal window
curl -X PUT "https://jsonplaceholder.typicode.com/users/1" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <token>" \
-d '{
"name": "Jane Doe",
"email": "[email protected]"
}'
const response = await fetch("https://jsonplaceholder.typicode.com/users/1", {
method: "PUT",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer <token>"
},
body: JSON.stringify({
name: "Jane Doe",
})
});
const data = await response.json();
console.log(data);
import requests
response = requests.put(
"https://jsonplaceholder.typicode.com/users/1",
headers={"Authorization": "Bearer <token>"},
json={
"name": "Jane Doe",
"email": "[email protected]"
}
)
print(response.json())
{
"id": 1,
"name": "Jane Doe",
"email": "[email protected]",
"username": "Bret",
"phone": "1-770-736-8031 x56442",
"website": "hildegard.org"
}
{
"error": "User not found"
}
Request
curl -X PUT "https://jsonplaceholder.typicode.com/users/{id}" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <token>"
const response = await fetch("https://jsonplaceholder.typicode.com/users/{id}", {
  method: "PUT",
  headers: {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
},
});

const data = await response.json();
console.log(data);
import requests

response = requests.put(
    "https://jsonplaceholder.typicode.com/users/{id}",
    headers={'Content-Type':'application/json','Authorization':'Bearer <token>'},
)

print(response.json())
package main

import (
    "fmt"
    "net/http"
    "io"
)

func main() {
    req, _ := http.NewRequest("PUT", "https://jsonplaceholder.typicode.com/users/{id}", nil)
    req.Header.Set("Content-Type", "application/json")
    req.Header.Set("Authorization", "Bearer <token>")

    client := &http.Client{}
    resp, _ := client.Do(req)
    defer resp.Body.Close()

    body, _ := io.ReadAll(resp.Body)
    fmt.Println(string(body))
}
Response
Send a request to see the response