Skip to content

Tools

This page is generated from the server's own tool definitions. The server offers 23 tools.

Finding laws

search_legislation

Find laws by title, text, rank, department, scope or publication date.

Answers 'which laws are about X?' or 'what was published recently?'. Use resolve_reference instead when you already know a law's name or number. Returns compact records. The API gives no total count: while has_more is true, request the next page with next_offset. Only consolidated legislation is covered, not every item published in the BOE. With no filters it lists the most recently published laws.

Parameters

Parameter Type Required Description
title string no Words that must all appear in the title, e.g. 'protección de datos'.
text string no Words that must all appear in the law's body text.
rank string
one of: constitucion, ley_organica, ley, real_decreto_ley, real_decreto_legislativo, real_decreto, orden, resolucion, circular, instruccion
no Only laws of this rank, e.g. 'ley_organica'.
department_code string no BOE department code, e.g. '7723' (Jefatura del Estado). Look codes up with find_codes.
scope string
one of: state, regional, any
no, default "any" 'state' (national), 'regional' (autonomous communities) or 'any'.
subject_code string no BOE subject (materia) code. Look codes up with find_codes.
published_from string (date) no Earliest publication date, ISO format, e.g. 2020-01-01.
published_to string (date) no Latest publication date, ISO format, e.g. 2020-12-31.
sort_by string
one of: published_on, updated_at, enacted_on
no, default "published_on" Sort by publication, last-update or enactment date.
descending boolean no, default true Newest first when true.
limit integer no, default 20 Results per page.
offset integer no, default 0 Start position; pass next_offset from the previous page.

resolve_reference

Turn a law's name or number into its BOE identifier.

Answers 'what is the identifier of Ley 40/2015?'. Call this before get_law_overview, which needs an identifier. Accepts a rank and number ('Ley Orgánica 3/2018', 'RDL 6/2019'), a bare number, an identifier or a title fragment. Returns status 'resolved' (one match), 'ambiguous' (candidates; follow the hint) or 'not_found'. To explore laws by topic rather than look up a known one, use search_legislation.

Parameters

Parameter Type Required Description
reference string yes A law as people name it: 'Ley 40/2015', 'Real Decreto-ley 6/2019', 'LO 3/2018', 'BOE-A-2015-10566' or a title fragment. Years need four digits.

find_codes

Look up BOE department, subject or rank codes by name.

Answers 'what is the department_code of the Agencia Española de Protección de Datos?'. Use it to get the values for the department_code and subject_code filters of search_legislation. Matching ignores case and accents and needs every word; the shortest names come first. Subjects are a large flat list, so use specific words.

Parameters

Parameter Type Required Description
kind string
one of: department, subject, rank
yes Which BOE code table to search.
text string yes Words that must all appear in the name, e.g. 'protección de datos'.
limit integer no, default 20 Maximum matches to return.

get_law_overview

Summarise one law: identity, legal status and how much it has been amended.

Answers 'is this law still in force, and how much has it changed?'. Returns title, rank, dates, a status with a plain-English note, the BOE's initial note when it has one, and counts and samples of the norms that amend it or that it amends. The status is derived from the BOE flags (repealed, annulled, validity exhausted), from the amendment references (later norms that repeal it, giving 'partially_repealed') and from a repeal note opening the text, so it is an indication, not a legal determination: 'in_force' does not mean every provision is current. Get the identifier from resolve_reference.

Parameters

Parameter Type Required Description
law_id string yes BOE identifier of the law, e.g. BOE-A-2015-10566.

get_law_structure

Table of contents of a law: books, titles, chapters, sections and article headings, each with the block_id to pass to the article tools. Use it to find which article deals with a matter before reading it. Large codes need paging or detail='headings'.

Parameters

Parameter Type Required Description
law_id string yes BOE identifier of the law, e.g. BOE-A-2015-10566. Get it from resolve_reference.
as_of string (date) no Show the structure valid on this date, ISO format, e.g. 2017-01-01. Default: today.
detail string
one of: headings, all
no, default "all" 'headings' leaves out the articles and provisions.
offset integer no, default 0 Start position; pass next_offset from the previous page.
limit integer no, default 200 Entries per page.

Articles and amendments

read_article

Read the text of one article of a law as in force on a date.

Answers 'what does article 46 bis of Ley 40/2015 say, today or on 2017-01-01?'. Get law_id from resolve_reference. If several blocks match, or none, outcome is 'ambiguous' or 'not_found' and candidates lists blocks to retry with as block_id. When the whole law is repealed, state is 'repealed' although the article shows no marker. Long texts come in parts: while truncated is true, pass next_offset as offset. For changes over time use compare_article_versions or get_article_history. Consolidated text is informational, not official.

