Dike logoDocs

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/json
Rendering diagram...

Request Parameters

{
  "citation": "المادة 163 من القانون رقم 131 لسنة 1948"
}
ParameterTypeRequiredDescription
citationstringYesRaw 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

StatusCodeMeaningRemediation
401unauthorizedInvalid or missing API keyCheck Bearer header
404citation_not_foundCitation parsed validly, but not present in current databaseCheck coverage or submit indexing request
422citation_unparseableString didn't match any legal citation grammarInspect detail for attempted normalized form
422validation_errorRequest body missing citation propertyPass valid JSON body

On this page