Skip to main content
PUT
/
api
/
personas
/
me
Update My Profile
curl --request PUT \
  --url https://api.example.com/api/personas/me \
  --header 'Content-Type: application/json' \
  --data '
{
  "nombres": "<string>",
  "apellidos": "<string>",
  "telefono": "<string>",
  "dni": "<string>",
  "foto_url": "<string>"
}
'
{
  "id": 123,
  "nombres": "<string>",
  "apellidos": "<string>",
  "telefono": "<string>",
  "dni": "<string>",
  "foto_url": "<string>",
  "created_at": "<string>"
}

Overview

Allows authenticated users (admin or assistant) to update their own person information without needing to know their persona_id.
Authentication RequiredThis endpoint requires a valid JWT token. Both admin and asistente roles can use this endpoint.

Request Body

All fields are optional. Only provided fields will be updated.
nombres
string
First name(s)
apellidos
string
Last name(s)
telefono
string
Phone number
dni
string
National ID number (must be unique)
foto_url
string
Profile photo URL

Response

Returns the updated person object.
id
number
Person ID
nombres
string
Updated first name(s)
apellidos
string
Updated last name(s)
telefono
string
Updated phone number
dni
string
Updated DNI
foto_url
string
Updated photo URL
created_at
string
Creation timestamp

Example Request

cURL
curl -X PUT http://localhost:3000/api/personas/me \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "telefono": "+9876543210",
    "foto_url": "https://example.com/new-photo.jpg"
  }'
JavaScript
const response = await fetch('http://localhost:3000/api/personas/me', {
  method: 'PUT',
  headers: {
    'Authorization': `Bearer ${token}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    telefono: '+9876543210',
    foto_url: 'https://example.com/new-photo.jpg'
  })
});
const updatedProfile = await response.json();

Example Response

200 OK
{
  "id": 5,
  "nombres": "María",
  "apellidos": "González",
  "telefono": "+9876543210",
  "dni": "12345678",
  "foto_url": "https://example.com/new-photo.jpg",
  "created_at": "2024-03-01T08:00:00.000Z"
}

Error Responses

{
  "message": "Persona no encontrada"
}
The authenticated user doesn’t have an associated person record.
{
  "message": "Error al actualizar perfil"
}
An error occurred while updating the profile (e.g., duplicate DNI).

Use Cases

  • Users updating their own contact information
  • Users changing their profile photo
  • Self-service profile management
Source: /home/daytona/workspace/source/src/routes/personas.routes.js:64

Build docs developers (and LLMs) love