Skip to main content

Endpoint

PUT /api/v1/users/{id}
Updates user information including name, email, push token, and notification preferences. All fields are optional - only include the fields you want to update.

Path parameters

id
string
required
The unique identifier (UUID) of the user to update

Request body

name
string
Updated name of the user
email
string
Updated email address (must be valid email format)
push_token
string
Updated Firebase Cloud Messaging token for push notifications
preferences
object
Updated notification preferences

Response

Returns the updated user object with all fields.
id
string
User’s unique identifier (UUID)
name
string
Updated user name
email
string
Updated email address
push_token
string
Updated FCM token (or null if not set)
preferences
object
Updated notification preferences
updated_at
string
ISO 8601 timestamp of the update

Example request

cURL
curl -X PUT http://localhost:8001/api/v1/users/123e4567-e89b-12d3-a456-426614174000 \
  -H "Content-Type: application/json" \
  -d '{
    "name": "John Updated",
    "push_token": "new_fcm_token_xyz789"
  }'
JavaScript
const response = await fetch(
  'http://localhost:8001/api/v1/users/123e4567-e89b-12d3-a456-426614174000',
  {
    method: 'PUT',
    headers: {
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      name: 'John Updated',
      push_token: 'new_fcm_token_xyz789'
    })
  }
);

const updatedUser = await response.json();
Python
import requests

user_id = '123e4567-e89b-12d3-a456-426614174000'
response = requests.put(
    f'http://localhost:8001/api/v1/users/{user_id}',
    json={
        'name': 'John Updated',
        'push_token': 'new_fcm_token_xyz789'
    }
)

updated_user = response.json()

Example response

{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "name": "John Updated",
  "email": "[email protected]",
  "push_token": "new_fcm_token_xyz789",
  "preferences": {
    "email": true,
    "push": true
  },
  "created_at": "2024-03-01T10:00:00Z",
  "updated_at": "2024-03-03T16:45:00Z"
}

Error responses

404 Not Found
error
User with the specified ID does not exist
{
  "statusCode": 404,
  "message": "User not found"
}
400 Bad Request
error
Invalid email format or malformed request
{
  "statusCode": 400,
  "message": "Validation failed",
  "errors": ["email must be a valid email"]
}

Use cases

  • Update user profile information
  • Change notification device token when user logs in on new device
  • Modify contact information
  • Combined with preferences update for comprehensive profile changes
This endpoint updates the entire user object. Use the Update user preferences endpoint if you only need to modify notification settings.

Build docs developers (and LLMs) love