Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/PDNMX/s1_backend/llms.txt

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

The /v1/summary endpoint fans a query out to all matching providers simultaneously and returns a summary of how many records each provider holds for the given search criteria. Because the gateway issues all upstream requests in parallel via Promise.all, response time is bounded by the slowest individual provider rather than the sum of all providers. This endpoint is designed for displaying aggregate totals across the federation — for example, showing how many asset declaration records each state-level system holds for a given public servant’s name. Each upstream call uses page=1 and pageSize=1 internally so that only record counts (pagination metadata) are returned, not full record payloads.

Endpoint

POST /v1/summary
Content-Type: application/json
No caller authentication is required.

Request Body

nivel_gobierno
string
Filter the set of queried providers by government level. Accepted values: "federal", "estatal", or "municipal". Mutually exclusive with institucion — if both are provided, institucion takes precedence.
institucion
object
Restrict the query to a single named provider. When present, this field takes precedence over nivel_gobierno.
nombres
string
Filter by the given names of the public servant whose records are being sought.
primerApellido
string
Filter by the public servant’s first (paternal) surname.
segundoApellido
string
Filter by the public servant’s second (maternal) surname.

Filter Precedence

When choosing which providers to query, the endpoint applies the following priority order:
  1. institucion — if present, only the provider whose supplier_id matches is queried.
  2. nivel_gobierno — if present (and institucion is absent), only providers whose levels array includes the specified value are queried.
  3. No filter — if neither field is provided, all configured providers are queried.
The internal upstream query always uses page=1 and pageSize=1 (summary mode). Name filters (nombres, primerApellido, segundoApellido) are forwarded to every selected provider. Empty strings, null, and undefined name filter values are ignored.

Example Request

curl -X POST http://localhost:3101/v1/summary \
  -H "Content-Type: application/json" \
  -d '{
    "nivel_gobierno": "estatal",
    "nombres": "Juan"
  }'

Response

Returns HTTP 200 OK with a JSON array containing one element per queried provider. Each element is either a successful summary or an inline error object.

Successful Provider Entry

Example — Successful Entry
[
  {
    "supplier_id": "EDOMEX",
    "supplier_name": "Secretaría Ejecutiva del Sistema Estatal Anticorrupción del Estado México",
    "levels": ["estatal"],
    "pagination": { "totalRows": 42, "page": 1, "pageSize": 1 },
    "results": []
  }
]
supplier_id
string
Unique identifier of the provider that produced this summary entry.
supplier_name
string
Human-readable name of the provider institution.
levels
array of strings
Government levels associated with this provider (e.g., ["estatal"]).
pagination
object
Pagination metadata returned by the upstream provider.
results
array
Record payload from the upstream provider. In summary mode this is typically an empty array or a single-item array, since only counts are needed.

Provider Error Entry

When an individual upstream provider fails, its entry in the response array is replaced with an error object instead of raising an HTTP 500 for the whole request.
Example — Provider Error Entry
[
  {
    "supplier_id": "EDOMEX",
    "supplier_name": "...",
    "levels": ["estatal"],
    "error": "Algo salió mal.",
    "totalRows": "No disponible"
  }
]
error
string
Human-readable error message. Always "Algo salió mal." for provider-level failures.
totalRows
string
Set to "No disponible" when the provider could not be reached or returned an error.
Provider-level errors are returned inline within the response array — they do not cause the gateway to return an HTTP 500. The outer HTTP response is always 200 OK as long as the gateway itself is healthy. Callers should inspect each array element for the presence of an error field to detect individual provider failures.

Error Responses

If the gateway itself encounters an unexpected failure after dispatching all upstream requests, it returns HTTP 500.
HTTP 500
{
  "error": "Algo salio mal..."
}
Note the deliberate lack of accent in "Algo salio mal..." — this is the verbatim string returned by the gateway’s outer error handler and differs from the per-provider inline error "Algo salió mal." (which carries an accent). HTTP 500 from this endpoint is rare; most provider failures are surfaced inline within the 200 OK response array.

Build docs developers (and LLMs) love