EU law · 24 official languagesArticle-level JSON · typed citation graphMCP server · Claude, Cursor, VS CodeSDKs · Python, TypeScriptFree plan · 500 credits to start
Brussels · CET
Vol. II·Section S — Solutions Desk
NDJSON · Filters · Incremental

§ Bulk export — For developers

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.

Create a free accountQuickstart

§ 01 — Export

A slice of what LexAPI holds, by filter.

You need: the Business plan or higher, curl, and an API key

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
curl "https://lex-api.com/api/v1/export?documentTypeCode=regulation&dateFrom=2024-01-01&limit=1000" \
  -H "x-api-key: lex_your_key"
ParameterWhat it does
documentTypeCodeA type family: regulation includes implementing and delegated regulations.
documentTypeThe exact stored type label.
authorThe whole stored author value.
languageDefault en.
dateFrom, dateToA range of document dates, inclusive. Rows without a document date are left out.
changedSinceOnly rows added, or whose text changed, at or after a time.
limitA 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 consecutive dateFrom and dateTo windows.
  • 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.

Bulk export reference

§ 02 — Stream

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 _done line. If the line is missing, retry. Rows already sent are charged; the rest of the reservation is refunded.
  • _done.written is the number of rows sent; _done.credits.charged what it cost.
  • _done.truncatedBy says why matching rows remain: limit, max_rows, credits, or recovered (the export was stopped on our side: run it again).
  • A full row has 25 keys; the example shows some. parsedContent holds the parsed document.
§ 03 — Incremental

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
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.

§ 04 — SDKs

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.

Python
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)
TypeScript
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.

§ 05 — Terms

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).

§ 06 — FAQ

Asked & answered.

N° 01What format is the LexAPI bulk export?+
NDJSON: one JSON document per line, between a first _meta line and a last _done line. An export is complete only if it ends with the _done line.
N° 02How do I fetch only what changed since my last export?+
Pass changedSince with a timestamp. The export then holds only the rows added, or whose text changed, at or after that time.
N° 03Is there a row limit per export?+
Yes. One export returns at most 50,000 rows. When more rows match, the _done line says truncated: true; split the selection into consecutive dateFrom and dateTo windows and export each.
N° 04May I republish the export or train a model on it?+
Republishing: no. LexAPI’s Terms (§6) do not allow republishing the data as a standalone collection or in any way that substitutes for the service. Training: only with a separate written licence from LexAPI. Without one, the Terms do not allow using the content to train, fine-tune or evaluate machine-learning models, or to create embeddings or derived collections for those purposes.
§ 07 — Next

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.