API Reference

Endpoint reference for the Moonlit Data API, generated from the live OpenAPI spec: search, filter values, document retrieval, and the Luna research assistant.

Try requests live in the interactive Swagger docs.

Base URL

https://api.moonlit.ai/v1.1

Authentication

Ocp-Apim-Subscription-Key

Rate limits

Quotas are managed per subscription; a 429 means the monthly quota is exhausted. See Get access.

Response Format

JSON

Authentication

All API requests must include your subscription key in the Ocp-Apim-Subscription-Key header. Access is provisioned by our team; see Get access.

Keep your subscription key secret. Do not expose it in client-side code or public repositories. If your key is compromised, contact our team immediately.

curl -X POST "https://api.moonlit.ai/v1.1/search/keyword_search" \
  -H "Content-Type: application/json" \
  -H "Ocp-Apim-Subscription-Key: YOUR_SUBSCRIPTION_KEY" \
  -d '{"query": "huurrecht opzegging", "jurisdictions": ["Netherlands"]}'

Base URL

All API endpoints are relative to the following base URL:

https://api.moonlit.ai/v1.1

For example, the keyword search endpoint is available at https://api.moonlit.ai/v1.1/search/keyword_search.

Errors

When a request fails, the API returns a JSON body with a single detail field describing what went wrong:

{
  "detail": "Invalid or missing API key."
}

The exception is 422: FastAPI validation errors return a structured detail array listing each invalid field and the reason. These statuses appear across the API; the errors each endpoint can return are listed on its endpoint page.

Status CodeDescription
400Invalid filter value or page out of range.
401Missing or invalid subscription key.
403Forbidden by role or jurisdiction scope.
422Request validation error. Returns the FastAPI validation detail structure instead of a plain string.
500Internal server error.
504Search timed out. Only returned by the hybrid and reranked search routes.

Gateway errors

A 429 is returned by the API gateway before the request reaches the API, when the monthly quota for your subscription is exhausted. It has a different body shape: {"statusCode": 429, "message": "..."}. Gateway-level errors are not part of the OpenAPI spec.

EndpointSearches byUse when
keyword_searchExact terms, Boolean operators, wildcardsYou know exact terms, citations, or need date or citation sorting
hybrid_searchKeyword + semantic, fusedDefault for natural-language questions
hybrid_search_rerankedHybrid + reranking passHighest precision; slower
semantic_searchMeaning onlyConcept discovery when wording is unknown
semantic_search_rerankedSemantic + rerankingHigher precision concept discovery; slower
reference_searchThe citation graphDocuments citing or cited by a given document
ask_questionAgentic research, streamedA synthesized answer with sources instead of a result list
Start with hybrid_search. Drop to keyword_search for exact terms, and add reranking when precision matters more than latency.

Endpoints

Query the corpus by keyword, by meaning, or through the citation graph.

MethodEndpointDescription
POSTkeyword_searchKeyword Search
POSTsemantic_searchSemantic Search
POSTsemantic_search_rerankedSemantic Search with Reranking
POSThybrid_searchHybrid Search
POSThybrid_search_rerankedHybrid Search with Reranking
POSTreference_searchReference Search

Filters

Canonical filter values to scope search requests.

MethodEndpointDescription
GETdocumenttypesList Document Types
GETjurisdictions_portalsList Jurisdictions and Portals
GETtreesList Fields-of-Law Tree
GETsourcesList Sources
GETsemantic_portalsList Semantic Portals

Documents

Retrieve full documents and their article-level structure.

MethodEndpointDescription
GETretrieve_documentRetrieve Document
GETarticlesList Document Articles

Luna AI

Initialize a research chat and stream answers over Server-Sent Events.

MethodEndpointDescription
POSTinitialize_chatInitialize a Luna research chat session
POSTask_questionAsk a research question (SSE stream)
esc
↑↓ navigateenter openesc close