Documents

Read one document in full, or list the articles of a law or regulation.

Retrieve Document

GET/v1.1/document/retrieve_document
Retrieve full document content and metadata by identifier.

Parameters

DocumentIdentifierstringrequired

Unique identifier of the document to retrieve.

e.g. 32019L0001
markdownbooleandefault: false

When 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: false

When 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: 0

First character of the HTML to return (0-based). Pair with `html_end` to page through large documents.

min 0
html_endinteger | null

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

min 0

Example request

curl "https://api.moonlit.ai/v1.1/document/retrieve_document?DocumentIdentifier=32019L0001" \
  -H "Authorization: Bearer YOUR_API_KEY"

Try it

GET/v1.1/document/retrieve_documentNot run yet
Region

The 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

identifierstring

Unique document identifier.

secondaryIdentifierstring | null

Secondary document identifier.

tertiaryIdentifierstring | null

Tertiary document identifier.

languagestring | null

Document language code.

datestring | null

Document date in YYYY-MM-DD format.

titlestring | null

Document title.

sourcestring | null

Issuing entity name (e.g. court or legislative body).

jurisdictionstring | null

Jurisdiction name for the document.

portalstring | null

Portal domain the document originates from.

sourceUrlstring | null

Source URL to the original document.

sourcePdfstring | null

Source URL to the PDF rendition when available.

sourcesobject[] | null

Hierarchical list of source entries.

idstring

Unique identifier.

parentIdstring | null

Parent node identifier.

namestring | null

Full display name.

documentTypesobject[] | null

Hierarchical list of document-type classification entries.

idstring

Unique identifier.

parentIdstring | null

Parent node identifier.

namestring | null

Full display name.

textstring | null

Full text content of the document.

htmlstring | null

HTML rendition of the full document.

htmlLengthinteger | null

Length in characters of the full HTML. Only present when `html_start` / `html_end` were used, so the rest can be requested.

markdownstring | null

Markdown rendition of the document (only present when markdown=true).

yearinteger | null

Publication year.

inForceboolean | null

Whether the document is currently in force.

referencedinteger | null

Number of documents that reference this document.

summarystring | null

AI-generated summary of the document.

publicAccessboolean | null

Whether 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

401Missing or invalid API key
403Forbidden by role or jurisdiction scope
422Request validation error
429Monthly quota exhausted. Sent by the API gateway; the body is {"statusCode": 429, "message": "..."}.
500Internal server error

List Document Articles

GET/v1.1/document/articles
Returns the list of articles/elements within a composite document (e.g. a law or regulation). Each article includes its identifier, title, hierarchy level, and the number of documents that reference it. Use the `elementIdentifier` from the response as the `article_reference_id` parameter in reference search to narrow results to a specific article. Set `hierarchy=true` to receive a nested tree structure where child articles are nested under their parent elements based on the `level` field.

Parameters

DocumentIdentifierstringrequired

Unique identifier of the document to list articles for.

e.g. 32016R0679
hierarchybooleandefault: true

When true (default), returns articles as a nested tree structure based on hierarchy levels. When false, returns a flat list.

includeHtmlbooleandefault: false

When true, includes the HTML content of each article/element in the response. When false (default), the elementHtml field is omitted.

pageinteger | null

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

min 1
num_resultsintegerdefault: 200

Elements per page (1-1000). Only used with `page`.

1 to 1000

Example request

curl "https://api.moonlit.ai/v1.1/document/articles?DocumentIdentifier=32016R0679" \
  -H "Authorization: Bearer YOUR_API_KEY"

Try it

GET/v1.1/document/articlesNot run yet
Region

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

elementIdentifierstring

Unique article/element identifier. Use as article_reference_id in reference search.

elementTitlestring | null

Article title (e.g. 'Article 1').

elementSubTitlestring | null

Article subtitle.

elementHtmlstring | null

HTML content of the article/element.

referenceCountinteger

Number of documents referencing this article.

levelinteger

Hierarchy level within the document.

globalOrderinteger

Sort order within the document.

childrenobject[] | null

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

Errors

401Missing or invalid API key
403Forbidden by role or jurisdiction scope
422Request validation error
429Monthly quota exhausted. Sent by the API gateway; the body is {"statusCode": 429, "message": "..."}.
500Internal server error
esc
↑↓ navigateenter openesc close