Parameters

Parameter Type Required Description
law_id string yes BOE identifier of the law, e.g. BOE-A-2015-10566. Get it from resolve_reference.
article string no The article or provision designation, e.g. '46 bis', 'art. 1.902', 'disposición adicional tercera'. Give this or block_id.
block_id string no Exact block_id taken from candidates. Give this or article, not both.
as_of string (date) no Show the text valid on this date, ISO format, e.g. 2017-01-01. Default: today.
max_chars integer no, default 6000 Largest part of the text to return.
offset integer no, default 0 Start character; pass next_offset from the previous part, with the same other arguments.

compare_article_versions

Show how one article's text differs between two dates.

Answers 'what changed in article 48 between 2017-01-01 and today?'. Returns the added, removed and reworded paragraphs (rewordings marked [-old-] {+new+}; tables give both texts), a unified diff and the norms that amended the article in between. If the article did not exist on from_date, everything shows as added. If the whole law was repealed, note says so. Output is capped: see changes_truncated and unified_truncated, and raise max_changes or max_chars for more. To list every amendment use get_article_history. Consolidated text is informational, not official.

Parameters

Parameter Type Required Description
law_id string yes BOE identifier of the law, e.g. BOE-A-2015-10566. Get it from resolve_reference.
from_date string (date) yes Earlier date, ISO format, e.g. 2017-01-01.
article string no The article or provision designation, e.g. '46 bis', 'art. 1.902', 'disposición adicional tercera'. Give this or block_id.
block_id string no Exact block_id taken from candidates. Give this or article, not both.
to_date string (date) no Later date, ISO format. Default: today.
max_changes integer no, default 40 Most changed paragraphs to list.
max_chars integer no, default 8000 Largest total text of the listed changes.

get_article_history

List the versions of one article: when each took effect, who amended it, what changed.

Answers 'when and by which laws was article 48 amended?'. Each event is original, amended or repealed, with the paragraphs added, removed and changed against the previous version. To see what changed between two dates use compare_article_versions; for the amendments of the whole law, not one article, use get_amendment_history. At most the 60 most recent versions are returned; truncated says when older ones are left out. current_state is 'repealed' also when the whole law is repealed. Informational, not official.

Parameters

Parameter Type Required Description
law_id string yes BOE identifier of the law, e.g. BOE-A-2015-10566. Get it from resolve_reference.
article string no The article or provision designation, e.g. '46 bis', 'art. 1.902', 'disposición adicional tercera'. Give this or block_id.
block_id string no Exact block_id taken from candidates. Give this or article, not both.

get_amendment_history

List the later norms that amended, repealed or otherwise affected a whole law.

Answers 'which laws changed Ley 40/2015, and when?'. Get law_id from resolve_reference. Newest first. Filter with group (repeals, modifies, adds, corrections, other; default all). Returns counts per group and per year, then one page of items with law_id, year, relation and text; while has_more is true, pass next_offset as offset. It names the norms, not the articles they touched: for one article use get_article_history. Derived from BOE references, so informational.

Parameters

Parameter Type Required Description
law_id string yes BOE identifier of the law, e.g. BOE-A-2015-10566. Get it from resolve_reference.
group string
one of: all, repeals, modifies, adds, corrections, other
no, default "all" Kind of amending norm: 'repeals' (also annulments), 'modifies', 'adds', 'corrections', 'other' or 'all'.
limit integer no, default 50 Items per page.
offset integer no, default 0 Start position; pass next_offset from the previous page.

explore_amendment_chain

Follow amendments between laws for up to three levels: the laws that amended a law and the laws that amended those (amended_by), or what a law amended (amends). A law two levels away amended the intermediate law, not necessarily the parts that touch the starting law. Examines a limited number of laws per call; when complete is false, call again to continue.

Parameters

Parameter Type Required Description
law_id string yes BOE identifier of the law, e.g. BOE-A-2015-10566. Get it from resolve_reference.
direction string
one of: amended_by, amends
no, default "amended_by" 'amended_by': the laws that amended it; 'amends': the laws it amended.
depth integer no, default 2 Levels to follow: 1 is only the direct amendments.
include string
one of: amendments, all
no, default "amendments" 'amendments' (modifications, repeals, additions, suspensions) or 'all', which adds corrections, citations and judicial references.
details string
one of: root, all, none
no, default "root" Which edges carry the BOE's reference text: 'root' (those touching the starting law), 'all' or 'none'.
max_laws integer no, default 25 Most laws to read in this call (one request each).

legislation_over_time

Count laws per year, quarter or month, optionally split by rank, department or scope.

Answers 'how much legislation on X over time?'. Counts consolidated legislation only.

Parameters

