Luna AI

Luna is the streaming research assistant: initialize a chat, then ask questions over Server-Sent Events.

Initialize a Luna research chat session

POST/v1.1/luna/initialize_chatOpen in Swagger
Creates a new research chat session and returns a chat_id for subsequent questions.

Parameters

No parameters.

Example request

curl -X POST "https://api.moonlit.ai/v1.1/luna/initialize_chat" \
  -H "Ocp-Apim-Subscription-Key: YOUR_SUBSCRIPTION_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'

Response

Successful Response

chat_idstring

Unique identifier for the new chat session

Errors

401Missing or invalid API key
403Forbidden by role or jurisdiction scope
422Request validation error
500Internal server error

Ask a research question (SSE stream)

POST/v1.1/luna/ask_questionOpen in Swagger
Sends a question to an existing Luna research chat session and streams the answer back as Server-Sent Events (SSE).

Parameters

chat_idstringrequired

Chat session ID returned by initialize_chat

inputstringrequired

The research question to ask

jurisdictionsstring[]

Jurisdiction names to scope the research. Only accepts names returned by GET /v1.1/search/filters/jurisdictions_portals.

e.g. ["European Union","Netherlands"]

Example request

curl -N -X POST "https://api.moonlit.ai/v1.1/luna/ask_question" \
  -H "Ocp-Apim-Subscription-Key: YOUR_SUBSCRIPTION_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "chat_id": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
  "input": "What are the key requirements for valid consent under GDPR?",
  "jurisdictions": [
    "European Union",
    "Netherlands"
  ]
}'

Response

SSE stream of answer events

This endpoint returns text/event-stream instead of JSON. The answer streams back as Server-Sent Events: read the response line by line and concatenate the data: payloads.

Errors

401Missing or invalid API key
403Forbidden by role or jurisdiction scope
422Request validation error
500Internal server error
esc
↑↓ navigateenter openesc close