Skip to main content
GET
/
api
/
personas
/
:id
Get Person by ID
curl --request GET \
  --url https://api.example.com/api/personas/:id
{
  "id": 123,
  "nombres": "<string>",
  "apellidos": "<string>",
  "telefono": "<string>",
  "dni": "<string>",
  "foto_url": "<string>",
  "created_at": "<string>"
}

Overview

Returns detailed information about a specific person in the system.
Admin OnlyThis endpoint requires authentication and the admin role.

Path Parameters

id
number
required
The unique identifier of the person

Response

id
number
Person ID
nombres
string
First name(s)
apellidos
string
Last name(s)
telefono
string
Phone number (nullable)
dni
string
National ID number (nullable, unique)
foto_url
string
Profile photo URL (nullable)
created_at
string
Timestamp when the person was created

Example Request

cURL
curl -X GET http://localhost:3000/api/personas/5 \
  -H "Authorization: Bearer YOUR_ADMIN_TOKEN"
JavaScript
const response = await fetch('http://localhost:3000/api/personas/5', {
  headers: {
    'Authorization': `Bearer ${adminToken}`
  }
});
const person = await response.json();

Example Response

200 OK
{
  "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": "Persona no encontrada"
}
No person exists with the specified ID.
Source: /home/daytona/workspace/source/src/routes/personas.routes.js:97

Build docs developers (and LLMs) love