Parameter Type Required Description
title string no Words that must all appear in the title (whole words; singular and plural forms both match), e.g. 'teletrabajo'.
text string no Words that must all appear in the law's body text (exact words).
subject_code string no BOE subject (materia) code. Look codes up with find_codes.
rank string
one of: constitucion, ley_organica, ley, real_decreto_ley, real_decreto_legislativo, real_decreto, orden, resolucion, circular, instruccion
no Only laws of this rank, e.g. 'real_decreto_ley'.
scope string
one of: state, regional, any
no, default "any" 'state' (national), 'regional' (autonomous communities) or 'any'.
department_code string no BOE department code. Look codes up with find_codes.
from_date string (date) no Start of the range, ISO format. Default: 1 January of the year 19 years before to_date.
to_date string (date) no End of the range, ISO format. Default: today.
period string
one of: year, quarter, month
no, default "year" Period size: 'year', 'quarter' or 'month'.
date_basis string
one of: published, enacted
no, default "published" Date to count by: 'published' (BOE publication) or 'enacted'.
group_by string
one of: none, rank, department, scope
no, default "none" Split by 'rank', 'department' or 'scope'; 'none' gives one series.
top_groups integer no, default 5 Groups to list; the rest is 'other'.

top_departments

Rank the departments (ministries, Jefatura del Estado, autonomous communities) by laws.

Counts laws in a period. Answers 'who legislates most on X?'.

Parameters

Parameter Type Required Description
title string no Words that must all appear in the title (whole words; singular and plural forms both match), e.g. 'teletrabajo'.
text string no Words that must all appear in the law's body text (exact words).
subject_code string no BOE subject (materia) code. Look codes up with find_codes.
rank string
one of: constitucion, ley_organica, ley, real_decreto_ley, real_decreto_legislativo, real_decreto, orden, resolucion, circular, instruccion
no Only laws of this rank, e.g. 'real_decreto_ley'.
scope string
one of: state, regional, any
no, default "any" 'state' (national), 'regional' (autonomous communities) or 'any'.
from_date string (date) no Start of the range, ISO format. Default: 1 January of the year 19 years before to_date.
to_date string (date) no End of the range, ISO format. Default: today.
date_basis string
one of: published, enacted
no, default "published" Date to count by: 'published' (BOE publication) or 'enacted'.
limit integer no, default 10 Departments to list.

compare_topics

Compare how often several topics appear in legislation over time.

Each topic is title words, body words or a subject code.

Parameters

Parameter Type Required Description
topics array of object yes 2 to 5 topics, each with a name and at least one of title, text or subject_code.
rank string
one of: constitucion, ley_organica, ley, real_decreto_ley, real_decreto_legislativo, real_decreto, orden, resolucion, circular, instruccion
no Only laws of this rank, e.g. 'real_decreto_ley'.
scope string
one of: state, regional, any
no, default "any" 'state' (national), 'regional' (autonomous communities) or 'any'.
department_code string no BOE department code. Look codes up with find_codes.
from_date string (date) no Start of the range, ISO format. Default: 1 January of the year 19 years before to_date.
to_date string (date) no End of the range, ISO format. Default: today.
period string
one of: year, quarter, month
no, default "year" Period size: 'year', 'quarter' or 'month'.
date_basis string
one of: published, enacted
no, default "published" Date to count by: 'published' (BOE publication) or 'enacted'.

explain_spike

Explain why a period has unusually many laws.

Shows which ranks, departments and scopes grew against the preceding periods, with the laws themselves. Without period_key it picks the strongest spike in the range.

Parameters

Parameter Type Required Description
title string no Words that must all appear in the title (whole words; singular and plural forms both match), e.g. 'teletrabajo'.
text string no Words that must all appear in the law's body text (exact words).
subject_code string no BOE subject (materia) code. Look codes up with find_codes.
rank string
one of: constitucion, ley_organica, ley, real_decreto_ley, real_decreto_legislativo, real_decreto, orden, resolucion, circular, instruccion
no Only laws of this rank, e.g. 'real_decreto_ley'.
scope string
one of: state, regional, any
no, default "any" 'state' (national), 'regional' (autonomous communities) or 'any'.
department_code string no BOE department code. Look codes up with find_codes.
period_key string no Period to explain: '2020', '2020-Q2' or '2020-03'. Default: the strongest spike in the range.
period string
one of: year, quarter, month
no 'year', 'quarter' or 'month'. Default: what period_key shows, else 'year'.
from_date string (date) no Start of the range, ISO format. Default: 1 January of the year 19 years before to_date.
to_date string (date) no End of the range, ISO format. Default: today.
date_basis string
one of: published, enacted
no, default "published" Date to count by: 'published' (BOE publication) or 'enacted'.
baseline_periods integer no, default 5 Preceding periods to compare with.
max_laws integer no, default 15 Laws to list.

