Skip to main content

Endpoint

PATCH /api/auth/profile
Update the authenticated user’s profile information including name, phone, logo, and business name.
This endpoint requires authentication. Include a valid Bearer token in the Authorization header.

Request Headers

Authorization
string
required
Bearer token obtained from login or refresh endpoint

Request Body

All fields are optional. Only include the fields you want to update.
nombre
string
User’s first name
apellido
string
User’s last name
telefono
string
User’s phone number
logo_url
string
URL to user’s profile image or business logo (must be a valid URL)
nombre_comercial
string
Business or commercial name

Response

message
string
Success message
user
object
Updated user information

Example Request

cURL
curl -X PATCH https://api.contafy.com/api/auth/profile \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "nombre": "Juan Carlos",
    "apellido": "Pérez García",
    "telefono": "+52 55 1234 5678",
    "nombre_comercial": "Contafy Solutions"
  }'

Success Response

{
  "message": "Perfil actualizado correctamente",
  "user": {
    "id": "123e4567-e89b-12d3-a456-426614174000",
    "email": "[email protected]",
    "nombre": "Juan Carlos",
    "apellido": "Pérez García",
    "telefono": "+52 55 1234 5678",
    "nombre_comercial": "Contafy Solutions",
    "logo_url": null,
    "email_verified": true
  }
}

Error Responses

400 Bad Request

{
  "error": "Error de validación",
  "details": [
    {
      "field": "logo_url",
      "message": "El logo_url debe ser una URL válida"
    }
  ]
}

401 Unauthorized

{
  "error": "No autorizado",
  "message": "Token inválido o expirado"
}

500 Internal Server Error

{
  "error": "Error interno del servidor",
  "message": "Error al actualizar el perfil"
}

Important Notes

  • Email address cannot be changed via this endpoint
  • Password changes require the password reset flow
  • All fields are optional - only send the fields you want to update
  • Phone number is stored as plain text without format validation
  • Logo URL must be a valid HTTP/HTTPS URL
  • Profile information is separate from RFC profiles (see Profiles API)

Build docs developers (and LLMs) love