Getting Started
The CAILegal API is a stable, versioned, API-key-authenticated surface for building jurisdiction-aware legal AI into your own products — legal Q&A, document analysis, and compliance checks today, with corporate, litigation, audit, and contract-drafting tools on the roadmap.
1. Get an API key
Sign in to the Developer Console and create a key. The raw key (prefixed cai_live_) is shown exactly once — store it securely.
2. Make your first request
Every request is authenticated with an Authorization: Bearer cai_live_...header. Here's a call to /v1/chat/completions:
curl 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"
}'3. Or install an SDK
Thin, typed client libraries wrap every endpoint below. Source lives in this repo's sdks/ folder.
Python
pip install cailegal
Node / TypeScript
npm install cailegal
What you can build today
Chat
Jurisdiction-aware legal Q&A with structured citations.
Documents
AI document analysis — clause-level risk findings with citations.
Compliance
Regulatory compliance checks against named regulations.
Corporate
Corporate/tax/structuring intelligence — 16 tools (tax treaty, Pillar Two, UBO mapping, SPV advisory, and more) behind one dispatch endpoint. Supports streaming.
Litigation
Litigation intelligence — 10 tools (income-tax, GST, family, property, criminal, and more litigation analysis) behind one dispatch endpoint. Supports streaming.
Audit
16 curated, deterministic Audit Hub tools spanning External Audit, Internal Audit, Islamic Finance, and Company Secretary work. These never call the underlying model, so they're free to run.
Contracts
Contract drafting — 100+ document types behind one endpoint.
Status
Public API health/status — no authentication required.
Base URL & auto-generated references
All endpoints are relative to https://cailegal-backend-production-7edb.up.railway.app. In addition to this narrative documentation, the backend exposes FastAPI's auto-generated interactive explorer and machine-readable OpenAPI spec:
- Interactive Swagger UI — try any endpoint from the browser.
- OpenAPI JSON spec — import into Postman, Insomnia, or codegen tools.