Documents
Read one document in full, or list the articles of a law or regulation.
Retrieve Document
/v1.1/document/retrieve_documentParameters
DocumentIdentifierstringrequiredUnique identifier of the document to retrieve.
markdownbooleandefault: falseWhen true, converts the document's HTML to Markdown and includes it in the `markdown` response field. The `html` field is omitted from the response to save bandwidth.
internal_linksbooleandefault: falseWhen false (default), links to other Moonlit documents are removed from the HTML and only their text is kept. When true, those links are kept.
html_startintegerdefault: 0First character of the HTML to return (0-based). Pair with `html_end` to page through large documents.
html_endinteger | nullCharacter position to stop at (exclusive). When a span is requested the response also carries the full HTML length. The cut is by character and can land inside a tag.
Example request
curl "https://api.moonlit.ai/v1.1/document/retrieve_document?DocumentIdentifier=32019L0001" \
-H "Authorization: Bearer YOUR_API_KEY"Try it
/v1.1/document/retrieve_documentNot run yetThe key stays in this browser tab and is sent only to api.moonlit.ai. Every request counts against your plan like any other call.
Response
Full document with text content and metadata
identifierstringUnique document identifier.
secondaryIdentifierstring | nullSecondary document identifier.
tertiaryIdentifierstring | nullTertiary document identifier.
languagestring | nullDocument language code.
datestring | nullDocument date in YYYY-MM-DD format.
titlestring | nullDocument title.
sourcestring | nullIssuing entity name (e.g. court or legislative body).
jurisdictionstring | nullJurisdiction name for the document.
portalstring | nullPortal domain the document originates from.
sourceUrlstring | nullSource URL to the original document.
sourcePdfstring | nullSource URL to the PDF rendition when available.
sourcesobject[] | nullHierarchical list of source entries.
idstringUnique identifier.
parentIdstring | nullParent node identifier.
namestring | nullFull display name.
documentTypesobject[] | nullHierarchical list of document-type classification entries.
idstringUnique identifier.
parentIdstring | nullParent node identifier.
namestring | nullFull display name.
textstring | nullFull text content of the document.
htmlstring | nullHTML rendition of the full document.
htmlLengthinteger | nullLength in characters of the full HTML. Only present when `html_start` / `html_end` were used, so the rest can be requested.
markdownstring | nullMarkdown rendition of the document (only present when markdown=true).
yearinteger | nullPublication year.
inForceboolean | nullWhether the document is currently in force.
referencedinteger | nullNumber of documents that reference this document.
summarystring | nullAI-generated summary of the document.
publicAccessboolean | nullWhether the document is publicly accessible. False for Unknown-jurisdiction documents and Raad van Arbitrage portals; true otherwise.
{
"identifier": "32019L0001",
"language": "EN",
"date": "2018-12-11",
"source": "European Parliament",
"jurisdiction": "European Union",
"portal": "eur-lex.europa.eu",
"sourceUrl": "https://eur-lex.europa.eu/legal-content/EN/TXT/?uri=CELEX:32019L0001",
"sourcePdf": "https://eur-lex.europa.eu/legal-content/EN/TXT/PDF/?uri=32019L0001",
"sources": [
{
"id": "b49c23adeaa6a345aa815e401c6d194b",
"parentId": null,
"name": "Legislative bodies"
},
{
"id": "c9aca61be7de06a023b67cc6ab78bf72",
"parentId": "b49c23adeaa6a345aa815e401c6d194b",
"name": "European Parliament"
}
],
"documentTypes": [
{
"id": "87a86c141d2c0649a699745ba63e4c6b",
"parentId": "18fead608f1a4dcb5671b9fc8aeab4d1",
"name": "European law"
},
{
"id": "18fead608f1a4dcb5671b9fc8aeab4d1",
"parentId": null,
"name": "Laws and regulations"
}
],
"text": "14.1.2019 EN Official Journal of the European Union...",
"html": "<h1>DIRECTIVE (EU) 2019/1 OF THE EUROPEAN PARLIAMENT...",
"year": 2019,
"inForce": true,
"summary": "This directive establishes common rules for the internal market..."
}Errors
List Document Articles
/v1.1/document/articlesParameters
DocumentIdentifierstringrequiredUnique identifier of the document to list articles for.
hierarchybooleandefault: trueWhen true (default), returns articles as a nested tree structure based on hierarchy levels. When false, returns a flat list.
includeHtmlbooleandefault: falseWhen true, includes the HTML content of each article/element in the response. When false (default), the elementHtml field is omitted.
pageinteger | null1-based page. When set, the response is `{total, page, num_results, articles}` with one page of elements in document order. Omit it for the whole document as a plain list (deprecated: large codes have tens of thousands of elements).
num_resultsintegerdefault: 200Elements per page (1-1000). Only used with `page`.
Example request
curl "https://api.moonlit.ai/v1.1/document/articles?DocumentIdentifier=32016R0679" \
-H "Authorization: Bearer YOUR_API_KEY"Try it
/v1.1/document/articlesNot run yetThe key stays in this browser tab and is sent only to api.moonlit.ai. Every request counts against your plan like any other call.
Response
Without `page`: every article in the document as a list (empty if not a composite document). With `page`: one page plus the total.
elementIdentifierstringUnique article/element identifier. Use as article_reference_id in reference search.
elementTitlestring | nullArticle title (e.g. 'Article 1').
elementSubTitlestring | nullArticle subtitle.
elementHtmlstring | nullHTML content of the article/element.
referenceCountintegerNumber of documents referencing this article.
levelintegerHierarchy level within the document.
globalOrderintegerSort order within the document.
childrenobject[] | nullNested child articles/elements. Only populated when hierarchy=true.
array of the same shape
The response is a JSON array; each item has the fields below.