Back to use cases

AI Products

AI Copilots and Legal Assistants

Build a domain-specific AI assistant that answers legal questions with real citations, not hallucinated references.

Built by: Legal AI products, HR platforms, fintech compliance tools, insurance tech

RAGLLMCitationsLuna API

The problem

Every AI product that touches legal questions faces the same credibility problem: large language models hallucinate legal references. They invent case numbers, fabricate statutory provisions, and generate plausible-sounding but entirely fictional citations.

In a domain where accuracy is non-negotiable, this makes generic AI assistants useless for anything beyond casual conversation. Your users need answers grounded in real, verifiable legal sources.

How the API powers it

The Moonlit API provides two paths to grounded legal AI.

The first is building your own RAG pipeline: your user asks a question, your system queries the hybrid search endpoint (reranked for maximum precision) to find relevant case law and legislation, retrieves full document texts via the document retrieval endpoint, and passes those documents into your LLM prompt as context with instructions to cite only the provided sources. The result is an assistant that references specific ECLI numbers, article numbers, and court decisions.

The second path is even faster: the Luna API gives you a production-ready legal research assistant out of the box. Initialize a session, send a question with jurisdiction scoping, and receive a streamed answer with inline citations via Server-Sent Events. Luna is the same AI assistant that powers the research feature on Moonlit's own platform.

The integration pattern

The choice between building custom RAG and using the Luna API depends on how much control you need.

If your product requires a specialized persona, custom system prompts, proprietary document context mixed with public legal sources, or integration with a specific LLM provider, build your own pipeline using the search and document retrieval endpoints.

If you need a general-purpose legal research assistant embedded in your product with minimal development effort, the Luna API delivers production-quality answers in two API calls: one to initialize a session, one to ask a question. Both approaches give your users what matters most: answers they can verify against real legal sources.

Key endpoints

Example request

# Step 1: Initialize a Luna session
curl -X POST "https://api.moonlit.ai/v1.1/luna/initialize_chat" \
  -H "Ocp-Apim-Subscription-Key: YOUR_API_KEY"

Saga integrates Moonlit's search endpoints into its RAG pipeline to deliver citation-backed legal research for enterprise law firms across Europe.

Ready to build?

Talk to our team about getting API access.

Get in touch