Skip to main content

Endpoint

PUT /api/profiles/:id

Description

Updates the profile information for a specific user. Users can update their own profiles, while administrators can update any profile. See implementation in server/src/modules/profiles/profiles.controller.ts:42-57.

Authentication

This endpoint requires Bearer token authentication. Include your access token in the Authorization header.

Path Parameters

id
string
required
The unique identifier of the user whose profile you want to update.Example: abc123

Request Body

All fields are optional. Include only the fields you want to update.
email
string
User’s email addressExample: [email protected]
full_name
string
User’s full nameExample: Dr. Jane Smith
role
string
User role: USER or ADMIN
Only administrators can change user roles
is_active
boolean
Whether the user account is activeExample: true
birth_date
string
User’s date of birth in ISO 8601 format (YYYY-MM-DD)Example: 1985-03-15
is_profile_complete
boolean
Whether the user has completed their profile setupExample: true

Example Request Body

{
  "full_name": "Dr. Jane Smith",
  "birth_date": "1985-03-15",
  "is_profile_complete": true
}

Response

id
string
Unique identifier for the user
email
string
Updated user’s email address
full_name
string
Updated user’s full name
role
string
User role: USER or ADMIN
is_active
boolean
Whether the user account is active
birth_date
string
User’s date of birth
is_profile_complete
boolean
Whether the user has completed their profile setup
created_at
string
Timestamp when the profile was created

Success Response (200)

{
  "id": "abc123",
  "email": "[email protected]",
  "full_name": "Dr. Jane Smith",
  "role": "ADMIN",
  "is_active": true,
  "birth_date": "1985-03-15",
  "is_profile_complete": true,
  "created_at": "2024-01-15T10:30:00.000Z"
}

Error Responses

400 Bad Request

{
  "statusCode": 400,
  "message": [
    "email must be an email",
    "birth_date must be a valid ISO 8601 date string"
  ],
  "error": "Bad Request"
}
Invalid data provided in request body.

401 Unauthorized

{
  "statusCode": 401,
  "message": "Token inválido o expirado",
  "error": "Unauthorized"
}
Missing or invalid Bearer token.

404 Not Found

{
  "statusCode": 404,
  "message": "Perfil no encontrado.",
  "error": "Not Found"
}
No profile exists for the specified user ID.

Code Examples

curl -X PUT https://api.zenda.com/api/profiles/abc123 \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "full_name": "Dr. Jane Smith",
    "birth_date": "1985-03-15",
    "is_profile_complete": true
  }'

Use Cases

  • User completing their profile during onboarding
  • Updating contact information
  • Admin changing user roles or status
  • Marking profile as complete after required fields filled
  • Deactivating user accounts

Validation Rules

From server/src/modules/profiles/dto/update-profile.dto.ts:
  • email must be a valid email format
  • birth_date must be a valid ISO 8601 date string (YYYY-MM-DD)
  • is_active must be a boolean
  • is_profile_complete must be a boolean
  • full_name must be a string
  • role must be either USER or ADMIN

Get One Profile

Retrieve profile information

Get All Profiles

Retrieve all profiles (admin only)

Build docs developers (and LLMs) love