Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/BladimirGS/judicial-backend/llms.txt

Use this file to discover all available pages before exploring further.

The grouped statistical report endpoint aggregates appeal statistics by sala and appeal type, returning a structured hierarchy rather than a paginated flat list. This endpoint is designed for dashboard widgets, chart generation, and summary tables where totals per sala or per appeal category are more valuable than individual row-level records. Because the response is already aggregated, it does not support pagination — the full grouped structure is always returned.
At least one filter parameter must be provided. Requests without any of idSala, idNomenclatura, idApelacion, fechaInicio, or fechaFin will receive a 400 Bad Request response.

Endpoint

GET /api/estadisticas/agrupado
Authentication: Authorization: Bearer <token>

Query parameters

idSala
integer
Filter results to a specific sala (court division). Accepts the numeric ID of the sala.
idNomenclatura
integer
Filter results to a specific nomenclatura classification. Accepts the numeric ID of the nomenclatura.
idApelacion
integer
Filter results to a specific appeal type. Accepts the numeric ID of the appeal type.
fechaInicio
string (date)
Start of the date range filter applied to appeal reception timestamps. ISO 8601 format: YYYY-MM-DD.
fechaFin
string (date)
End of the date range filter applied to appeal reception timestamps. ISO 8601 format: YYYY-MM-DD.
This endpoint does not accept page or limit parameters. Pagination is not applicable because the response is a pre-aggregated grouped structure, not a list of individual records.

Response 200

status
string
required
"success"
message
string
required
Human-readable result description, e.g. "Reporte agrupado obtenido exitosamente".
data
object
required
Container for the grouped statistical output.

GrupoEstadistica fields

agrupacion
string
required
The grouping label — typically the sala name (e.g. "Sala Penal 1").
total
integer
required
Total number of appeal records within this group.
registros
EstadisticaDto[]
required
The individual statistical records belonging to this group. Each entry has the same structure as the records returned by GET /api/estadisticas/plano.

Example response body

{
  "status": "success",
  "message": "Reporte agrupado obtenido exitosamente",
  "data": {
    "grupos": [
      {
        "agrupacion": "Sala Penal 1",
        "total": 42,
        "registros": [
          {
            "idApelacion": 3,
            "sala": "Sala Penal 1",
            "tramite": "TRAM-001",
            "folioOficialia": "FOL-001",
            "nomenclatura": "NOM-001",
            "folioToca": "TOCA-001",
            "apelacion": "Apelación Penal",
            "tipoApelacion": null,
            "tipoEscrito": "Escrito de apelación",
            "fechaHoraRecepcion": "2024-03-15T10:30:00.000Z",
            "fechaHoraIngresoJuzgado": "2024-03-16T08:00:00.000Z",
            "juzgadoOrigen": "Juzgado Penal 1",
            "mesRecep": "Marzo",
            "añoRecep": 2024,
            "mesIngreso": "Marzo",
            "añoIngreso": 2024
          }
        ]
      },
      {
        "agrupacion": "Sala Penal 2",
        "total": 17,
        "registros": []
      }
    ]
  }
}

Error responses

StatusMeaning
400 Bad RequestNo valid filter parameters were provided.
401 UnauthorizedMissing or invalid Authorization bearer token.

Example

Retrieve grouped statistics for a full year

curl -G http://localhost:4000/api/estadisticas/agrupado \
  -H 'Authorization: Bearer <token>' \
  --data-urlencode 'fechaInicio=2024-01-01' \
  --data-urlencode 'fechaFin=2024-12-31'

Filter grouped report by sala and nomenclatura

curl -G http://localhost:4000/api/estadisticas/agrupado \
  -H 'Authorization: Bearer <token>' \
  --data-urlencode 'idSala=2' \
  --data-urlencode 'idNomenclatura=1' \
  --data-urlencode 'fechaInicio=2024-01-01' \
  --data-urlencode 'fechaFin=2024-06-30'

Build docs developers (and LLMs) love