Your first article of EU law, four ways.
One request returns Article 17 of the GDPR as JSON, with the identifiers to cite it by. Pick a path, paste one snippet.
First, create a free account and confirm your email: your API key is then on the dashboard. The free plan starts with 500 credits, no card.
One curl call.
- Copy your key from Dashboard → API keys.
- Run this with your key in place of
lex_your_key.
curl -X POST "https://lex-api.com/api/v1/documentContent" \
-H "x-api-key: lex_your_key" \
-H "Content-Type: application/json" \
-d '{"celexNumber":"32016R0679","articleId":"17","include":["metadata","articles"]}'{
"success": true,
"document": {
"celex": "32016R0679",
"language": "en",
"title": "Regulation (EU) 2016/679 … (General Data Protection Regulation) …",
"urls": {
"html": "https://eur-lex.europa.eu/legal-content/EN/TXT/HTML/?uri=CELEX:32016R0679",
…
},
"content": {
"articles": [
{
"id": "art_17",
"number": "Article 17",
"title": "Right to erasure (‘right to be forgotten’)",
"content": "1. The data subject shall have the right to obtain from the controller the erasure of personal data concerning him or her without undue delay …"
}
]
},
…
},
"credits": { "operation_weight": 1, "remaining": 499, … }
}Costs 1 credit when LexAPI already holds the document, 4 or 5 when it is fetched from the source first. credits.operation_weight is what you were charged.
Connect Claude Code.
- Run this in your terminal.
- In Claude Code, run
/mcp, chooselexapi, then Authenticate. Sign in to LexAPI in the browser and approve. - Ask: Using LexAPI, quote Article 17 of the GDPR (CELEX 32016R0679) and cite it.
claude mcp add --transport http lexapi https://mcp.lex-api.com/v1
No browser sign-in? Use your API key instead:
claude mcp add --transport http lexapi https://mcp.lex-api.com/v1 --header "Authorization: Bearer lex_your_key"
lex_get_document and gets (abridged){
"celex": "32016R0679",
"title": "Regulation (EU) 2016/679 … (General Data Protection Regulation) …",
…
"url": "https://eur-lex.europa.eu/legal-content/EN/TXT/HTML/?uri=CELEX:32016R0679",
"source": "corpus",
"content": {
"articles": [
{
"id": "art_17",
"number": "Article 17",
"title": "Right to erasure (‘right to be forgotten’)",
"content": "1. The data subject shall have the right to obtain from the controller the erasure of personal data concerning him or her without undue delay …"
}
]
},
…
}Tool calls use your plan’s credits, like the REST call above.
The Python SDK.
- Install:
pip install lexapi-client - Save this as
quickstart.pywith your key in place oflex_your_key. - Run:
python quickstart.py
from lexapi import LexAPI
client = LexAPI(api_key="lex_your_key")
resp = client.get_document("32016R0679", include=["metadata", "articles"], article_id="17")
article = resp.document.content.articles[0]
print(resp.document.celex, "-", article.number, "-", article.title)
print(article.content[:200])
print("credits charged:", resp.units_charged, "| remaining:", resp.credits_remaining)32016R0679 - Article 17 - Right to erasure (‘right to be forgotten’)
1. The data subject shall have the right to obtain from the controller the erasure of personal data concerning him or her without undue delay and the controller shall have the obligation to erase pers
credits charged: 1 | remaining: 499The TypeScript SDK.
- Install:
npm install @lexapi/client - Save this as
quickstart.mjswith your key in place oflex_your_key. The same code is valid TypeScript in an ES module: in a CommonJS project, name the file.mtsor set"type": "module". - Run:
node quickstart.mjs
import { LexAPI } from "@lexapi/client";
const client = new LexAPI({ apiKey: "lex_your_key" });
const resp = await client.getDocument({
celexNumber: "32016R0679",
include: ["metadata", "articles"],
articleId: "17",
});
const article = resp.document.content?.articles?.[0];
console.log(resp.document.celex, "-", article?.number, "-", article?.title);
console.log(article?.content?.slice(0, 200));
console.log("credits charged:", resp.credits?.operation_weight, "| remaining:", resp.credits?.remaining);32016R0679 - Article 17 - Right to erasure (‘right to be forgotten’)
1. The data subject shall have the right to obtain from the controller the erasure of personal data concerning him or her without undue delay and the controller shall have the obligation to erase pers
credits charged: 1 | remaining: 499Server-side only: keep the key out of browser code.
Source text, citable.
The text of Article 17 from EUR-Lex, with the act’s CELEX number (32016R0679) and its EUR-Lex link to cite it by.
CELEX numbers that start with 0 are consolidated texts: documentation, without legal force. LexAPI returns source texts; it does not assess compliance.
Next: turn an ECLI, an ELI or a link into a CELEX number, or list what cites or amends an act.
Three errors a first call meets.
| Status | Why, and what to do |
|---|---|
| 401 | The x-api-key header is missing, or the key is wrong. Send the key in the x-api-key header. A wrong key answers {"error":"Invalid API key"}.{"error":"API key required","message":"Please provide your API key in the x-api-key header"} |
| 402 | Fewer credits left than the call reserves. A document read reserves 5 and refunds the difference. The pool refills on details.resetsAt.{"success":false,"error":{"code":"CREDITS_EXHAUSTED","message":"Credit pool exhausted","details":{"operation":"document_fetch","weight":5,"available":2,"included":500,"topup":0,"used":498,"resetsAt":"2026-12-17T15:57:07.011Z"}}} |
| 429 | More requests in a minute than the plan allows: 15 on the free plan. Wait retryAfter seconds (also the Retry-After header). The SDKs retry a 429 for you.{"success":false,"code":"RATE_LIMITED","error":"Rate limit exceeded","message":"You can make up to 15 requests per minute on your current plan","retryAfter":60} |
Snippets verified with lexapi-client 0.4.0, @lexapi/client 0.4.0, @lexapi/mcp 0.5.1.