Parse unstructured Arabic legal citation strings into structured components and resolve them to indexed canonical documents.
POST https://api.dike.it.com/v1/cite
Authorization: Bearer dike_live_xxxxxxxx
Content-Type: application/jsonRendering diagram...
Request Parameters
{
"citation": "المادة 163 من القانون رقم 131 لسنة 1948"
}| Parameter | Type | Required | Description |
|---|---|---|---|
citation | string | Yes | Raw Arabic legal citation string (3 to 500 chars). |
Supported Citation Grammars
The parser supports official statutory and judicial reference formats across Egypt, Saudi Arabia, and UAE:
- Legislation:
القانون رقم [N] لسنة [Y],نظام [الاسم] الصادر بالمرسوم الملكي رقم م/[N] لسنة [Y] - Decrees:
قرار رئيس مجلس الوزراء رقم [N] لسنة [Y],قرار وزير [الوزارة] رقم [N] لسنة [Y] - Executive Bylaws:
اللائحة التنفيذية للقانون رقم [N] لسنة [Y] - Court of Cassation:
الطعن رقم [N] لسنة [Y] ق (مدني / جنائي / تجاري) - Fatawa:
فتوى مجلس الدولة رقم [N] لسنة [Y] ملف رقم [...]
Code Examples
curl -X POST https://api.dike.it.com/v1/cite \
-H "Authorization: Bearer $DIKE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"citation": "القانون رقم ١٣١ لسنة ١٩٤٨"}'import os
import httpx
client = httpx.Client(
base_url="https://api.dike.it.com",
headers={"Authorization": f"Bearer {os.getenv('DIKE_API_KEY')}"},
)
response = client.post(
"/v1/cite",
json={"citation": "القانون رقم ١٣١ لسنة ١٩٤٨"},
)
if response.status_code == 200:
data = response.json()
print(f"Resolved to: {data['document']['canonical_id']}")
print(f"Title: {data['document']['title']}")
elif response.status_code == 404:
print("Parsed successfully, but not in current indexed coverage.")
elif response.status_code == 422:
print(f"Unparseable citation grammar: {response.json()['detail']}")async function resolveCitation(rawCitation: string) {
const res = await fetch('https://api.dike.it.com/v1/cite', {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.DIKE_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ citation: rawCitation }),
});
if (res.status === 404) {
const error = await res.json();
return { status: 'not_indexed', parsed: error.parsed };
}
if (res.status === 422) {
return { status: 'unparseable' };
}
const data = await res.json();
return { status: 'resolved', document: data.document, parsed: data.parsed };
}Response Schema
{
"parsed": {
"doc_type": "legislation",
"number": "131",
"year": 1948,
"article_no": "163",
"canonical_id": "eg-leg-1948-131"
},
"document": {
"canonical_id": "eg-leg-1948-131",
"doc_type": "legislation",
"jurisdiction": "EG",
"title": "القانون المدني رقم 131 لسنة 1948",
"official_number": "131",
"year_gregorian": 1948,
"status": "in_force",
"issuing_body": "مجلس الأمة / البرلمان المصري",
"full_text": "..."
}
}Error Codes
| Status | Code | Meaning | Remediation |
|---|---|---|---|
401 | unauthorized | Invalid or missing API key | Check Bearer header |
404 | citation_not_found | Citation parsed validly, but not present in current database | Check coverage or submit indexing request |
422 | citation_unparseable | String didn't match any legal citation grammar | Inspect detail for attempted normalized form |
422 | validation_error | Request body missing citation property | Pass valid JSON body |