Causa General search API

Search words and phrases in the OCR text of the Causa General (Archivo Histórico Nacional, published on PARES). Returns context snippets and locations, never whole pages or the corpus.

IMPORTANT: the source is an instruction compiled by the Franco regime; it contains accusations and statements that were never verified. The text is automatic OCR and contains errors, and handwritten pages are not read yet. A name that does not appear is not proof that it is absent from the archive. Every response carries this notice in the notice field.

Operation

GET /api/search?q=<tag>&q=<tag>&province=<value>&lang=en

The same parameters can be sent as a JSON body with POST /api/search ({"q": ["<tag>"], "province": ["<value>"], "lang": "en"}), so that search terms do not appear in URLs or in intermediary logs. The response is identical.

Case and accents are ignored (masferre finds Masferré; ç = c and ñ = n). Fuzzy matching tolerates OCR errors depending on word length: under 4 letters, none; 4 to 7 letters, 1 edit; 8 or more, 2 edits.

Archive terms are kept in the original language: province, piece (pieza) and judicial_district (partido judicial) values are Spanish, as in PARES.

Limits (the same for people and agents)

Response (200, JSON)

{
  "total": 16, "exact": 10, "approximate": 6, "partial": false, "pages": null, "facets_unit": "occurrences",
  "ms": 46, "truncated": false, "max_results": 200,
  "notice": "…",
  "facets": { "source": [["causa_general", 16]], "province": [["Barcelona", 12], ["Girona", 4]], "piece": […], "judicial_district": […] },
  "results": [ {
    "source": "causa_general", "province": "Barcelona", "piece": "…", "judicial_district": null,
    "shelfmark": "FC-CAUSA_GENERAL,1630,Exp.1", "image": 369, "total_images": 424, "pares_id": "5545508",
    "exact": true, "distance": 0, "doubtful": false,
    "before": "…preceding text", "match": [ {"text": "…"}, {"text": "Masferrer", "hit": true, "fuzzy": false, "distance": 0} ], "after": "following text…",
    "variants": [], "pares_url": "https://pares.cultura.gob.es/…/show/5545508?txt_id_imagen=369"
  } ]
}

Errors

{"error": {"code": "too_short", "message": "…", "params": {"n": 3}}, "notice": "…"}

Codes: empty, too_short, too_many_words, tag_too_long, timeout (HTTP 400); rate_limited, busy (HTTP 429).

Other endpoints

Terms of use

If you reuse results, cite the source following the instructions of PARES (the Spanish archives portal), not this service, and do not present results as official: this project is independent and has no connection with the Spanish Ministry of Culture. Do not crawl the HTML: this API is the intended way in.

← Search · llms.txt