BOE open-data API: verified behaviour notes
Probed on 2026-11-21 with 120 requests in total (>= 1.2 s apart, User-Agent: boe-insights-mcp-dev/0.0 (open-source MCP server; API probe)). No 429 and no throttling were seen; the only 5xx responses were deliberate malformed queries.
Base: https://www.boe.es/datosabiertos/api/ (B below). Fixtures for every shape are in tests/fixtures/boe/ (see its README for the exact requests).
"Observed" = seen in a response. "Inferred" = my conclusion from observations. The request budget ran out before some checks; they are listed under "Unverified / open".
0. Overview of what the dataset is
legislacion-consolidadais not only BOE state law. Across the whole set (12 477 records at probe time) the first 10 000 by default order were: 9 913BOE-*ids and the rest regional gazettes (BOJA,DOGC,DOGV,BOA,BORM,BOC,BOIB,BON,BOCL...).ambitois1Estatal (7 053 of those 10 000) or2Autonómico (2 947). Regional laws that were republished in the BOE have aBOE-A-id butambito2. (observed)- JSON responses use the envelope
{"status":{"code":"200","text":"ok"},"data": ...}. Every number and date is a string. Dates areyyyymmdd, exceptfecha_actualizacion=yyyymmddTHHMMSSZ. - XML-to-JSON artefact (observed, important for parsing): a collection with exactly one element is serialised as an object, not a one-element list. Examples:
/analisismateriasis a list for most laws but an object for the Constitución;notasis an object ({"nota": "..."}) for Ley 40/2015 but a list of{"nota":[...]}for the Código Civil;referencias.anterioresis absent/nullfor the Código Civil; in the daily summariesdepartamento,epigrafe,itemare sometimes objects. An empty result is"data": ""(a string). Client code must normalise "absent / '' / object / list" into a list.
1. Search paging (GET B/legislacion-consolidada)
| Request | Result (observed) |
|---|---|
| no params | HTTP 200, 50 records, 64.6 KB, 1.6 s. Default page size is 50 |
limit=10 |
10 records, 13.8 KB, 1.4 s |
limit=100 |
100, 127 KB, 1.9 s |
limit=1000 |
1000, 1.28 MB, 4.9 s (about 1.28 KB per record) |
limit=5000&offset=10000 |
2 477 records (end of data), 3.1 MB, 10.4 s |
limit=20000&offset=12400 |
accepted, 77 records (not rejected, so the maximum is at least 20000; a full 20000 page was not requested) |
limit=-1 |
HTTP 200, exactly 10 000 records, 13 MB, 20.3 s. So -1 means "up to 10 000", not "all" (inferred: capped at 10 000 because limit=5000&offset=10000 shows more records exist) |
offset=50&limit=5 |
continues exactly where page one stopped (ids equal limit=-1 slice 50..54) |
offset=10000&limit=5 |
works; continues contiguously from record 9 999 (no 10 000 cap on offset) |
offset=12000&limit=5 |
5 records. offset=12400 gives 77, so the total was 12 477 |
offset=20000&limit=5 |
HTTP 200 with "data": "" (empty-string shape, not an error) |
- There is no total-count field: the body has only
statusanddata, and noContent-Range/X-Total-Countheader (the CORS header listsContent-Rangeas exposed but it is never sent). To count the matches of a query you must page through them, or request a largelimitand count (about 1.3 KB per hit, no field projection exists). - Ordering: without
sortthe order isfecha_actualizaciondescending (observed: the whole 10 000-record list is monotonic non-increasing; a query gives the same order as an explicitsort fecha_actualizacion desc). Identical requests returned byte-identical bodies (with sort and without), and paged slices equalled the corresponding slice of a larger page (both unsorted and withsort fecha_publicacion desc, 30 records vs offset 10 limit 10). Caveat (inferred): the default order changes whenever a law is updated, so a long crawl by offset can skip or repeat records. Sorting byfecha_publicacionis more stable but has many ties (secondary order unknown). - Valid
sortfields seen:fecha_publicacion,fecha_actualizacionandfecha_disposicion(asc/desc).sortontitulois a 400 ("can not sort on multivalued field: TITULOS"); an unknown sort field is a 400 "sort param field can't be found". - Typical latency 0.9 to 1.9 s for pages of up to 100 records. Time grows about linearly: roughly 5 ms per record.
Search hit shape (see search_page_limit10.json)
fecha_actualizacion, identificador, ambito{codigo,texto}, departamento{codigo,texto}, rango{codigo,texto}, fecha_disposicion, numero_oficial (missing for some resolutions/orders, e.g. BOE-A-2026-23892), titulo, diario, fecha_publicacion, diario_numero, fecha_vigencia, vigencia_agotada (N/S), estado_consolidacion{codigo,texto}, url_eli, url_html_consolidada. A hit has NO estatus_derogacion, estatus_anulacion, fecha_derogacion (only /metadatos has them).
2. Query language
Passed as the query URL parameter holding a JSON document:
{"query":{"query_string":{"query":"<expr>"},"range":{"<date field>":{"gte":"yyyymmdd","lte":"yyyymmdd"}}},"sort":[{"fecha_publicacion":"desc"}]}.
Fields accepted inside query_string (HTTP 200 and effective; observed unless noted):
* titulo (analysed text: case-insensitive and accent-insensitive, energía = energia = ENERGÍA, identical response bytes), texto (full-text of the body: texto:"ley del suelo" returns hits, a nonsense term returns empty; accepted, relevance of the hits not checked), numero_oficial (numero_oficial:"40/2015", also unquoted 6/2019 worked), identificador, fecha_disposicion, fecha_vigencia (also with range syntax fecha_vigencia:[20261122 TO 20301231], returned laws with vigencia 2026-12 to 2027-11), rango@codigo, departamento@codigo, ambito@codigo, estado_consolidacion@codigo, materia@codigo, vigencia_agotada (S/N), estatus_derogacion (returned exactly the vigencia_agotada=S set in a 200-hit sample, i.e. same flag, inferred), estatus_anulacion.
* Code syntax is field@codigo:value (e.g. rango@codigo:1300, departamento@codigo:3120 returned 100/100 hits of department 3120). Text variants such as materia:"Seguridad Social" are NOT valid (HTTP 500 code 101).
* Operators: AND, OR, NOT (AND NOT works), parentheses, double-quoted phrases all worked. Phrase matching is loose: titulo:"Ley 40/2015" returned 3 hits including two Reales Decretos. For references use numero_oficial plus rango@codigo (section 3).
* Anomaly (observed): rango@codigo:1300 (Ley) returned 2 hits of rango 1450 (Ley Foral) among 200; combined with titulo:energía one Ley Foral hit appeared. Treat rank filters as approximate and re-check rango.codigo on the hits.
* range supports fecha_publicacion (verified). Both bounds are required: a one-sided range (gte only or lte only) is silently ignored and the unfiltered result set is returned (identical bytes to the query without range). Dates are yyyymmdd. Combining the query with the range worked (2020 titulo:energía gave RD 1183/2020, RDL 38/2020...).
* Top-level from/to params filter on fecha_actualizacion, not publication: from=20260101&to=20260131&limit=5 returned 5 records whose fecha_actualizacion were all 20260130 and whose publication dates ranged from 1994 to 2026. to=20260131 includes records of 20260130 (inclusivity of the to day itself not tested).
* Errors (all XML bodies even with Accept: application/json, Content-Type: application/xml, shape <response><status><code/><text/></status><data/></response>):
* unbalanced parenthesis: HTTP 500, text Server error - Code: 101;
* unknown field (foo:bar): HTTP 500 Code 101 (same code as a syntax error, so they cannot be told apart);
* query not JSON: HTTP 500 Code: 109;
* valid JSON with unsupported structure (match_all): HTTP 400 El parámetro query tiene un formato no soportado.;
* bad sort field: HTTP 400 Search error: [sort param field can't be found: nonexistent][{"query":"(TITULOS:energía) ",... (leaks the internal index name TITULOS).
* Zero matches: HTTP 200, "data": "".
* Escaping (verified live on 2026-11-21): backslash-escaping query_string reserved characters inside a field value works. titulo:40\/2015, titulo:(Decreto\-ley AND medidas AND urgentes) and escaped parentheses and colons all returned HTTP 200, with sensible hits or an empty result and no syntax error. build_search_query relies on this.
* Sorting (verified live on 2026-11-21): sort also accepts fecha_disposicion (the enactment date). An ascending sort of rank 1290 (Ley Orgánica) returned Ley Orgánica 1/1979 first. The valid sort fields are therefore fecha_publicacion, fecha_actualizacion and fecha_disposicion.
3. Resolving "Ley 40/2015" and similar
Reliable recipe (observed): numero_oficial:"N/YYYY" AND rango@codigo:<code> AND ambito@codigo:1.
| Reference | Rank code | Query without rank | With rank (+ambito@codigo:1) |
|---|---|---|---|
| Ley 40/2015 | 1300 | 1 hit | 1: BOE-A-2015-10566 |
| Real Decreto 1065/2007 | 1340 | 1 hit | 1: BOE-A-2007-15984 |
| Ley Orgánica 3/2018 | 1290 | 13 hits (state LO + 11 regional Leyes + 1 regional decree-law) | 1: BOE-A-2018-16673 |
| Real Decreto-ley 6/2019 | 1320 | 8 hits (Circular CNMV, 6 regional Leyes, the RDL) | 1: BOE-A-2019-3244 |
Rank codes (table rangos): Ley 1300, Ley Orgánica 1290, Real Decreto 1340, Real Decreto-ley 1320, Real Decreto Legislativo 1310, Orden 1350, Resolución 1370, Circular 1390, Ley Foral 1450, Decreto 1510, Decreto-ley 1500, Decreto Legislativo 1470, Constitución 1070, etc. (19 total).
Tie-breaking: (1) always add the rank; (2) ambito@codigo:1 removes the regional laws, which are numbered independently (Ley 1/2015 gave 11 hits with rank 1300 alone, 10 of them ambito 2); (3) the departamento of national laws is typically 7723 Jefatura del Estado, state RDs vary; (4) if still more than one hit, prefer the one whose titulo starts with the exact words "Ley 40/2015," and then the earliest fecha_publicacion / the BOE-A- id (inferred; a collision with ambito=1, same rank, same number and year was not met). Note numero_oficial carries the year of the disposition, not of publication (Ley 3/2018 BOE-A-2019-3997 is a regional law published in 2019). For Órdenes and Resoluciones numero_oficial is often absent or like APA/315/2020.
4. Law metadata (GET B/legislacion-consolidada/id/{id}/metadatos)
Response data is a list with one object (fixtures metadatos_*.json). Fields: all the search-hit fields except url_* order differences, plus estatus_derogacion (N/S), estatus_anulacion (N/S), and, only when repealed, fecha_derogacion (yyyymmdd; Ley 30/1992: "20210402"). Ley 40/2015 (in force): estatus_derogacion N, vigencia_agotada N, estado_consolidacion {3,Finalizado}, fecha_vigencia 20161002, no fecha_derogacion. Ley 30/1992 (repealed): estatus_derogacion S, vigencia_agotada S, fecha_derogacion 20210402, fecha_vigencia 19930227, estado_consolidacion 3.
* fecha_vigencia is the date the law (original text) entered into force, not "valid until". It can be in the future for new laws (BOE-A-2026-24302 has 20270701).
* estado_consolidacion: table 3 Finalizado, 4 Desactualizado (consolidated text not yet updated for recent amendments). It says nothing about whether the law is in force. ambito: 1 Estatal, 2 Autonómico.
* vigencia_agotada equals estatus_derogacion in the 200-hit sample (both S). Hits carry only vigencia_agotada, so use vigencia_agotada for in-force filtering in search results, estatus_derogacion/fecha_derogacion from /metadatos for the date.
* Partial repeals: LO 15/1999 (replaced by LO 3/2018 from 2018-12-07, per the note in its text) still has estatus_derogacion N, vigencia_agotada N (the BOE keeps some provisions alive). So the flags mean "wholly repealed", not "superseded". The /texto response begins with a nota_inicial block ("Norma derogada, con efectos de 7 de diciembre de 2018...").
* A repealed law's blocks carry no repeal marker in the per-block XML (Ley 30/1992 a1 has one version, no marker).
5. Analysis (GET B/legislacion-consolidada/id/{id}/analisis)
data[0] keys: materias, notas (optional), referencias.
* materias: [ {"materia": {"codigo":"6936","texto":"Transportes marítimos"}} ] (object instead of list when single; materia may be object or list, only the object form was seen).
* referencias.anteriores: [ {"anterior": [ {"id_norma":"BOE-A-2014-9467","relacion":{"codigo":"210","texto":"DEROGA"},"texto":"Arts. 12 a 15 y disposición adicional 6 de la Ley 15/2014, ..."}, ... ]} ]. referencias.posteriores: same with key posterior and relacion.texto in the passive form (SE DEROGA, SE MODIFICA, SE AÑADE...). Ley 40/2015 had 19 anteriores and 24 posteriores. The Código Civil has no anteriores.
* Relation tables (relaciones-anteriores / relaciones-posteriores, 50 codes each, same codes): 2xx = corrections and repeals (201-204 corrections, 210-217 DEROGA variants, 220 ANULA, 230 DEJA SIN EFECTO, 231 SUSPENDE, 235 SUPRIME, 245 SUSTITUYE, 247 ENMIENDAS, 270-272 MODIFICA), 3xx = 300-303 PUBLICA, 330 CITA, 331 EN RELACIÓN; 4xx = 400 ACEPTA, 401 PRORROGA, 402 INTERPRETA, 404 ACTUALIZA, 406 AMPLÍA, 407 AÑADE, 408 COMPLETA, 420 APRUEBA, 421 AUTORIZA, 422 RATIFICA, 426/427 TRANSPONE, 430 ADHESIÓN, 440 DE CONFORMIDAD, 470 DECLARA (in practice a Constitutional Court ruling on the norm: see "Amendment chains"), 480 DECLARA la vigencia, 490 DESARROLLA; 5xx/6xx = constitutional proceedings (520 Conflicto, 530 Cuestión, 540 cumplimiento de Sentencia, 552/694 Recurso, 693 SE DICTA).
* notas: free text such as Entrada en vigor: el 2 de octubre de 2016 ....
Subject (materias) reliability
/analisis returns exactly ONE materia for each of 19 laws tested, and the choice looks arbitrary (mostly alphabetically late):
| Law | materia returned |
|---|---|
| Ley 40/2015 (sector público) | 6936 Transportes marítimos |
| Código Civil | 7097 Usufructo |
| Constitución | 1616 Constitución Española |
| Ley 29/1994 Arrendamientos Urbanos | 7163 Viviendas de Protección Oficial |
| Ley 12/2023 vivienda | 7163 Viviendas de Protección Oficial |
| Código Penal (LO 10/1995) | 6962 Tribunal del Jurado |
| LEC 1/2000 | 7126 Ventas a plazos |
| Ley 58/2003 LGT | 6977 Tribunales Económico Administrativos |
| Ley 35/2006 IRPF | 6924 Transparencia fiscal |
| Ley 27/2014 IS | 6896 Títulos valores |
| LO 2/2006 Educación | 5752 Profesorado |
| Ley 19/2013 Transparencia | 7896 Sistema financiero |
| Ley 24/2013 Sector Eléctrico | 7094 Urbanismo |
| Ley 39/2015 | 6499 Seguridad Social |
| RDLeg 2/2015 Estatuto Trabajadores | 6910 Trabajo |
| RDL 32/2021 reforma laboral | 6910 Trabajo |
| LO 3/2018 protección de datos | 6980 Tribunales Superiores de Justicia |
| Ley 9/2017 Contratos | 7012 Uniones Temporales de Empresas |
| Ley 7/2021 Cambio climático | 7116 Vehículos de motor |
Verdict: the /analisis materias value is NOT usable as the law's topic (inferred: the endpoint truncates a multi-valued list to one element). In contrast, the search filter sees the full multi-valued set: materia@codigo:6936 AND numero_oficial:"40/2015" returns Ley 40/2015; materia@codigo:5703 (Procedimiento administrativo) also matches it; materia@codigo:4107 (IRPF) matches Ley 35/2006, and 3188 (Energía eléctrica) matches Ley 24/2013. materia@codigo:6910 (Trabajo) returned a sensible set (ET, RD on equal pay, Prevención de Riesgos Laborales, LO 1/2004 violence) mixed with Ley 14/1986 Sanidad. Conclusion: use materia@codigo in search as a membership test (law X has topic T) and do not read the single value from /analisis. The full list of subjects of one law cannot be read from any endpoint I tested; recovering it would need one probe per candidate code. The materias table is a big flat thesaurus (6 822 entries, also used for ministries or organisations such as "Secretaría de Estado de Igualdad...") with no hierarchy, so topic analytics needs a curated mapping from codes to topics.
6. Text
GET B/legislacion-consolidada/id/{id}/texto/indice(JSON works):data: [ {"bloque": [ {"id","titulo","fecha_actualizacion","url"}, ... ]} ]. There is NOtipoin the index. Ley 40/2015: 267 blocks, 86 KB. Thetituloof encabezados isTÍTULO PRELIMINAR,CAPÍTULO I,Sección 1(non-breaking spacebetween the word and the number), articlesArtículo 1(NBSP in most),fecha_actualizacion= date of the last version of the block.GET .../texto/bloque/{id}andGET .../textoare XML only (Accept: application/jsongives HTTP 400 "No soportado ningún mime type de la cabecera Accept." with the XML error body;/id/{id}without suffix and/metadata-elialso returned that 400 with a JSON Accept, XML not retried because of the request budget).- Bloque XML:
<response><status/><data><bloque id="a48" tipo="precepto" titulo="Artículo 48"><version id_norma="BOE-A-2015-10566" fecha_publicacion="20151002" fecha_vigencia="20161002"><p class="articulo">...</p><p class="parrafo">...</p><blockquote><p class="nota_pie">...<a class="refPost">Ref. BOE-A-...</a></p></blockquote></version>...</bloque></data></response>./textowraps them as<data><texto><bloque>....tipovalues seen in/texto:nota_inicial,preambulo,encabezado,precepto,firma. The<p>classes seen:articulo,parrafo,nota_pie,siempreSeVe;<a class="refPost">and<strong>occur inside. - Versions: in chronological ascending order (oldest first), each
<version>is the complete text of that block as amended;id_normais the amending norm (the original law's id for the first version),fecha_vigenciais when that version starts. Examplea48of Ley 40/2015: v1BOE-A-2015-10566vigencia 20161002, v2BOE-A-2020-17340vigencia 20210101. IRPFa68: 13 versions, 267 KB for ONE article (a whole-law/textoof a big law can be several MB). Nofecha_caducidadattribute exists on versions; the end of a version is implicit (next version'sfecha_vigencia). Odd attribute: the last three versions of IRPFa68carryfpub=""in addition to the normal attributes, so parse attributes by name, do not assume the set. - Future version:
BOE-A-2026-24302a1has a single version withfecha_vigencia="20270701"(after the retrieval date 2026-11-21), i.e. text published but not yet in force. A client must select the latest version withfecha_vigencia <= today, and treat "none" as not yet in force. - Repealed article: LO 15/1999
a40has v1 (original text) and v2 (2018-07-31,BOE-A-2018-10751) whose body is<p class="parrafo"><strong>(Derogado).</strong></p>plus anota_pie"Se deroga por la disposición derogatoria única del Real Decreto-ley 5/2018". The marker is the text(Derogado).(alsosin contenidowas not checked). 7 such blocks in that law. Whole-law repeal gives only anota_inicialblock in/texto. - Block ids are opaque, NOT article numbers: Ley 40/2015 has
a1..a158for most articles but Artículo 46 bis isa4-2, 55 bis isa5-2, 84 bis isa8-2, 108 bis/ter/quater/quinquies/sexies area1-2..a1-6(the suffix-Nis a collision counter, the stem is not reliably the article number). Other ids:co,preambulo,tpreliminar,ti,ci,ci-2(second chapter I in another title),s1,ss1,da,da-2,daprimera,dacuaa,dfquinta,dd,df,no,pr. Map article numbers via the indextitulo(Artículo 46 bis), never by constructinga46bis. The ida46bisform was not seen anywhere.
6.1 Text probe 2 (2026-11-21, 43 requests, no 429/5xx; fixtures texto_*, error_404_* in tests/fixtures/boe/)
Verified in this second probe (observed unless marked inferred):
- The index never carries
tipo(checked on 13 indexes); the keys are exactlyid,titulo,fecha_actualizacion,url. Block ids are unique within an index in every law checked (0 duplicate ids in 2 444 Código Civil blocks and the 12 other indexes); titles are NOT unique, sotituloalone does not identify a block, onlyiddoes. - Sizes/times of
/texto/indice: Constitución 210 blocks 66 KB 1.8 s; Ley 39/2015 195 blocks 62 KB 1.3 s; Código Civil 2 444 blocks 763 KB 2.0 s (about 310 B per block; theurlis most of it); Ley 37/1992 (IVA) 307 blocks 98 KB; RD 1065/2007 365 blocks 116 KB. - Correction to the version-order statement above. Versions are in the order the server lists them, which is usually but NOT always ascending by
fecha_vigencia. Seen: IVAan(Ley 37/1992 annex, 20 versions) listsfecha_vigencia20150101 (BOE-A-2014-12329) and then 19950101 (BOE-A-1994-28968) and then 20170629, so one version is out of order; Ley 30/1992nolists the 2015 repeal note (emptyfecha_vigencia) BEFORE the 1992 original (19930227). Clients must sort byfecha_vigenciathemselves (empty = unknown, see below) and must not rely on the position. fecha_vigenciaCAN be empty (fecha_vigencia=""): RD 1624/1992dt(Disposición transitoria cuarta), last of 6 versions (id_normaBOE-A-2026-4667, published 20260228); and Ley 30/1992nofirst version (BOE-A-2015-10565, published 20151002; the same repeal note elsewhere gives 20161002 as effective date in its text). Inferred: empty means "effective date not given / defined by the text of the amending norm"; thefecha_publicacionis always present in the examples. Two versions sharing the samefecha_vigenciawere NOT seen (checked 62 versions); the samefecha_publicacionandfecha_vigenciaon adjacent versions did occur (e.g. IVAanv18/v19 are consecutive days). Ties are therefore possible in principle but unobserved.id_normaof the first version is the law itself in every block seen (BOE-A-1992-28740for IVAanv1,BOE-A-2015-10565for Ley 39/2015ti). Exception: thenoblock carries the id of the norm that wrote the note (the repealing law, e.g.BOE-A-2018-16673for LO 15/1999), and thenoof RD 424/2005 carriesBOE-A-2026-24190.- Unknown block in an existing law (
GET B/legislacion-consolidada/id/BOE-A-2015-10565/texto/bloque/zzz,Accept: application/xml): HTTP 404, body<status><code>404</code><text>La información solicitada no existe</text></status><data/>, identical to an unknown law and to a missingnoblock (error_404_unknown_block_zzz.xml). tipovalues seen in blocks:precepto,encabezado,preambulo,nota_inicial(plusfirmafrom the earlier probe). Shapes:encabezado(tiof Ley 39/2015,titulo="TÍTULO I") has ONE version with<p class="titulo_num">TÍTULO I</p><p class="titulo_tit">De los interesados en el procedimiento</p>;preambulo(id="preambulo", notituloattribute shown in the index, 33 KB for Ley 39/2015) one version ofp class="parrafo"/parrafo_2paragraphs; the annexanistipo="encabezado"(not "anexo") with<p class="anexo">paragraphs; disposiciones aretipo="precepto"(RD 1624/1992dt, 6 versions). Article-leveltituloattribute on the bloque equals the indextitulo.
Element and class inventory inside <version> (counted over the 13 block fixtures of this probe plus the earlier ones; IVA an and Ley 29/1987 a21 contribute most)
Elements: p 4 309, td 2 280, tr 930, a 396, th 107, table 64, tbody 64, blockquote 46, col 24, colgroup 12, thead 12, br 11, strong 10. No img, no formula/MathML, no ul/ol/li, no sup/em were seen (the absence of images and formulas is observed only in these laws; other laws were not searched).
p classes: parrafo, parrafo_2 (indented sub-paragraph), articulo (the heading line "Artículo N. Heading.", seen in the earlier probe), anexo, titulo_num, titulo_tit, nota_pie, nota_pie_2, siempreSeVe and textoCompleto (the two classes used inside nota_inicial), cita_con_pleca ("Redacción anterior:" label), centro_redonda, and table paragraphs cabeza_tabla, cuerpo_tabla_izq, cuerpo_tabla_centro, cuerpo_tabla_der. A <p> can be empty or contain only a non-breaking space (two such paragraphs follow the correction note in no of RD 1624/1992 and of Ley 30/1992).
a classes: refPost (385; text Ref. BOE-A-...#anchor); an a without class has href and target="_blank" and wraps a <br/> (the link to a corrección de errores); a can be nested inside a (<a class="refPost"><a class="refPost">Ref. ...</a></a> in no of Ley 30/1992).
Tables: <table class="tabla" border="0" summary="Tabla de datos" [width height]> containing <tbody> only, header cells as <th> with <p class="cabeza_tabla"> (Ley 29/1987 a21: one <tr> of five th, then tr of td); or <table class="ning_n_estilo_de_tabla"><colgroup><col class="row_column_11"/>...<thead><tr class="row_column_7"><td><p class="cabeza_tabla">.. (here the header cells are td, not th) followed by <tbody>. tr classes row_column_N. Every cell holds one or more <p> (cell text is not bare). No colspan, rowspan, or any attribute on td/th except class on 3 td was seen. Rows have different numbers of cells only across tables, not inside one (not exhaustively checked).
Blockquote: <blockquote> (40) or <blockquote class="noDesde20160101"> (1; the class is a date-bound visibility switch) as a direct child of <version>, always holding <p> children (nota_pie, parrafo, cita_con_pleca). "Téngase en cuenta" notes appear as <p class="parrafo">Téngase en cuenta ...</p> inside such a blockquote (IVA an) or as a p class="siempreSeVe" in a nota_inicial (Ley 11/2007). Footnotes ("Se modifica ...", "Redactado el punto 2 conforme a ...") are p class="nota_pie", directly under <version> or inside a blockquote. Editorial notes: footnotes and everything inside a <blockquote> are the BOE's own notes about the article (which norm modified it and how, "Téngase en cuenta ...", "Redacción anterior:"), not words of the law; they are published with the version but are not its text, so a quotation check compares only the other paragraphs and treats a match against the notes as "found in an editorial note".
Text directly inside <version> or <blockquote> without a <p>: NOT seen (0 occurrences in all fixtures: no non-blank .text or .tail). Inferred that the parser's fallback is only defensive.
Index title patterns
All patterns are observed. NBSP (U+00A0) occurs in Artículo N titles of Ley 39/2015 (133 of 195), Ley 40/2015, RD 186/2023 and RD 784/2021 (the 2015+ laws) but in none of the other 9 indexes checked (Constitución, IVA, Código Civil, RD 887/2006, RD 424/2005...); so always normalise.
| Pattern | Example titulo |
Example block id |
|---|---|---|
| Article, bare number, no heading, no period (all modern laws) | Artículo 14 |
a14 |
Article with bis/ter/quater/quinquies/sexies/quáter/quinque |
Artículo 8 bis, Artículo 140 quinque |
a8-2 (collision form) or a140bis (stem form); both occur, even in one law |
| Article range | Artículos 163 bis a 163 quáter |
as163bisa163quater |
| Article, ordinal word (old laws, 1960) | Artículo primero, Artículo doce, Artículo veintidós |
aprimero, adoce, aveintidos |
| Sole article (RD that approves a Reglamento) | Artículo único |
aunico or au |
| Código Civil abbreviated form (no "Artículo" at all) | Art 1, Art 94 bis, Art. 958 bis, Arts 127 a 130, Arts. 102 a 104 (also in RD 424/2005), Art. 1231 A 1253 |
a1, art2, a9 (= Art 94 bis!), art.1863bis, arts.1863bisa1873bis. |
| Código Civil untitled-number blocks (§, headings by name) | § 1, De la imputación de pagos, Disposiciones generales, Disposición general |
S1, delaimputaciondepagos, disposicionesgenerales |
| Disposición adicional / transitoria / final, ordinal | Disposición adicional primera, Disposición final séptima |
daprimera, dfseptima; also da, da-2, dd, df for later ones |
| Disposición, single | Disposición transitoria única, Disposición derogatoria única, Disposición final única |
dtunica, ddunica, dfunica |
| Disposición, no ordinal (Constitución) | Disposición derogatoria, Disposición final |
dd, df |
| Disposición ordinal beyond twelfth | Disposición adicional decimotercera |
da |
| Disposición with a 1ª-style numeral or "Disposición final 1" | NOT seen as a title (these appear in notes: disposición final 9) |
|
| Disposición heading text after the ordinal | NOT seen; titles are never Disposición adicional primera. Título... |
|
| Disposición, Código Civil style (bare ordinal under a group heading) | Primera, Séptima, DISPOSICIONES TRANSITORIAS |
primera, primera-2 (colliding with the adicionales), dt, da |
| Typo in source | Dispoosición adicional (trailing space) |
da (Ley 49/1960) |
| Libro / Título / Capítulo / Sección / Subsección, three casings | LIBRO PRIMERO, TÍTULO PRELIMINAR, TÍTULO II, CAPÍTULO PRIMERO, Capítulo I, CAPÍTULO ÚNICO, Sección 1, SECCIÓN 1, Sección 1ª, Sección primera, Subsección 1ª |
lprimero, tpreliminar, tii, cprimero, ci, cunico, s1, sprimera, s1a |
| Heading ids repeat with a counter | CAPÍTULO I (5 times in Ley 39/2015, 3 in the Código Civil title preliminar region, 40 CAPÍTULO II) |
ci, ci-2... cii-38 |
| Law title block | CÓDIGO CIVIL, REGLAMENTO |
codigocivil, reglamento |
| Annex | ANEXO (also the only annex title seen; ANEXO I was not seen) |
an |
| Linked-information block (non-text) | [Información relacionada] |
informacionrelacionada |
| Preamble / exposición de motivos | empty '' (Ley 39/2015, Constitución), or [preambulo] (RD 186/2023, RD 784/2021) |
preambulo or pr |
| Signature | empty '', or [firma] |
firma or fi |
| Initial note | empty '' |
no |
| Other empty titles | co (Ley 40/2015; meaning inferred, probably a cover/title block) |
co |
Findings on the questions: (1) articles are never titled with a heading after the number and never with a trailing period (only the range title Arts. 1863 bis a 1873 bis. ends in one); (2) Artículo único exists as its own title, not Artículo 1; (3) empty titles occur for preamble, firma, nota inicial, co; (4) two blocks with the SAME title "Artículo 1" exist: RD 1624/1992 (BOE-A-1992-28925, Reglamento del IVA) has a1 = Artículo 1 of the Real Decreto (index position 2) and a1-2 = Artículo 1 of the Reglamento (position 14); likewise Artículo 2 (a2, a2-2), and Disposición adicional única / Disposición transitoria primera appear twice in RD 424/2005 (daunica, daunica-2). Such duplicates are distinguishable only by position and by id order (the second carries -2); blocks between them are an ANEXO/REGLAMENTO heading. The locator must report ambiguity and list candidates rather than pick one. (5) Ids are unique within a law; the collision counter -N is not tied to the article. Inferred: the original-text block keeps the unsuffixed id.
Initial note (no, tipo="nota_inicial")
- Listed in 5 of the 13 indexes fetched in this probe: LO 15/1999 (
no,fecha_actualizacion20181206), Ley 30/1992, RD 424/2005, RD 887/2006, RD 1624/1992; absent from the other 8 (Constitución, Ley 39/2015, Código Civil, Ley 37/1992, Ley 49/1960, RD 1065/2007, RD 186/2023, RD 784/2021). The index entry has an emptytitulo. GET .../texto/bloque/no(Acceptapplication/xml): present -> HTTP 200, 0.5 to 2 KB,<bloque id="no" tipo="nota_inicial">with one or more<version>; absent -> HTTP 404 with the standard "La información solicitada no existe" body (Ley 39/2015, Ley 40/2015, Ley 30/2007, Ley 7/2007, RDLeg 1/2008). So no index is needed: a singleGET .../texto/bloque/noanswers it, costing ONE request per law (about 1 s; one call took 9.4 s).- A
nota_inicialis NOT always a repeal. Non-repeal notes seen: RD 424/2005 (in force) "Con efectos de 1 de enero de 2027, esta norma pasa a denominarse ..."; RD 1624/1992 and RD 887/2006 "Incluye la corrección de errores publicada en BOE núm. ..." (classtextoCompleto). Repeal notes use classsiempreSeVe. - Wording variants (first sentence, all start with
Norma derogada): - LO 15/1999: "Norma derogada, con efectos de 7 de diciembre de 2018, sin perjuicio de lo previsto en la disposición adicional 14 de la Ley Orgánica 3/2018, de 5 de diciembre, según establece su disposición derogatoria única."
- Ley 30/1992: "Norma derogada, con efectos de 2 de octubre de 2016, por la disposición derogatoria única.2.a) de la Ley 39/2015, de 1 de octubre." (second paragraph: "No obstante, hasta el 2 de abril de 2021, se mantuvieron en vigor ...")
- Ley 11/2007: "Norma derogada, con efectos de 2 de octubre de 2016, por la disposición derogatoria única.2.b) de la Ley 39/2015, de 1 de octubre." (then "Téngase en cuenta que ...")
- Ley 22/2011: "Norma derogada, con efectos de 10 de abril de 2022, por la disposición derogatoria primera.1 de la Ley 7/2022, de 8 de abril."
- Ley 7/2010: "Norma derogada, con efectos de 9 de julio de 2022, por la disposición derogatoria única 1.b) de la Ley 13/2022, de 7 de julio." (then a transitional-regime paragraph)
Wording is stable:
Norma derogada, con efectos de <date>, .... Other variants (e.g. "derogada parcialmente", "vigencia agotada") were NOT seen in this sample; inferred possible. - The note can have several versions (Ley 11/2007: 2; Ley 30/1992: 2, the repeal note first and with empty
fecha_vigencia, the original-text note "Incluye las correcciones de errores..." second). The repeal note is repeated in each version. - The note is NOT a complete detector. Ley 30/2007 de Contratos del Sector Público is wholly repealed (
/metadatos:estatus_derogacionS,fecha_derogacion20111216,vigencia_agotadaS) butbloque/noreturns 404. Ley 7/2007 (EBEP) and RDLeg 1/2008 also return 404 (their repeal status was not checked, inferred repealed/superseded for 7/2007). LO 15/1999 hasestatus_derogacionNin/metadatosyet its note says "Norma derogada" (the note is the only signal there). The reverse (a note starting "Norma derogada" on a law whose metadata say not repealed) is LO 15/1999 again. - Recommended rule (for wholly repealed): treat a law as wholly repealed if EITHER
/metadatoshasestatus_derogacion == "S"(1 request, usually already needed) OR itsbloque/no(1 request, 404 = none) has any version whose first<p>text, after NBSP/whitespace normalisation and case-folding, starts withnorma derogada. Do not use the mere existence ofno. Report which signal fired. Cost: 1 request when metadata suffice andS; otherwise 2. Do not match the word "derogad" anywhere in the note (corrections and renames do not use it, but notes can mention repeals of other norms; inferred).
7. Auxiliary tables (GET B/datos-auxiliares/{name})
All return {"status":..., "data": {"<code>": "<text>"}}: an object, code to text, not a list. Sizes: materias 6 822 entries (337 KB, 1.9 s), departamentos 211 (10 KB), rangos 19, ambitos 2 (1 Estatal, 2 Autonómico), estados-consolidacion 2 (3 Finalizado, 4 Desactualizado), relaciones-anteriores 50, relaciones-posteriores 50. Note rangos is a mix of state and regional ranks. Codes are strings. Texts may have trailing spaces (SE DEROGA tácitamente).
8. Daily summaries
GET B/boe/sumario/20261120(Friday): 407 KB, 1.8 s.data.sumario.metadatos{publicacion,fecha_publicacion},diario: [ {numero, sumario_diario{identificador:"BOE-S-2026-289", url_pdf{szBytes,szKBytes,texto}}, seccion:[ ... ]} ](diariois a list). Sections observed:1,2A,2B,3,5A,5B,5C(no sections 4 or 6 here). Nesting:seccion > departamento{codigo,nombre} > epigrafe{nombre} > item, orseccion > departamento > itemdirectly (sections 5A/5B), or a department with onlytexto(section 5C).item:identificador(BOE-A-2026-24291),control,titulo,url_pdf{szBytes,szKBytes,pagina_inicial,pagina_final,texto},url_html,url_xml. 282 items that day. All collection levels collapse to objects when there is one element.GET B/borme/sumario/20261120: 80 KB, 1.5 s.diario[0].numero 223,sumario_diario.identificador BORME-S-2026-223,seccionwith codesA(31 items),B(a single item, serialised as an object),C(no items, probably text only). Items:identificador(BORME-A-2026-223-01),titulo(a province,ARABA/ÁLAVA),url_pdf,url_html,url_xml. Nodepartamentolevel.- Sunday and pre-1978 date behaviour: NOT verified (budget exhausted).
9. HTTP behaviour
Acceptis selected byVary: Accept.application/jsonworks on search,/metadatos,/analisis,/texto/indice,datos-auxiliares/*,sumario./textoand/texto/bloque/*only answer XML. JSONAccepton those: HTTP 400No soportado ningún mime type de la cabecera Accept.(XML body,<code>400</code>). A request with theAcceptheader absent and a 404 for an unknown id were NOT tested.- Errors always come as XML with the same envelope, even for JSON requests (HTTP 400/500).
- Caching: responses carry no
ETag,Last-ModifiedorCache-Control(onlyDate,Age,Vary: Accept,Accept-Ranges: bytes,Strict-Transport-Security, CORSAccess-Control-*).Agewas 0 or small (e.g. 52 s on the sumario), so there is a front cache. Conditional requests (If-None-Match,If-Modified-Since) were not sent; with no validators offered they cannot work (inferred). - No gzip: with
Accept-Encoding: gzipnoContent-Encodingcame back on four large responses (13 MB search, 337 KB materias, 134 KB texto, Ley 40/2015). Large responses useTransfer-Encoding: chunked. - No rate-limit headers (
X-RateLimit-*,Retry-After) seen. No 429 at about 1 request per 1.2 s. - Encoding: UTF-8 (
<?xml version="1.0" encoding="utf-8"?>); JSON uses\uXXXXand\/escapes, and uses non-breaking spaces () intituloof blocks. - JSON vs XML parity: only checked via fixtures that exist in one format. Equivalence of the two representations of the same endpoint was NOT verified.
10. robots.txt (https://www.boe.es/robots.txt, 499 KB, 12 434 Disallow lines, one User-agent: * group, no Crawl-delay or Sitemap)
- Nothing mentions
/datosabiertos/or/api/. None of the idsBOE-A-2015-10566,BOE-A-2015-10565,BOE-A-1889-4763,BOE-A-1978-31229appears. - Relevant lines, quoted:
Disallow: /diario_boe/xml.php?andDisallow: /diario_borme/xml.php?(theurl_xmlitem links of the summaries are therefore disallowed for crawlers; "# Descartar xml"),Disallow: /datos/pdfs/("# No duplicar los pdfs"),Disallow: /diario_boe/verifica.php?,Disallow: /buscar/legislacion.php?,Disallow: /buscar/legislacion_ava.php?,Disallow: /buscar/boe.php?,Disallow: /buscar/anboe.php?,Disallow: /buscar/personal.php?, ... (search result pages), language variantsDisallow: /buscar/act.php?*lang=en(also ca, va, gl, eu, fr) and/buscar/doc.php?*lang=..,/diario_boe/txt.php?*lang=..,Disallow: /boe_n/,/boe_j/,/notificaciones/,/edictos_judiciales/. - About 12 000 further lines block individual items and days:
Disallow: /buscar/act.php?id=BOE-A-2026-4920,Disallow: /*BOE-A-2026-4920.pdf,Disallow: /boe/dias/2026/03/02/(whole days, many of 1999 etc.), and a fewAllow:for two specific BOE ids. The HTML linkurl_html_consolidada(/buscar/act.php?id=...) is not blocked as such (only withlang=and for the listed ids). The API itself is the supported machine route; do not fetch/buscar/orxml.phppages.
Implications for the client
- Page size: use
limit=100for interactive paging (127 KB, ~2 s),limit=1000for bulk (1.3 MB, ~5 s). Avoidlimit=-1(13 MB, 20 s). Always pass an explicitlimit. - Paging: loop
offset += len(page)until the page is empty, and also stop whendata == ""or a short page arrives. Counting results costs a full download of the matching set (about 1.3 KB per hit); for a total, one request with a very largelimitandlen(data)is cheapest in round trips, bounded by 10 000 for-1. For "is there more" checks uselimit=1&offset=N. Add a max-pages guard. - Use an explicit
sortfor stable paging (fecha_publicacion+ ids de-duplicated client-side) when crawling; unsorted order moves as laws are updated. De-duplicate byidentificador. - Normalise single-element collections (object vs list vs
""/absent) in one helper. Treat the status code from the XML error body whenContent-Typeisapplication/xmleven if JSON was requested. - Retry policy: do not retry 400 (and 500 with code 101/109, which are query errors). Retry timeouts, connection errors and unexpected 5xx up to 3 times with exponential backoff (1, 2, 4 s) and jitter; honour
Retry-Afterand 429 if they ever appear (never seen). Keep at least 1 s between requests; send an identifying User-Agent; always sendAccept. - Cache lifetimes (no HTTP validators exist, so cache client-side; these are suggestions):
datos-auxiliares/*7 days (code tables are static, materias is 337 KB); search results 15 to 60 min (updates appear within the day,fecha_actualizacionof the head record was minutes old);/metadatosand/analisis6 to 24 h, keyed byfecha_actualizacionfrom search hits (re-fetch when the hit'sfecha_actualizacionis newer);/texto/indiceand/texto/bloquekeyed by blockfecha_actualizacion(indefinite while it is unchanged);boe/sumario/{date}past days immutable (cache for good; do not cache today's for more than ~1 h until published), a day with no publication should be cached shortly. - Fields to trust:
identificador,titulo,fecha_publicacion,fecha_disposicion,rango.codigo,numero_oficial(when present),departamento.codigo,ambito.codigo;vigencia_agotadaand, from/metadatos,estatus_derogacion/fecha_derogacionfor being repealed (a repealed flag means wholly repealed; partially superseded laws keepN). Do not trust:/analisismateriasas a topic (single arbitrary item);estado_consolidacionas an in-force signal;fecha_vigenciaas a validity end;rango@codigofilter as exact (anomaly with 1450);url_xmlfor fetching (robots.txt). - Resolving references: use
numero_oficial:"N/YYYY" AND rango@codigo:C AND ambito@codigo:1(section 3). - Topic analytics: filter by
materia@codigoin search, curate a topic-to-materia-code mapping, and count by the filter; do not derive topics from/analisis. - Text parsing: get article numbers from index
titulo, strip NBSP; versions chronological, pick the last withfecha_vigencia <= date; detect repeal by the(Derogado).text; parse attributes by name; expect multi-MB responses for whole-law/texto, so prefer per-block requests with the index.
Verified after the probe (2026-11-21)
- Unknown id (
GET B/legislacion-consolidada/id/BOE-A-1900-99999/metadatos, JSONAccept): HTTP 404, XML body<status><code>404</code><text>La información solicitada no existe</text></status><data/>. - No
Acceptheader at all: HTTP 400, XML body, textNo reconocido el formato de la cabecera Accept. - Sunday summary (
GET B/boe/sumario/20261115): HTTP 404 with the same body as an unknown id, so "no publication that day" and "unknown resource" are indistinguishable by response alone.
Verified after the second probe (2026-11-21)
- Block ids can contain dots: the index fixtures list
a51ter.,a51quater.(BOE-A-1992-28925),art.1231a1253andarts.1863bisa1873bis.(Código Civil).GET B/legislacion-consolidada/id/BOE-A-1992-28925/texto/bloque/a51ter.and…/BOE-A-1889-4763/texto/bloque/art.1231a1253both return HTTP 200. A client must therefore accept.in block ids while still treating the id as a single path segment. - A version whose body is
(Sin efecto)marks a provision that no longer applies (last version ofdtinBOE-A-1992-28925); treat it like(Derogado).
Verified after the third probe (2026-11-21)
56 requests, >= 1.5 s apart, no 429. The raw bodies were kept outside the repository; every fact that the code relies on is recorded below and the selected fixtures are in tests/fixtures/boe/.
Bulk download of the catalogue
- Effective maximum
limitis 10 000:limit=13000returns exactly 10 000 records (13 025 151 bytes, 22 s, identical size tolimit=10000). Never rely on a larger page. Sizes: 1000 = 1.3 MB / 5 s, 5000 = 6.7 MB / 13 s, 10000 = 13 MB / 23 s (about 1.3 KB and 2.5 ms per record). A full crawl atlimit=5000(offsets 0, 5000, 10000) took 3 requests, 16.1 MB, 33 s and returned 12 477 records with 12 477 unique ids, no gaps; the last page is short (2 477). The 25 MB cap is safe for pages of 5000. - Sorting:
query={"query":{"query_string":{"query":"*"}},"sort":[{"fecha_publicacion":"desc"}]}works and was monotonic over all hits. Thequery_stringis optional ({"sort":[...]}alone is accepted too). Pages of different sizes cut from the same sorted list were identical in content and order, so ties (up to 16 records per publication date; 6 777 distinct dates) are broken deterministically in a short window.fecha_publicacionnever changes for a record, so it is the safest paging key; the default order (fecha_actualizacion) moves records when laws are updated (a 70-record tie group exists at 20251216T102453Z). - Hit keys over the whole catalogue (every key is absent, never empty, when missing): always present
fecha_actualizacion,identificador,ambito,departamento,rango,fecha_disposicion,titulo,diario,fecha_publicacion,diario_numero,vigencia_agotada,estado_consolidacion,url_html_consolidada; sometimes missingfecha_vigencia(95, mostly Resoluciones/Órdenes),url_eli(252: all 245 regional-gazette ids and 7BOE-A-ids),numero_oficial(1 804). Nomaterias,estatus_*,fecha_derogacionin hits. - Coverage (12 477 records):
ambitoEstatal 8 854 / Autonómico 3 623. 12 232 ids start withBOE-A-(3 378 of them are autonomic laws republished in the BOE, 37 are Gaceta de Madrid, 1835-1936); 245 ids are regional gazettes, all ambito 2:BOJA-b58,BOA-d44,BORM-s31,DOGV-r30,BOCL-h21,DOGC-f20,BOC-j11,BOIB-i8,BON-n6,DOCM-q/DOG-g/BOCT-c/BOPV-p3 each,BOCM-m/DOE-e2 each. 384 records before 1978; 1978-2026 about 43 to 774 a year (peak 2020, 774). 19 rangos, 149 departamentos. Top rangos: Ley 3 812, Real Decreto 3 535, Orden 2 420, Resolución 842, Real Decreto-ley 320. - Topic filters in bulk:
materia@codigo:6819(Tabaco) gave 68 hits (88 KB, 1.6 s);materia@codigo:3685(Ficheros con datos personales; there is no plain "Protección de datos" subject) 33 hits.texto:tabacowith a 2000-2026 range gave 463 hits in 4.7 s (601 KB);titulo:tabaco23 hits. Latency follows the number of hits, not the text size, so body-text search is not slow.texto:is a real body search (hits mention the word only in passing). - No count or projection exists:
limit=0returns"data": "";fields=identificadorgives HTTP 400Parámetros no soportados;"_source"inside thequeryJSON gives 400El parámetro query tiene un formato no soportado.;HEADworks and returns theContent-Lengthof the body it would send (no count).
Regional laws and publication dates
- The first-publication note of a regional law republished in the BOE is in
/analisisdata[0].notas(not in/metadatos, andbloque/nowas 404). Wording (10 of 10 samples):Publicada en el <GAZETTE> núm[.] <N>, de <D> de <mes> de <YYYY>[.]with GAZETTE in BOPA, BON, BOPV, DOG, BOC, BOCM, BOJA, DOE;númmay lack the period, the final period may be missing.notasfollows the usual collapse: an object{"nota": "..."}, or a list[{"nota": ["...", "Publicada en ..."]}]where other notes (Vigencia hasta ...) share the list, so scan every string. - For
BOE-A-regional laws (ambito2) the hit/metadatafecha_publicacionanddiario_numeroare the BOE reprint (Asturias BOE-A-2026-23272: 20261106, BOE 277), while the original version's<version fecha_publicacion>is the regional gazette date (20261023 = the note's date); this held in 5 of 5 laws compared (Asturias, Navarra 1991, País Vasco 1998 reprinted in 2011, Galicia, Madrid). Reprints can come decades late (a 1998 Basque law isBOE-A-2011-20659,fecha_publicacion20111231, version date 19980710). - Laws with regional-gazette ids (
DOGC-f-,BOJA-b-,DOGV-r-):diariois the regional gazette name,diario_numeroits issue,fecha_publicacionthe regional date and it equals the original version's date (3 of 3); there is no BOE reprint date./textoworks for them. Their versions carryid_norma="BOE-A-<year>-9xxxx"(e.g.BOE-A-2017-90436forDOGC-f-2017-90436), an alias that is not theidentificador./analisisofDOGC-f-2017-90436has nonotas. For state laws the original version'sfecha_publicacionequals the metadata date (Ley 40/2015, Constitución). - The first article block is not always
a1(BOJA-b-2022-90314andBOE-A-2019-8794returned 404 fora1; BOJA's isap).
Text structure
- Full
/textosizes: Asturias law (184 blocks) 0.29 MB / 1.8 s; Ley 40/2015 (267 blocks) 0.71 MB / 2.3 s; Código Civil (2 444 blocks, 3 836 versions) 3.0 MB / 4.4 s./texto/indicein XML (Accept: application/xml) has only<id>,<titulo>,<fecha_actualizacion>,<url>: no heading text. Only/textocarries headings in one request. - Block
tipovalues:precepto,encabezado,preambulo,firma,nota_inicial,parte_dispositiva(Código Civil enacting text). Thenota_inicialid iscoin Ley 40/2015 (text:Incluye la corrección de errores publicada en BOE núm. 306, ...), not onlyno. Thetituloattribute is missing on some blocks (nota_inicial,preambulo,firma,parte_dispositiva) and is[preambulo]/[firma]in others. - Heading classes inside
encabezadoversions:libro_num+libro_tit,titulo_num+titulo_tit,capitulo_num+capitulo_tit, singleseccion(number and title in one paragraph:Sección 1.ª De los órganos administrativos), singlesubseccion,anexo, and a single-paragraphcapitulo(CAPÍTULO ÚNICO,DISPOSICIONES ADICIONALES). Nesting is not in the XML: blocks are a flat list and the hierarchy is implied by order. Irregular headings exist (number only, title only,titulo_num+seccionin one block, a "Téngase en cuenta"parrafoinside a heading block). Otherpclasses:sangrado,sangrado_2,sangrado_articulo,cita,firma_ministro,firma_rey, and a<p>without class. - Articles:
<p class="articulo">Artículo 1. Objeto.</p>; modern laws carry the heading (Asturias 134 of 148 preceptos, Ley 40/2015 166 of 219). Disposiciones arepreceptoblocks whose first paragraph is alsoclass="articulo"with a heading after the ordinal (Disposición adicional primera. Cobertura de puestos...), although the index title is only the ordinal. The Código Civil has bareArtículo 1.in 1 979 of 2 022 articles and suffixes such as(Derogado)or(Sin contenido)appear on the heading line. - Headings change between versions (Código Civil: 20 multi-version
encabezadoblocks, 51 articles whosearticuloline differs; e.g.tpreliminar1889De las Leyes, de sus efectos...vs 1974De las normas jurídicas, su aplicación y eficacia;art307Artículo 307.vs 1983Artículo 307. (Sin contenido)). Thetituloattribute can differ from the*_numtext (TÍTULO PRIMEROvsTÍTULO I; 40 blocks in the Código Civil). <bloque>can carryfecha_caducidad(yyyymmdd). It marks a block that no longer exists in the consolidated text; what the date means is under "Whatfecha_caducidadmeans" below. This is a block attribute; versions have none./texto/indicestill lists those blocks (index and/textoboth have 2 444 blocks in the Código Civil).- Some
preceptoblocks are headings, not articles: they have noarticuloparagraph but aseccion,titulo_num+titulo_tit(or another heading class) paragraph. The Código Civil has 55 (sprimera-2"Sección 1.ª Disposiciones generales",tx"TÍTULO X",disposicionpreliminar). Article labels writtenArt,Art.,ArtsorArts.(with or without the period) occur in the same code. - Block order in
/textois not always document order (Código Civil starts withpreambuloandfibeforecodigocivil); block ids repeat with-Ncounters, so key onid, never ontitulo.
What fecha_caducidad means
- Measured on the Código Civil: 167 blocks carry the attribute, 164 with a real date and 3 without a usable one (one is the sentinel
00000001). For 37 of the 164 the last version starts after the date (gaps from 92 days to almost 10 years, median 366 days), for examplea325(caducidad 2011-07-22, last version 2021-04-30) andart301(caducidad 2021-06-03, last version 2021-09-03). - Reading: the date is the publication date of the law that removes the block, not the day the removal takes effect, and the text keeps its last version until then. Treating the date as the removal day dropped 74 to 107 articles that were in force on the dates between 2001 and 2021 that were checked.
- Rule used by
get_law_structure: a block with a marker is absent from the later offecha_caducidadand the start of its latest version on; before that day it is listed with its normal state. With the sentinel (no usable date) it is absent from the start of its latest version on; with no start date either it is absent always. Today's table of contents of Ley 40/2015, the Asturias law and the Código Civil is the same under the old and the new rule (all markers are in the past and every later version has started).
Coverage of the collection by year
The collection does not hold every law of a year, and how much it holds varies. Laws present in the catalogue (12 477 records) against the highest official number "N/YYYY" seen that year, state laws:
| Rank | Year: present / highest number |
|---|---|
| Real Decreto-ley | 1993: 2/22, 1997: 1/15, 2005: 2/12, 2012: 25/29, 2020: 38/39, 2025: 4/16, 2026: 27/35 |
| Ley | 1980: 18/75, 1997: 18/66, 2003: 47/62, 2022: 38/39 |
- Coverage is thin before about 2010 and for the most recent year or two, and nearly complete in between (the highest number is a lower bound of the laws enacted, so the true shortfall is at least this). A count per year of a rank is therefore not a measure of how much was legislated.
highest_numberinlegislation_over_timeis this figure, computed from the downloaded catalogue (state laws of one rank whosenumero_oficialis "N/YYYY" with that year); it is only reported for the ranks numbered afresh every year (Ley, Ley Orgánica, Real Decreto-ley, Real Decreto Legislativo). Regional laws also have the rank Ley (Ley 2015: 155 laws of every scope against a highest state number of 48), so for Ley it is only reported with the state scope; the other three ranks exist only at state level.
Publication lag after enactment
- From
fecha_disposiciontofecha_publicacion(2015 on): state laws median 2 days, 90th percentile 15, 99th 61; regional laws median 32 days, 90th 74, 99th 168 (up to 1 900 days for reprints). - Of the laws enacted in 2023-2025, 36% were published after the end of their month (10% more than 30 days after), and 53% of regional laws after the end of their quarter. Counting by enactment date therefore leaves the last months incomplete; 90 days is used as the settling time.
Departments that changed code
- One institution can appear under two department codes: Comunitat Valenciana is
8161"Comunidad Valenciana" (94 laws, 1984-01-11 to 2006-02-21) and8162"Comunitat Valenciana" (173 laws, 2006-06-07 to 2026); the Balearic Islands are8120"Comunidad Autónoma de las Islas Baleares" (39 laws, 1984-05-09 to 1998-12-15) and8121"Comunidad Autónoma de las Illes Balears" (225 laws, 1999-02-04 to 2026). Ministries are also renamed and recoded when governments reorganise, so the code alone does not identify a continuing institution. The trend tools merge these pairs under the newer code and label. A third pair is only seen in the daily summaries: Comunidad de Madrid is8130in the summaries of 1990 and 2000 and8131in the departments table (see "Daily summaries"); the gazette filter compares department codes through the same mapping, ignoring leading zeros.
Amendment analysis
/analisiscosts about 1 s whatever the size; bytes grow with the number of references (Constitución 8.8 KB, Ley 40/2015 20.8 KB, Estatuto de los Trabajadores 32.9 KB, Código Civil 39.9 KB, IRPF 68.6 KB). No bulk route exists:GET .../legislacion-consolidada/analisisis 404No se ha localizado la operación requerida.; unknown search fields (posteriores:,referencia:) give HTTP 500 code 101.- Each referenced norm appears once in
posteriores(one row per norm, not per provision). Rows are{id_norma, relacion{codigo,texto}, texto}.posterioresis a list of{"posterior": [...]}wrappers, a dict with a single entry (BOE-A-1991-23616), ornull. - Relation codes seen in 301
posterioresrows over 7 laws: 270 SE MODIFICA 188, 470 SE DECLARA 28, 210 SE DEROGA 23, 407 SE AÑADE 16, 440 SE DICTA DE CONFORMIDAD 12, 203 SE CORRIGEN errores 9, 230 SE DEJA SIN EFECTO 7, 331 and 693 3 each, 201/490/530/552 2 each, 245/402/202/694 1 each. Cross-check with<version id_norma>in/texto: all 14 amending norms of Ley 40/2015 are inposteriores, and the 10 rows that are not version sources are 440 (5), 203/201 (3), 490, 470; of the Código Civil's 85 rows 68 are version sources (53 SE MODIFICA, 11 SE DEROGA, 1 each DEJA SIN EFECTO, SUSTITUYE, INTERPRETA, DECLARA) and the 17 that are not are 470 (15) and 530 (2). Amendment set used by the tools: 210-217, 220, 221, 230, 231, 235, 245, 247, 270-272, 401, 404, 406, 407, 408; not amendments: corrections (20x), citations (33x), approvals/implementation (4xx) and court proceedings (470, 5xx, 69x). Key oncodigo, not on text (trailing spaces, mixed case).
Verified after the fourth probe (2026-11-21)
48 requests, same etiquette as before; no 429 or 5xx.
Daily summaries (GET B/boe/sumario/{yyyymmdd})
- Range: the first available day is 1960-09-01 (200,
BOE-S-1960-210, 45 items);19600831and every earlier sampled date are 404. Every sampled day from then on is 200 (20 samples, 1960 to today), including a public holiday (2026-01-01) and today's Saturday issue (20261121, issued, 285 items). The 1978-12-29 summary has one item only (the Constitución, 2 KB): real data. - Errors (always XML bodies): Sunday, future date and pre-1960 date are all 404
La información solicitada no existe(cannot be told apart). 400El parámetro fecha no cumple el formato.for20261301,2026-11-20and202611; 400Identificador no válido o parámetros incorrectosfor a well-formed impossible date (20260231). No range, month or year form:sumario?desde=...&hasta=...and baresumarioare 404No se ha localizado la operación requerida. - Size: min 2 KB, median 197 KB, max 472 KB (2020-03-14, two issues); 1 to 2 s each (one first hit for 2000-06-14 took 12.9 s, the repeat 1.9 s with an identical body). Items: median 134, max 419. XML (
Accept: application/xml) is 169 KB against 303 KB for the same day (2025-06-11) and has the same 212 items; it uses attributes (<diario numero>,<seccion codigo nombre>,<url_pdf szBytes ...>URL</url_pdf>), repeated elements instead of lists, and notextowrapper. - Item ids: only
BOE-A-(sections 1, 2A, 2B, 3,T) andBOE-B-(4, 5A, 5B, 5C; about 60 % of items).control(e.g.2025/9047) exists onBOE-A-items from 2009 only;url_htmlandurl_xmlare missing on someBOE-B-items before 2009;url_pdf.pagina_inicial/finalwere always present. Only 0 to 10 % of a day'sBOE-A-ids are in the consolidated catalogue (0 of 87 on 2025-06-11, 6 of 146 on 2026-11-20, 7 of 76 on 2020-06-10; 5 of the 7 section-1 items that day), so most summary ids do not resolve in/legislacion-consolidada. - Section names change with the era (key on
codigo):2A/2Blose or gain "A."/"B." prefixes,5exists only 1960 to 1962,5Ais named four ways ("Subastas y concursos...", "Anuncios de licitaciones...", "Contratación del Sector Público"),T"T.C. Sección del Tribunal Constitucional" was seen on 2020-06-10. A section can be absent on a given day (4, 5A, 2A). textowrapper in JSON: children can sit under a keytextoinstead of directly under their parent:seccion.texto.departamento,departamento.texto.item,departamento.texto.epigrafe. It always helditem,epigrafeordepartamentoand never co-existed with a sibling of those. Seen for section 5C departments in every sample, old-era departments in 4/5A/5B/5C, sectionT, and single-department sections. The rule for when it appears is unknown; read children asnode.get(k) or node.get("texto", {}).get(k)and normalise to a list. Departments of 1960 announcements havecodigo: ""andnombre: "".epigrafewas a list in all samples (even length 1);itemis a dict or a list;seccionis a dict when the issue has one section.departamento.codigojoinsdatos-auxiliares/departamentos(211 entries): about 130 distinct codes seen, all but8130(Comunidad de Madrid in 1990 and 2000; the table has8131) and the empty ones match. Names differ in case (summary UPPERCASE, table Title Case): match on the code.- A 404 for a recent day cannot be told from a transient failure, so a remembered "no issue" lives one day when the day is at most 7 days before today and a month beyond that; a summary that was read lives a month once its day is past.
- A summary read while its day was still today is cached under a separate, provisional key (one hour) and is neither served nor counted for that day once it is past: a copy read at 23:30 would otherwise still be cached at 00:15 and be taken as the final one, losing whatever the BOE added after 23:30. A past day is therefore always read at least once as a past day.
- Several issues on one day:
20200314hasdiariowith two entries,numero "67"(BOE-S-2020-67, extraordinary: one section, one itemBOE-A-2020-3692, RD 463/2020) listed beforenumero "66"(BOE-S-2020-66, ordinary, 418 items).BOE-A-ids continue across issues (3636 to 3691, then 3692), as do page numbers. Section code1appears twice in the one response (once per issue).
Amendment chains (/analisis)
- Direction:
anteriores= earlier norms that THIS norm acts on (it MODIFICA/DEROGA them);posteriores= later norms that act on this one (passive form). Thetextois from the listing norm's viewpoint: inanterioresit cites the target ("el art. 6.2 de la Ley 11/2002, de 6 de mayo"), inposterioresthe actor ("el art. 6.2, por Real Decreto-ley 8/2020, de 17 de marzo"). Confirmed with RDL 8/2020 (BOE-A-2020-3824): itsanterioresrows270 MODIFICA,235 SUPRIME,231 SUSPENDEare mirrored with the samecodigoasSE MODIFICA,SE SUPRIME,SE SUSPENDEinposterioresofBOE-A-2002-8628,BOE-A-2003-13471,BOE-A-2018-9268,BOE-A-2011-9617,BOE-A-2015-2495. Of 21 checkable pairs over 24 analyses all amendment pairs mirror; the one that does not is330 CITA(RD 463/2020 does not list RDL 8/2020; therelaciones-posteriorestable has-for 330). There is one row perid_normaper side (no duplicates in 873 rows): several actions on the same norm are merged into one row'stexto. anterioreshas the same wrapper behaviour asposteriores: a list of{"anterior": [...]}(inner object when single), absent for the Código Civil.id_normacan be"": 8 of 274anterioresrows (regional decrees not indexed by the BOE, with a gazette citation intexto); no such row was seen inposteriores. Otherid_normaprefixes thanBOE-A-:BOE-T-(treaties, 10 rows),BOE-B-,DOUE-L-,BOJA-b-,DOGC-f-,BOC-j-.- Size: RDL 8/2020 10 anteriores and 34 posteriores (21.9 KB, 1.0 s); Ley 6/2018 70/39 (51 KB, 1.2 s); Ley 31/2022 49/32 (39 KB, 1.1 s); RD 463/2020 9/135 (77 KB, 1.4 s). Cost is about 1 s whatever the size.
- Catalogue coverage of referenced ids (873 rows, 736 distinct non-empty ids): 71 % of distinct ids are in the consolidated catalogue (
anteriores182 of 218,posteriores363 of 541). 97 % of270 MODIFICAand 65 % of210 DEROGAtargets inanteriores, 74 % of270 SE MODIFICAinposteriores; none of the corrections (201/202/203),470,230,552,530,693,301rows are in the catalogue. - Nodes outside the catalogue:
/analisisand/metadatosofBOE-A-2020-4026(a correction, code 201) andBOE-A-2020-4874(Recurso 2035/2020) are both 404 (La información solicitada no existe). A chain stops at such a node; all that is known is the row'srelacionandtexto.textonever contains the other norm's title: it is a provision locator plus rank, number and date, or a free fragment ("2113/2024 promovido contra el Título V...", "en BOE núm. 57, de 7 de marzo de 2007", ", por Resolución de 25 de marzo de 2020"); length 25 to 518 chars, median 96. - Regional ids:
/analisisworks (BOJA-b-2022-90314200, 2.3 KB;posterioreswas a single object). Itsanteriorespoint toBOE-A-ids (someAutonómicoin the catalogue, i.e. BOE republications of regional laws) and itsposteriorto a regional id (BOJA-b-2022-90339, 301). - Relation codes in 274
anterioresrows: 270 MODIFICA 134, 210 DEROGA 52, 480 DECLARA la vigencia 20, 440 DE CONFORMIDAD con 17, 330 CITA 13, 231 SUSPENDE 9, 407 AÑADE 8, 235 SUPRIME 3, 331, 406, 404, 401 2 each, 426 TRANSPONE and 230 DEJA SIN EFECTO 1 each. In 599posterioresrows: 270 SE MODIFICA 261, 440 SE DICTA DE CONFORMIDAD 166, 470 SE DECLARA 35, 210 SE DEROGA 34, 407 17, 203 13, 331 12, 401 10, 230 9, 201 and 421 6 each, 552 5, 490 4, 693/404/231 3 each, 530/406/301 2 each, and 245, 402, 202, 694, 235, 480 once. Both tables share the 50 codes; text differs in voice, and codes 330 has no passive form. Real amendments: 210-217, 220-221 (ANULA: the norm acted on stops having effect, so they count as repeals), 230, 231, 235, 245, 270-272, 407, 408, and 401, 404, 406 (PRORROGA, ACTUALIZA, AMPLÍA: they extend, update or widen the norm acted on, so they count as modifications); corrections 201-204; citations and relations 300-303, 330, 331, 400, 402, 420-422, 426, 427, 430, 440, 480, 490; court proceedings 470, 520, 530, 540, 552, 693, 694. 470 SE DECLARA is a court ruling: all 8 rows in the fixtures read "en el Recurso 3903/2016, la inconstitucionalidad de ... por Sentencia 33/2019" or "su extinción por pérdida sobrevenida del objeto ... por Sentencia 124/2021", and the cited norms (BOE-A-2019-5726,BOE-A-2021-10023...) are not in the consolidated catalogue. A reader of a chain wants them, but not as amendments: the tool reports how many were left out.
Unverified / open
- Conditional requests (
If-None-Match,If-Modified-Since): not tried; no validators in responses. - BORME on a weekend. For
sumario: a Monday; a day with three or more issues (only the 2020-03-14 two-issue day was seen); the rule for thetextowrapper; whether XML and JSON summaries differ for any era other than 2025; the exact first day below 1960-09-01 was bisected only on weekdays (1960-08-31 is 404). - Whether
/metadata-eliand/id/{id}serve XML withAccept: application/xml(JSON gave 400); JSON-vs-XML parity of other endpoints thansumario. - Whether the
/analisis404 for ids outside the catalogue is universal (2 samples, both 404); whether440,470and other non-amendment codes are mirrored (their counterparts are not in the catalogue, so not checkable); how many requests a 3-level chain costs (estimated to be in the hundreds without a cap). - Behaviour when
limitexceeds the number of records at offset 0 (the largest honouredlimitis 10 000, resolved in the third probe). - Whether
toinfrom/tois inclusive of the named day; which other fieldsrangeaccepts besidesfecha_publicacion(fecha_vigenciarange worked with[a TO b]syntax inquery_string). - The documented secondary ordering for ties under
sort fecha_publicacion(ties were reproducible within a 35 s crawl but their rule is unknown); whether the default order is exactlyfecha_actualizaciondesc for query results with relevance. - A same-rank, same-number, same-year collision among
ambito=1records. - Whether a block with "sin contenido" or other repeal wording exists besides
(Derogado).; a version-levelfecha_caducidad(none seen; the attribute exists on<bloque>). - The exact set of
rangovalues accepted when filtering regional ranks (1470, 1500...), (/textoworks forDOGC-f-,BOJA-b-andDOGV-r-ids;BOCL-h-,BORM-s-untested). - (probe 2 additions) Not verified: images/formulas inside versions (none in 13 blocks, no search for them);
ANEXO I-style multiple annex titles; whether any version can share the exactfecha_vigenciawith another;colspan/rowspan(none seen); wording of notes for laws that are partially repealed or "vigencia agotada" without repeal; the actualestatus_derogacionof Ley 7/2007 and RDLeg 1/2008 (they have nonoblock);Disposición final 1ªstyle titles (not seen); JSONAcceptonbloque/noreturns 400 (assumed same as other blocks, not requested). - (probe 3 additions) Not verified: whether
BOE-A-<year>-9xxxxaliases (versionid_normaof regional-gazette laws) resolve as ids; the note wording for regional gazettes not sampled (DOGV, DOGC, BORM, BOA, BOIB, BOCL, DOCM, BOCT) and whether everyBOE-A-regional law carries aPublicada ennote (10 of 10 sampled, 3 378 exist); whether a record added during a crawl shifts offsets undersort fecha_publicacion; how the amending codes other than 270, 210, 407, 230, 245 behave (inferred from their names); the order of<version>elements in the three large texts; whether any query parameter on/texto/indicechanges its output (none tried).