Skip to main content
GET
/
api
/
usuarios
/
me
Get Current User Profile
curl --request GET \
  --url https://api.example.com/api/usuarios/me
{
  "id": "<string>",
  "persona_id": 123,
  "role": "<string>",
  "created_at": "<string>",
  "persona": {
    "id": 123,
    "nombres": "<string>",
    "apellidos": "<string>",
    "telefono": "<string>",
    "dni": "<string>",
    "foto_url": "<string>"
  }
}

Overview

Returns the complete profile of the currently authenticated user, including their associated person information.
Authentication RequiredThis endpoint requires a valid JWT token from Supabase Auth. The user must have either admin or asistente role.

Authentication

Include the JWT token in the Authorization header:
Authorization: Bearer <supabase-jwt-token>

Response

id
string
The Supabase authentication UUID
persona_id
number
ID of the associated person record (nullable)
role
string
User’s role: admin or asistente
created_at
string
Timestamp when the user was created
persona
object
Associated person data

Example Request

cURL
curl -X GET http://localhost:3000/api/usuarios/me \
  -H "Authorization: Bearer YOUR_SUPABASE_JWT_TOKEN"
JavaScript
const response = await fetch('http://localhost:3000/api/usuarios/me', {
  headers: {
    'Authorization': `Bearer ${supabaseToken}`
  }
});
const profile = await response.json();

Example Response

200 OK
{
  "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "persona_id": 5,
  "role": "asistente",
  "created_at": "2024-03-05T10:30:00.000Z",
  "persona": {
    "id": 5,
    "nombres": "María",
    "apellidos": "González",
    "telefono": "+1234567890",
    "dni": "12345678",
    "foto_url": "https://example.com/photos/maria.jpg",
    "created_at": "2024-03-01T08:00:00.000Z"
  }
}

Error Responses

{
  "message": "Token requerido"
}
No authorization token was provided.
{
  "message": "Usuario no encontrado"
}
The authenticated user doesn’t have a record in the system.
Source: /home/daytona/workspace/source/src/routes/usuarios.routes.js:112

Build docs developers (and LLMs) love