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. Fields without a value are left out.
identifierstringUnique document identifier.
secondaryIdentifierstring | nullSecondary document identifier.
tertiaryIdentifierstring | nullTertiary document identifier.
languagestring | nullDocument language code.
datestring | nullPrimary document date in YYYY-MM-DD format (falls back to the end date when no primary date is known).
decisionDatestring | nullDate the decision was rendered or the act adopted, in YYYY-MM-DD format.
enactmentDatestring | nullDate the act was enacted, in YYYY-MM-DD format.
publicationDatestring | nullDate the document was officially published, in YYYY-MM-DD format.
entryIntoForceDatestring | nullDate the document entered into force, in YYYY-MM-DD format.
validFromstring | nullStart of the document's validity period, in YYYY-MM-DD format.
validTostring | nullEnd of the document's validity period, in YYYY-MM-DD format.
proceedingsStartDatestring | nullDate the proceedings started, 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 | nullOriginal publisher PDF URL. Archived attachments are available through pdfs[].url.
pdfsobject[] | nullOrdered PDF attachments. Each archived attachment has an authenticated API path.
sasUrlstring | nullShort-lived read-only URL for this archived PDF; null when unavailable.
ttlinteger | nullSAS URL lifetime in seconds from issuance; null when no SAS URL is available.
sourceUrlstring | nullOriginal publisher PDF URL.
fileNamestring | nullOriginal attachment filename.
isPrimarybooleanWhether this is the primary PDF.
urlstring | nullAuthenticated API path for this archived PDF, 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 | nullYear of `date` (primary date, falling back to the end date).
inForceboolean | nullWhether the document is currently in force.
referencedinteger | nullNumber of documents that reference this document.
summarystring | nullAI-generated summary of the document.
metadataobject | nullSource-specific metadata; keys vary per portal.
publicAccessboolean | nullWhether the document is publicly accessible.
{
"identifier": "32019L0001",
"secondaryIdentifier": "dir/2019/1/oj",
"tertiaryIdentifier": "MNLT:EU:EUEURLEX:2019:32019L0001",
"language": "EN",
"date": "2018-12-11",
"decisionDate": "2018-12-11",
"enactmentDate": "2018-12-11",
"publicationDate": "2019-01-14",
"entryIntoForceDate": "2019-02-03",
"validFrom": "2019-02-03",
"title": "Council of the European Union and European Parliament 11 December 2018, Directive (EU) 2019/1 of the European Parliament and of the Council of 11 December 2018 ...",
"source": "Council of the European Union and European Parliament",
"jurisdiction": "European Union",
"portal": "eur-lex.europa.eu",
"sourceUrl": "https://eur-lex.europa.eu/legal-content/EN/TXT/?uri=CELEX:32019L0001",
"sourcePdf": "http://publications.europa.eu/resource/cellar/1609a9fc-17cc-11e9-8d04-01aa75ed71a1.0006.01/DOC_1",
"sources": [
{
"id": "b49c23adeaa6a345aa815e401c6d194b",
"parentId": null,
"name": "Legislative bodies"
},
{
"id": "05bd5d5f816e9836f8ffac5cbfed674c",
"parentId": "b49c23adeaa6a345aa815e401c6d194b",
"name": "Council of the European Union and European Parliament"
}
],
"documentTypes": [
{
"id": "87a86c141d2c0649a699745ba63e4c6b",
"parentId": "18fead608f1a4dcb5671b9fc8aeab4d1",
"name": "European law"
},
{
"id": "f01159d4ed0dc13c024b743d514e1401",
"parentId": "8dba0d10dfdf2460a34ddf4eeb7b6584",
"name": "EU directives"
}
],
"text": "14.1.2019 EN Official Journal of the European Union L 11/3 DIRECTIVE (EU) 2019/1 OF THE EUROPEAN PARLIAMENT AND OF THE COUNCIL of 11 December 2018 to empower th ...",
"html": "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> <col width=\"10%\"> <col width=\"10%\"> <col width=\"60%\"> <col width=\"20%\"> <tbody> <tr> <td> <p cla ...",
"year": 2018,
"inForce": true,
"referenced": 629,
"metadata": {
"author_uris": [
"http://publications.europa.eu/resource/authority/corporate-body/CONSIL",
"http://publications.europa.eu/resource/authority/corporate-body/EP"
],
"content_kind": "xhtml",
"deadline_dates": "2024-12-12",
"in_force": true,
"langs_present": "DEU|ENG|FRA|ITA|NLD|SPA",
"primary_lang": "ENG",
"resource_types": "DIR",
"sector": "3",
"transposition_date": "2021-02-04"
},
"publicAccess": true
}Errors
Retrieve an archived PDF
/v1.1/document/retrieve_pdfParameters
DocumentIdentifierstringrequiredIdentifier of the parent document.
pdfIndexinteger | nullZero-based attachment index; omitted selects the primary PDF.
Example request
curl "https://api.moonlit.ai/v1.1/document/retrieve_pdf?DocumentIdentifier=62018CJ0311" \
-H "Authorization: Bearer YOUR_API_KEY"Try it
/v1.1/document/retrieve_pdfNot 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
Successful Response
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.
[
{
"elementIdentifier": "32016R0679_PREAMBLE",
"elementTitle": null,
"elementSubTitle": null,
"elementHtml": null,
"referenceCount": 0,
"level": 0,
"globalOrder": 0,
"children": null
},
{
"elementIdentifier": "32016R0679_CHAPTER_I",
"elementTitle": "CHAPTER I",
"elementSubTitle": "General provisions",
"elementHtml": null,
"referenceCount": 0,
"level": 0,
"globalOrder": 1,
"children": [
{
"elementIdentifier": "32016R0679_ART-001",
"elementTitle": "Article 1",
"elementSubTitle": "Subject-matter and objectives",
"elementHtml": null,
"referenceCount": 2227,
"level": 1,
"globalOrder": 2,
"children": [
{
"elementIdentifier": "32016R0679_ART-001_PAR-1",
"elementTitle": null,
"elementSubTitle": null,
"elementHtml": null,
"referenceCount": 0,
"level": 2,
"globalOrder": 3,
"children": null
},
{
"elementIdentifier": "32016R0679_ART-001_PAR-2",
"elementTitle": null,
"elementSubTitle": null,
"elementHtml": null,
"referenceCount": 0,
"level": 2,
"globalOrder": 4,
"children": null
}
]
},
{
"elementIdentifier": "32016R0679_ART-002",
"elementTitle": "Article 2",
"elementSubTitle": "Material scope",
"elementHtml": null,
"referenceCount": 2679,
"level": 1,
"globalOrder": 6,
"children": [
{
"elementIdentifier": "32016R0679_ART-002_PAR-1",
"elementTitle": null,
"elementSubTitle": null,
"elementHtml": null,
"referenceCount": 0,
"level": 2,
"globalOrder": 7,
"children": null
},
{
"elementIdentifier": "32016R0679_ART-002_PAR-2",
"elementTitle": null,
"elementSubTitle": null,
"elementHtml": null,
"referenceCount": 0,
"level": 2,
"globalOrder": 8,
"children": null
}
]
}
]
}
]Errors
List Document Versions
/v1.1/document/versionsParameters
DocumentIdentifierstringrequiredIdentifier of a document, or of any one of its versions. Either way the response is that document's whole lineage, and `documentIdentifier` says which document it is.
pageintegerdefault: 11-based index of the page to return.
num_resultsintegerdefault: 200Number of versions per page.
as_ofstring | nullReturn the version in force on this date (YYYY-MM-DD) in each language: validFrom on or before it, and validTo after it or null.
in_forceboolean | nullReturn only versions whose inForce flag matches this value.
Example request
curl "https://api.moonlit.ai/v1.1/document/versions?DocumentIdentifier=11957E%2FTXT" \
-H "Authorization: Bearer YOUR_API_KEY"Try it
/v1.1/document/versionsNot 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
A page of versions (empty when the document has none)
documentIdentifierstringThe document this lineage belongs to: the one requested, or the document of the version requested.
totalintegerTotal number of versions matching the request.
pageinteger1-based index of the returned page.
num_resultsintegerPage size used for this response.
versionsobject[]Versions on this page, ordered by validFrom descending.
identifierstringUnique version identifier. Pass as Identifier to /v1.1/document/version.
languagestring | nullVersion language code.
titlestring | nullVersion title.
datestring | nullVersion date in YYYY-MM-DD format — the day this version took effect.
validFromstringFirst day this version is valid, in YYYY-MM-DD format.
validTostring | nullFirst day this version is no longer valid, in YYYY-MM-DD format. Exclusive, and equal to the next version's validFrom. Null on the last version of a chain, unless the source gives an end date.
publicationDatestring | nullPublication date in YYYY-MM-DD format.
lastScrapedDatestring | nullWhen this version was last fetched from its source.
inForceboolean | nullWhether today falls inside this version's validFrom-validTo window.
isOriginalbooleanWhether this is the originally adopted text rather than a later rendition.
consolidationStatusstringWhether this version is the adopted text or a consolidation.
sourceUrlstring | nullSource URL to this version at the original portal.
Errors
Retrieve Document Version
/v1.1/document/versionParameters
IdentifierstringrequiredUnique identifier of the version, as returned by /v1.1/document/versions.
markdownbooleandefault: falseWhen true, converts the version'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 versions.
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/version?Identifier=12012E%2FTXT-eng" \
-H "Authorization: Bearer YOUR_API_KEY"Try it
/v1.1/document/versionNot 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 version with text content and metadata
identifierstringUnique document identifier.
secondaryIdentifierstring | nullSecondary document identifier.
tertiaryIdentifierstring | nullTertiary document identifier.
languagestring | nullDocument language code.
datestring | nullPrimary document date in YYYY-MM-DD format (falls back to the end date when no primary date is known).
decisionDatestring | nullDate the decision was rendered or the act adopted, in YYYY-MM-DD format.
enactmentDatestring | nullDate the act was enacted, in YYYY-MM-DD format.
publicationDatestring | nullPublication date in YYYY-MM-DD format.
entryIntoForceDatestring | nullDate the document entered into force, in YYYY-MM-DD format.
validFromstringFirst day this version is valid, in YYYY-MM-DD format.
validTostring | nullFirst day this version is no longer valid, in YYYY-MM-DD format. Exclusive, and equal to the next version's validFrom. Null on the last version of a chain, unless the source gives an end date.
proceedingsStartDatestring | nullDate the proceedings started, 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 | nullOriginal publisher PDF URL. Archived attachments are available through pdfs[].url.
pdfsobject[] | nullOrdered PDF attachments. Each archived attachment has an authenticated API path.
sasUrlstring | nullShort-lived read-only URL for this archived PDF; null when unavailable.
ttlinteger | nullSAS URL lifetime in seconds from issuance; null when no SAS URL is available.
sourceUrlstring | nullOriginal publisher PDF URL.
fileNamestring | nullOriginal attachment filename.
isPrimarybooleanWhether this is the primary PDF.
urlstring | nullAuthenticated API path for this archived PDF, 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 | nullYear of `date` (primary date, falling back to the end date).
inForceboolean | nullWhether the document is currently in force.
referencedinteger | nullNumber of documents that reference this document.
summarystring | nullAI-generated summary of the document.
metadataobject | nullSource-specific metadata; keys vary per portal.
publicAccessboolean | nullWhether the document is publicly accessible.
documentIdentifierstringIdentifier of the document this is a version of.
lastScrapedDatestring | nullWhen this version was last fetched from its source.
isOriginalbooleanWhether this is the originally adopted text rather than a later rendition.
consolidationStatusstringWhether this version is the adopted text or a consolidation.