PUT
/users/{id} BearerUpdate 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
Warning
This endpoint requires authentication. Include a valid Bearer token in the Authorization header.
Path Parameters
Path Parameters
id requiredThe unique identifier of the user to update
Request Body
All fields are optional. Only provided fields will be updated.
Body Parameters
nameFull name of the user
emailEmail address. Must be a valid email format.
usernameUnique username
phonePhone number
websitePersonal website URL
Response
Returns the updated user object.
Error Responses
| Status | Description |
|---|---|
400 | Invalid request body |
401 | Unauthorized - missing or invalid authentication |
404 | User not found |
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", })print(response.json()){ "id": 1, "name": "Jane Doe", "username": "Bret", "phone": "1-770-736-8031 x56442", "website": "hildegard.org"}{ "error": "User not found"}Was this page helpful?
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
Authorization
Headers
Body
Response