most_amended_laws

Rank laws by how many later laws amended them, within a filtered set.

Examines a limited number of laws per call; when complete is false, call again to continue.

Parameters

Parameter Type Required Description
title string no Words that must all appear in the title (whole words; singular and plural forms both match), e.g. 'teletrabajo'.
text string no Words that must all appear in the law's body text (exact words).
subject_code string no BOE subject (materia) code. Look codes up with find_codes.
rank string
one of: constitucion, ley_organica, ley, real_decreto_ley, real_decreto_legislativo, real_decreto, orden, resolucion, circular, instruccion
no Only laws of this rank, e.g. 'real_decreto_ley'.
scope string
one of: state, regional, any
no, default "any" 'state' (national), 'regional' (autonomous communities) or 'any'.
department_code string no BOE department code. Look codes up with find_codes.
from_date string (date) no Only laws published on or after this date, ISO format.
to_date string (date) no Only laws published on or before this date, ISO format.
date_basis string
one of: published, enacted
no, default "published" Date to count by: 'published' (BOE publication) or 'enacted'.
limit integer no, default 10 Laws to return.
max_laws integer no, default 30 Most laws to examine in this call (one request each).

The daily gazette

get_daily_summary

Everything the BOE published on one day: dispositions, appointments, grants and announcements, by section and department. Covers the whole gazette since 1960-09-01, not just consolidated laws. Without a date it gives the latest issue.

Parameters

Parameter Type Required Description
date string (date) no Day to show, ISO format, e.g. 2020-03-14. Default: the latest issue.
section string no Only this section code, e.g. '1', '2A', '3', '5B'.
department_code string no Only this department code. Look codes up with find_codes.
words string no Words that must all appear in the title (whole words; singular and plural forms both match).
offset integer no, default 0 Start position; pass next_offset from the previous page.
limit integer no, default 25 Items per page.

scan_gazette

Find items published in the BOE over a range of up to 31 days whose title has given words, or that belong to a section or department. Matches titles only, whole words; singular and plural forms both match. When complete is false, call again to continue.

Parameters

Parameter Type Required Description
words string no Words that must all appear in the title (whole words; singular and plural forms both match).
section string no Only this section code, e.g. '1', '2A', '3', '5B'.
department_code string no Only this department code. Look codes up with find_codes.
from_date string (date) no First day, ISO format. Default: 6 days before to_date.
to_date string (date) no Last day, ISO format. Default: today.
offset integer no, default 0 Start position; pass next_offset from the previous page.
limit integer no, default 25 Items per page.

Citations

verify_citation

Check citations of Spanish laws against the consolidated text: whether the law and article exist, their state on a date, and whether quoted words match the text, the current version or an older one. Reports facts, not legal correctness. Compares words, not meaning: a paraphrase does not match.

Parameters

Parameter Type Required Description
citations array of object yes 1 to 10 citations to check.

Saved searches

Available only when the server runs locally or when you are signed in. Saved searches belong to one person; nothing is sent automatically.

Save a search to re-check later: gazette items by title words, section or department, or one law to follow for amendments and court rulings. Nothing is sent automatically; call check_saved_searches to see what is new. A name is proposed when none is given.

Parameters

Parameter Type Required Description
name string no Name for the search; default: one built from its filters.
words string no Words that must all appear in the title (whole words; singular and plural forms both match).
section string no Only this section code, e.g. '1', '2A', '3', '5B'.
department_code string no Only this department code. Look codes up with find_codes.
law_id string no BOE identifier of a consolidated law to follow, e.g. BOE-A-2015-10566 (use resolve_reference).

list_saved_searches

The saved searches, with their filters and when each was last checked.

Parameters

No parameters.

check_saved_searches

What is new for the saved searches since each was last checked; what is shown is marked as seen. Covers at most the last 31 days; shows up to 60 items per call, so call again while complete is false. since re-reads gazette searches up to 90 days back without marking anything.

Parameters

Parameter Type Required Description
name string no Check only this saved search; default: all.
since string (date) no Re-read gazette searches from this date (at most 90 days back) without marking anything as seen.
limit integer no, default 20 New items or changes shown per search per call; the rest stay new.

Rename a saved search or change its gazette filters. Its last-checked point is kept.

Parameters

Parameter Type Required Description
name string yes Name of the saved search (see list_saved_searches).
new_name string no New name for the search.
words string no New value; an empty string removes this filter.
section string no New value; an empty string removes this filter.
department_code string no New value; an empty string removes this filter.

Delete a saved search. This cannot be undone.

Parameters

Parameter Type Required Description
name string yes Name of the saved search (see list_saved_searches).