Skip to main content
GET
/
api
/
dashboard
/
citas-ultimos-7-dias
Get Recent Appointments (Last 7 Days)
curl --request GET \
  --url https://api.example.com/api/dashboard/citas-ultimos-7-dias
{
  "data": [
    {
      "fecha": "<string>",
      "total": 123
    }
  ],
  "401 Unauthorized": {},
  "403 Forbidden": {},
  "500 Internal Server Error": {}
}
This endpoint returns the number of appointments created each day for the last 7 days, useful for trend analysis and time-series charts.

Authentication

This endpoint requires authentication with a Bearer token.Only users with role admin or asistente can access this endpoint.

Request Headers

Authorization: Bearer <token>

Response

data
array
Array of daily appointment count objects (7 days)
fecha
string
Date in ISO format (YYYY-MM-DD)
total
number
Number of appointments created on this date

Error Responses

401 Unauthorized
object
Returned when no valid authentication token is provided
{
  "message": "Token requerido"
}
403 Forbidden
object
Returned when the user’s role is not authorized
{
  "message": "Acceso denegado"
}
500 Internal Server Error
object
Returned when a server error occurs
{
  "message": "Error citas últimos días"
}

Example Request

curl -X GET https://api.example.com/api/dashboard/citas-ultimos-7-dias \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <token>"

Example Response

[
  {
    "fecha": "2026-02-27",
    "total": 5
  },
  {
    "fecha": "2026-02-28",
    "total": 8
  },
  {
    "fecha": "2026-03-01",
    "total": 12
  },
  {
    "fecha": "2026-03-02",
    "total": 7
  },
  {
    "fecha": "2026-03-03",
    "total": 9
  },
  {
    "fecha": "2026-03-04",
    "total": 11
  },
  {
    "fecha": "2026-03-05",
    "total": 6
  }
]

Notes

  • Always returns exactly 7 days of data, including days with 0 appointments
  • Dates are based on the created_at timestamp of appointments
  • The date range includes the last 6 days plus today
  • Perfect for line charts showing appointment creation trends
  • Times are normalized to 00:00:00 for date grouping

Build docs developers (and LLMs) love