Pull a slice of EU law in one stream, then only what changed.
A single request streams the documents LexAPI holds that match your filters, one JSON document per line, up to 50,000 rows per export. Larger selections continue in date windows. After the first pull, ask only for what changed.
The free plan starts with 500 credits, no card. Your API key is on the dashboard once you confirm your email.
Bulk export is on the Business, Scale and Enterprise plans.
A slice of what LexAPI holds, by filter.
An export returns at most 50,000 rows. This one asks for regulations dated from 2024 on, and caps itself lower. Run it with your key in place of lex_your_key; add -o file.ndjson to save the stream.
curl "https://lex-api.com/api/v1/export?documentTypeCode=regulation&dateFrom=2024-01-01&limit=1000" \ -H "x-api-key: lex_your_key"
| Parameter | What it does |
|---|---|
documentTypeCode | A type family: regulation includes implementing and delegated regulations. |
documentType | The exact stored type label. |
author | The whole stored author value. |
language | Default en. |
dateFrom, dateTo | A range of document dates, inclusive. Rows without a document date are left out. |
changedSince | Only rows added, or whose text changed, at or after a time. |
limit | A cap on the rows returned, and on the credits reserved. |
- When more rows match than one export returns, the last line says
truncated: true. Continue with consecutivedateFromanddateTowindows. - Costs 1 credit per row written, at least 1 per export. The credits for the rows an export can return are reserved before it streams, and the unused ones are refunded when it ends.
- The export holds documents LexAPI has: its EU-law corpus, not the whole of EUR-Lex. Rows without document text are left out unless you ask for them.
What comes back, line by line.
NDJSON: a first line that describes the export, one document per line, and a last line that says what happened.
Example stream (abridged){"_meta": {"totalMatching":12450, "streaming":12450, "truncated":false, "credits":{"reserved":12450, "remaining":487550, …}, …}}
{"celex":"32016R0679","language":"en","title":"Regulation (EU) 2016/679…","documentType":"Regulation","author":"…","version":1,"contentHash":"…","fetchedAt":"2026-05-12T…","parsedContent":{…}, …}
…
{"_done": {"written":12447, "truncated":false, "truncatedBy":null, "skippedStubs":3, "credits":{"reserved":12450, "charged":12447, "refunded":3, "remaining":487553, …}}}- An export is complete only if it ends with the
_doneline. If the line is missing, retry. Rows already sent are charged; the rest of the reservation is refunded. _done.writtenis the number of rows sent;_done.credits.chargedwhat it cost._done.truncatedBysays why matching rows remain:limit,max_rows,credits, orrecovered(the export was stopped on our side: run it again).- A full row has 25 keys; the example shows some.
parsedContentholds the parsed document.
After the first pull, only what changed.
changedSince returns only the rows added, or whose text changed, at or after a time. Keep the time of your last export and send it next time.
curl "https://lex-api.com/api/v1/export?changedSince=2026-11-01T00:00:00Z" \ -H "x-api-key: lex_your_key"
The time is a date, or a date-time with a timezone. A change is a new version of the document’s text; a metadata refresh alone does not count.
The export with the SDKs.
Install with pip install lexapi-client or npm install @lexapi/client. Both read the stream row by row and raise an error if it ends without its last line.
from lexapi import LexAPI
client = LexAPI(api_key="lex_your_key")
stream = client.export(document_type_code="regulation", date_from="2024-01-01", limit=1000)
with stream:
for row in stream:
print(row["celex"])
print("written:", stream.written, "| more to fetch:", stream.truncated)import { LexAPI } from "@lexapi/client";
const client = new LexAPI({ apiKey: "lex_your_key" });
const stream = await client.export({
documentTypeCode: "regulation",
dateFrom: "2024-01-01",
limit: 1000,
});
for await (const row of stream) {
console.log(row.celex);
}
console.log("written:", stream.done?.written, "| more to fetch:", stream.truncated);Below the Business plan both raise the plan error (403) before anything streams.
What the export is not for.
The export is licensed for building your own products and internal systems. The Among other things, the Terms (§6) do not allow:
- Republishing. You may not republish data obtained through the service as a standalone collection, or in any way that substitutes for the service.
- Model training. You may not use the content, including LexAPI’s parsed structure, to train, fine-tune or evaluate machine-learning models, or to create embeddings or derived collections for those purposes, without a separate written licence.
EU law itself is reusable under the EU’s reuse policy; when you republish document content, name EUR-Lex as its source (Terms §7).
Asked & answered.
N° 01What format is the LexAPI bulk export?+
N° 02How do I fetch only what changed since my last export?+
N° 03Is there a row limit per export?+
N° 04May I republish the export or train a model on it?+
Keep building.
- EU law change monitoringA signed webhook when a watched act is amended, corrected, repealed or consolidated.
- European legal RAGSemantic search to article text with provenance, citations and the text for a date.
- EUR-Lex Python clientlexapi-client on PyPI: read articles, follow citations and handle errors, with typed objects.
- QuickstartA first request by curl, MCP, Python and TypeScript.
- API referenceEvery endpoint, parameter, response field and error.
- MCP serverSetup for Claude, Cursor and VS Code, and the tool list.
- PricingPlans, credit pools and what each call costs.
LexAPI returns source texts and their identifiers. It does not assess compliance and gives no legal advice.