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 historical search module (/api/busquedas/historico) queries the ApelacionHistorico entity — a separate database table that stores legacy and archived appeal records migrated from prior court systems. These records have a simpler structure than current-system appeals and are optimized for historical lookups by case number, party name, offense type, and date range. All endpoints require a valid JWT bearer token.
Historical records are stored in the ApelacionHistorico table, which is distinct from the current Apelacion table queried by /api/busquedas. Fields, relationships, and completeness may differ from active records.

Endpoints overview

MethodPathDescription
GET/api/busquedas/historico/filtrosRetrieve filter catalogs for historical search
GET/api/busquedas/historicoSearch historical appeals with filters and pagination
GET/api/busquedas/historico/exportar-excelExport historical results as an Excel file
GET/api/busquedas/historico/exportar-pdfExport historical results as a PDF file

GET /api/busquedas/historico/filtros

Returns the catalog values available for filtering historical records. The historical catalog is smaller than the full-mode catalog — only salas are provided, as other lookup tables (nomenclaturas, tipos de apelación) are not applicable to the legacy schema. Authentication: Authorization: Bearer <token>

Response 200

status
string
required
Always "success" on a successful request.
data
object
required
Historical filter catalogs.

Error responses

StatusMeaning
401 UnauthorizedMissing or invalid Authorization bearer token.

GET /api/busquedas/historico

Searches the ApelacionHistorico table and returns a paginated list of historical appeal records. Supports filtering by case numbers, party names, offense type, and two independent date ranges (reception date and appeal date). Authentication: Authorization: Bearer <token>
At least one search filter (beyond page and limit) must be provided. Requests that supply only pagination parameters — or no parameters at all — will receive a 400 Bad Request response. The filter set is validated using HistoricoFiltrosDTO.tieneFiltros().

Query parameters

page
integer
default:1
Page number for pagination. Starts at 1.
limit
integer
default:10
Number of results per page.
expedienteCausa
string
Filter by the originating criminal cause docket number.
toca
string
Filter by the historical toca (appeal folio) identifier.
idSala
integer
Filter by sala ID. Use the catalog values returned by GET /api/busquedas/historico/filtros.
fechaRecepcionInicial
string (date)
Start date of the reception date range filter. ISO 8601 format: YYYY-MM-DD. Must be used together with fechaRecepcionFinal for a bounded range.
fechaRecepcionFinal
string (date)
End date of the reception date range filter. ISO 8601 format: YYYY-MM-DD.
fechaApelacionInicial
string (date)
Start date of the appeal filing date range filter. ISO 8601 format: YYYY-MM-DD. Independent of the reception date range — both can be applied simultaneously.
fechaApelacionFinal
string (date)
End date of the appeal filing date range filter. ISO 8601 format: YYYY-MM-DD.
imputado
string
Filter by the name of the accused (imputado). Supports partial text matching.
victima
string
Filter by the name of the victim (víctima). Supports partial text matching.
delito
string
Filter by the criminal offense description (delito). Supports partial text matching.

Response 200

status
string
required
"success"
message
string
required
Human-readable result message, e.g. "Operación exitosa".
data
object
required
Paginated result envelope.

ApelacionHistoricoDTO fields

id
integer
required
Internal primary key of the historical record.
toca
string | null
Historical toca / appeal folio number as recorded in the legacy system.
expedienteCausa
string | null
Originating criminal cause docket number.
fechaRecepcionApelacion
string (date) | null
Date the appeal was received by the court. Format: YYYY-MM-DD.
fechaApelacion
string (date) | null
Date the appeal was formally filed or registered. Format: YYYY-MM-DD.
imputado
string | null
Name of the accused party in the original proceeding.
victima
string | null
Name of the victim in the original proceeding.
delito
string | null
Description of the criminal offense charged.
sala
string | null
Name of the sala that handled the historical appeal.
juzgado
string | null
Name of the originating trial court.

Error responses

StatusMeaning
400 Bad RequestNo valid search filters were provided (beyond pagination).
401 UnauthorizedMissing or invalid Authorization bearer token.

GET /api/busquedas/historico/exportar-excel

Generates and streams a binary Excel workbook (.xlsx) with all historical records matching the supplied filters. Pagination does not apply — the export includes the full result set. Authentication: Authorization: Bearer <token>

Query parameters

Same filter parameters as GET /api/busquedas/historico (excluding page and limit): expedienteCausa, toca, idSala, fechaRecepcionInicial, fechaRecepcionFinal, fechaApelacionInicial, fechaApelacionFinal, imputado, victima, delito.

Response 200

  • Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
  • Content-Disposition: attachment; filename=historicos.xlsx
  • Body: Binary Excel file stream.

Error responses

StatusMeaning
401 UnauthorizedMissing or invalid Authorization bearer token.

GET /api/busquedas/historico/exportar-pdf

Generates and streams a binary PDF document containing all historical records matching the supplied filters. Authentication: Authorization: Bearer <token>

Query parameters

Same filter parameters as GET /api/busquedas/historico/exportar-excel.

Response 200

  • Content-Type: application/pdf
  • Content-Disposition: attachment; filename=historicos.pdf
  • Body: Binary PDF file stream.

Error responses

StatusMeaning
401 UnauthorizedMissing or invalid Authorization bearer token.

Examples

Search historical records by accused name and offense

curl -G http://localhost:4000/api/busquedas/historico \
  -H 'Authorization: Bearer <token>' \
  --data-urlencode 'imputado=Ramírez' \
  --data-urlencode 'delito=robo' \
  --data-urlencode 'page=1' \
  --data-urlencode 'limit=10'

Search by reception date range

curl -G http://localhost:4000/api/busquedas/historico \
  -H 'Authorization: Bearer <token>' \
  --data-urlencode 'fechaRecepcionInicial=2020-01-01' \
  --data-urlencode 'fechaRecepcionFinal=2020-12-31' \
  --data-urlencode 'idSala=3' \
  --data-urlencode 'page=1' \
  --data-urlencode 'limit=25'

Search by both date ranges simultaneously

curl -G http://localhost:4000/api/busquedas/historico \
  -H 'Authorization: Bearer <token>' \
  --data-urlencode 'fechaRecepcionInicial=2019-06-01' \
  --data-urlencode 'fechaRecepcionFinal=2019-12-31' \
  --data-urlencode 'fechaApelacionInicial=2020-01-01' \
  --data-urlencode 'fechaApelacionFinal=2020-06-30' \
  --data-urlencode 'page=1' \
  --data-urlencode 'limit=10'

Export historical records to Excel

curl -G http://localhost:4000/api/busquedas/historico/exportar-excel \
  -H 'Authorization: Bearer <token>' \
  --data-urlencode 'idSala=2' \
  --data-urlencode 'fechaRecepcionInicial=2018-01-01' \
  --data-urlencode 'fechaRecepcionFinal=2022-12-31' \
  -o historicos.xlsx

Build docs developers (and LLMs) love