Skip to content

5 REST API Reference

Oussama Elhadji edited this page Nov 4, 2026 · 2 revisions

REST API

Base URL: https://mizan-law-eta.vercel.app

Route What it returns
GET /api/health Counts and corpus date
POST /api/query Matching articles with source links
GET /api/laws The 50 laws, with consolidation dates and PDF links
GET /api/law?law=family&lang=ar One law's articles (lang is ar or fr)
GET /api/article?law=family&number=53 One article, in both languages where available
GET /api/catalog?q=...&lang=ar Official documents by title (lang is optional)
GET /api/bo-issues?audience=... Indexed Bulletin Officiel issues
POST /api/bo-diff Compare two versions of a text
POST /api/audit-contract Screen a contract for forbidden clauses

POST /api/query

Send {"query": "...", "lang": "ar" | "fr" | "darija"}. An empty query returns 400. Questions are cut at 2,000 characters.

Main response fields:

Field Meaning
found false when nothing was close enough
verbatim_citations Articles, best first
citation_verified Every quote matched the corpus character for character
ai_commentary Short note in ar, fr and darija. It points at the articles and quotes one sentence, and nothing is generated
legal_disclaimer Disclaimer in the requested language

Each citation holds law, number, article, article_fr, code_ar, code_fr, law_number, dahir, section, text_ar, text_fr, page_ar, page_fr, source_url_ar, source_url_fr, consolidated_ar and consolidated_fr. A text or link is empty when that language does not exist on the portal.

Clone this wiki locally