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 appeals module exposes three catalog endpoints that power the registration form dropdowns. The primary endpoint returns all catalogs needed to populate the form for a given matter type, while two auxiliary endpoints let the UI lazily load localities and appeal sub-types after the user makes an upstream selection. All three endpoints require a valid Bearer JWT.

GET /api/apelaciones/catalogos

Returns all catalog lists required to render the appeal registration form, pre-filtered by materia. Common catalogs (materias, magistrados, delitos, sexos, tiposPartes, tiposEscritos) are always included. Penal-specific catalogs (apelaciones, tiposApelaciones, juzgados) are included only when materia=penal. Indigenous-specific catalogs (municipios, etnias) are included only when materia=indigena. Every response also contains a folioTentativo — a tentative folio string generated by the PA_INS_PCF_FolioTramite stored procedure so the UI can display it before the record is saved.

Authentication

All catalog endpoints require a valid JWT. Requests without an Authorization: Bearer <token> header will receive 401 Unauthorized.

Query Parameters

materia
string
required
The matter type to filter catalogs by. Must be exactly penal (idMateria 5) or indigena (idMateria 6). Any other value returns a 400 validation error.

Response — 200 OK

status
string
Always "success" on a successful response.
message
string
Human-readable confirmation, e.g. "Catálogos cargados correctamente".
data
object
The catalog payload. All CatalogoBase items share the shape { id: number, descripcion: string }.

Error Responses

HTTP StatusCode / ReasonDescription
400 Bad RequestInvalid materia valuemateria was not penal or indigena.
401 UnauthorizedMissing or invalid JWTNo Authorization header, expired token, or invalid signature.

Example Request

curl 'http://localhost:4000/api/apelaciones/catalogos?materia=penal' \
  -H 'Authorization: Bearer <token>'

Example Response

{
  "status": "success",
  "message": "Catálogos cargados correctamente",
  "data": {
    "folioTentativo": "2024-PCF-001",
    "materias": [
      { "id": 5, "descripcion": "Penal" },
      { "id": 6, "descripcion": "Indígena" }
    ],
    "tiposPartes": [
      { "id": 1, "descripcion": "Ofendido" },
      { "id": 2, "descripcion": "Procesado" }
    ],
    "magistrados": [
      { "id": 1, "descripcion": "Lic. Martínez Ruiz" }
    ],
    "delitos": [
      { "id": 1, "descripcion": "Robo simple" }
    ],
    "sexos": [
      { "id": 1, "descripcion": "Masculino" },
      { "id": 2, "descripcion": "Femenino" }
    ],
    "tiposEscritos": [
      { "id": 1, "descripcion": "Escrito de apelación" }
    ],
    "apelaciones": [
      { "id": 1, "descripcion": "Apelación de sentencia" }
    ],
    "tiposApelaciones": [
      { "id": 1, "descripcion": "Apelación principal" }
    ],
    "juzgados": [
      { "id": 1, "descripcion": "Juzgado Primero Penal" }
    ]
  }
}

GET /api/apelaciones/:idMunicipio/localidades

Returns the localities that belong to a given municipality. This endpoint is intended to be called lazily — after the user selects a municipality from the municipios catalog returned by /catalogos?materia=indigena.

Authentication

Required. Bearer JWT.

Path Parameters

idMunicipio
integer
required
The numeric ID of the municipality whose localities should be returned. Must be a valid integer; non-numeric values trigger a 400 error.

Response — 200 OK

status
string
"success"
message
string
"Catálogo de Localidades cargados correctamente"
data
object
data.localidades
CatalogoBase[]
Array of locality objects belonging to the requested municipality. Each item has id (number) and descripcion (string).

Error Responses

HTTP StatusReasonDescription
400 Bad RequestNon-numeric or missing idMunicipioPath parameter could not be parsed as an integer.
401 UnauthorizedMissing or invalid JWTAuthentication failed.
404 Not FoundMunicipality not foundNo municipality with the given ID exists in the catalog.

Example Request

curl 'http://localhost:4000/api/apelaciones/3/localidades' \
  -H 'Authorization: Bearer <token>'

Example Response

{
  "status": "success",
  "message": "Catálogo de Localidades cargados correctamente",
  "data": {
    "localidades": [
      { "id": 10, "descripcion": "San Juan Copala" },
      { "id": 11, "descripcion": "Yosoyuxi" }
    ]
  }
}

GET /api/apelaciones/:idApelacion/tipos-apelacion

Returns the sub-types that correspond to a top-level appeal catalog entry. Call this endpoint after the user picks an item from the apelaciones list (penal path only) to populate the tipoApelacion dropdown.

Authentication

Required. Bearer JWT.

Path Parameters

idApelacion
integer
required
The numeric ID of the top-level appeal catalog entry (CatalogoBase.id from data.apelaciones). Must be a valid integer; non-numeric values trigger a 400 error.

Response — 200 OK

status
string
"success"
message
string
"Catálogo de tipo apelación cargados correctamente"
data
object
data.tiposApelacion
CatalogoBase[]
Array of appeal sub-types. Each item has id (number) and descripcion (string). Pass the selected item’s id as idTipoApelacion when creating an appeal.

Error Responses

HTTP StatusReasonDescription
400 Bad RequestNon-numeric or missing idApelacionPath parameter could not be parsed as an integer.
401 UnauthorizedMissing or invalid JWTAuthentication failed.
404 Not FoundCatalog entry not foundNo appeal catalog entry with the given ID exists.

Example Request

curl 'http://localhost:4000/api/apelaciones/1/tipos-apelacion' \
  -H 'Authorization: Bearer <token>'

Example Response

{
  "status": "success",
  "message": "Catálogo de tipo apelación cargados correctamente",
  "data": {
    "tiposApelacion": [
      { "id": 1, "descripcion": "Apelación principal" },
      { "id": 2, "descripcion": "Adhesiva" }
    ]
  }
}

Build docs developers (and LLMs) love