Chat

GA

Jurisdiction-aware legal Q&A with structured citations.

Internally wraps: Orchestrator.handle_chat

POST/v1/chat/completionsGA

Legal Q&A completion (jurisdiction-aware, cited)

Ask a legal question in natural language and get a jurisdiction-aware answer grounded in cited authorities (statutes, case law, or regulatory text). Mirrors the shape of OpenAI's chat completions endpoint.

Required scope: chat~1 credit(s)/callSDK: chat.completions.create(...)
  • jurisdiction accepts any of 120+ supported country/region codes (default "US").
  • message (or query) is required; 5–120,000 characters.
  • mode accepts small | medium | deep to trade cost for depth (default: legacy auto heuristic).
  • Set stream: true for Server-Sent Events (chat.completion.chunk deltas), matching OpenAI's streaming convention.

Request body

{
  "message": "What is the notice period for termination under UAE labour law?",
  "jurisdiction": "AE",
  "language": "en",
  "mode": "medium"
}

Response body

{
  "id": "req_8f1c...",
  "object": "chat.completion",
  "answer": "Under UAE Federal Decree-Law No. 33 of 2021, the standard notice period is ...",
  "citations": [
    {
      "citation_id": "c1",
      "source_id": "src_uae_flr_2021",
      "title": "Federal Decree-Law No. 33 of 2021 (UAE Labour Law)",
      "jurisdiction": "AE",
      "article": "Art. 43",
      "excerpt": "Either party to the employment contract may terminate it for any legitimate reason...",
      "relevance_score": 0.94,
      "verified": true
    }
  ],
  "jurisdiction": "AE",
  "warnings": [],
  "disclaimer": "This response is generated by an AI legal assistant for informational purposes only and does not constitute legal advice. Consult a qualified legal professional before relying on it."
}
curl -X POST https://cailegal-backend-production-7edb.up.railway.app/v1/chat/completions \
  -H "Authorization: Bearer cai_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "message": "What is the notice period for termination under UAE labour law?",
  "jurisdiction": "AE",
  "language": "en",
  "mode": "medium"
}'