{"openapi":"3.1.0","info":{"title":"madda API","version":"1.0.0","summary":"Moroccan law, article by article, with citation data.","description":"Read-only access to the texts published on madda.ma (Arabic and French), taken from the Ministry of Justice portal. Free with a rate limit; heavy use needs an API key (send it as `Authorization: Bearer <key>` or `X-API-Key`). Every article response carries a `citation` object: canonical URL, marker, text title and number, consolidated date and the official PDF. Texts, not legal advice.","contact":{"name":"madda","url":"https://madda.ma/fr/developers"}},"servers":[{"url":"https://madda.ma/api/v1"}],"components":{"schemas":{"Citation":{"type":"object","description":"Everything needed to cite the article correctly.","required":["canonical_url","marker","text_title","official_pdf_url","citation_line"],"properties":{"canonical_url":{"type":"string","format":"uri"},"marker":{"type":"string","example":"المادة 4"},"text_title":{"type":"string","example":"قانون بمثابة مدونة الأسرة"},"text_number":{"type":["string","null"],"example":"70.03"},"text_url":{"type":"string","format":"uri"},"consolidated_at":{"type":["string","null"],"format":"date","description":"Date of the consolidated version (صيغة محينة بتاريخ)."},"official_pdf_url":{"type":"string","format":"uri","description":"The Ministry of Justice PDF the text was taken from."},"source":{"type":"string"},"quality_note":{"type":["string","null"],"description":"Set when part of the text came from OCR or numbers are unreliable."},"citation_line":{"type":"string","example":"المادة 4 من القانون رقم 70.03 — madda.ma"}}},"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}}}}}},"securitySchemes":{"bearer":{"type":"http","scheme":"bearer"},"apiKey":{"type":"apiKey","in":"header","name":"X-API-Key"}}},"security":[{},{"bearer":[]},{"apiKey":[]}],"paths":{"/search":{"get":{"operationId":"search","summary":"Search articles (and texts by number or title)","parameters":[{"name":"q","in":"query","required":true,"schema":{"type":"string","maxLength":200},"example":"الطلاق الاتفاقي"},{"name":"lang","in":"query","schema":{"type":"string","enum":["ar","fr"],"default":"ar"}},{"name":"kind","in":"query","schema":{"type":"string"},"example":"loi","description":"loi, decret, dahir, dahir-loi, arrete, constitution…"},{"name":"category","in":"query","schema":{"type":"string"},"example":"finances","description":"A category slug from /categories."},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":20,"default":10}}],"responses":{"200":{"description":"Results","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Bad parameter","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"/texts/{lang}/{slug}":{"get":{"operationId":"getText","summary":"Text metadata and table of contents","parameters":[{"name":"lang","in":"path","required":true,"schema":{"type":"string","enum":["ar","fr"]}},{"name":"slug","in":"path","required":true,"schema":{"type":"string"},"example":"loi-70-03"}],"responses":{"200":{"description":"Text","content":{"application/json":{"schema":{"type":"object"}}}},"404":{"description":"Unknown text or article","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"/articles/{lang}/{slug}/{key}":{"get":{"operationId":"getArticle","summary":"One article, with its citation block","parameters":[{"name":"lang","in":"path","required":true,"schema":{"type":"string","enum":["ar","fr"]}},{"name":"slug","in":"path","required":true,"schema":{"type":"string"},"example":"loi-70-03"},{"name":"key","in":"path","required":true,"schema":{"type":"string"},"example":"4","description":"Article key: 33, 5-bis, 185-to-200, t1.12, a1.5"}],"responses":{"200":{"description":"Article","content":{"application/json":{"schema":{"type":"object","required":["citation","paragraphs"],"properties":{"citation":{"$ref":"#/components/schemas/Citation"},"paragraphs":{"type":"array","items":{"type":"string"}}}}}}},"404":{"description":"Unknown text or article","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}}}}}}}},"410":{"description":"Article no longer in the current version","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"/articles/{lang}/{slug}/{key}/versions":{"get":{"operationId":"getVersions","summary":"Previous wordings of an article with validity dates","parameters":[{"name":"lang","in":"path","required":true,"schema":{"type":"string","enum":["ar","fr"]}},{"name":"slug","in":"path","required":true,"schema":{"type":"string"},"example":"loi-70-03"},{"name":"key","in":"path","required":true,"schema":{"type":"string"},"example":"4","description":"Article key: 33, 5-bis, 185-to-200, t1.12, a1.5"}],"responses":{"200":{"description":"Versions","content":{"application/json":{"schema":{"type":"object"}}}},"404":{"description":"Unknown text or article","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"/categories":{"get":{"operationId":"listCategories","summary":"Subject categories with text counts","parameters":[{"name":"lang","in":"query","schema":{"type":"string","enum":["ar","fr"],"default":"ar"}}],"responses":{"200":{"description":"Categories","content":{"application/json":{"schema":{"type":"object"}}}}}}}}}