Perform iterative Breadth-First Search (BFS) over the multi-jurisdiction legal citation graph. Trace legislative history, find which statutes amend or repeal a law, and discover Court of Cassation rulings citing specific articles.
POST https://api.dike.it.com/v1/graph/traverse
Authorization: Bearer dike_live_xxxxxxxx
Content-Type: application/jsonRendering diagram...
Request Parameters
{
"canonical_id": "eg-leg-1948-131",
"direction": "both",
"edge_types": ["cites", "amends", "repeals", "implements", "interprets"],
"depth": 1,
"limit": 50
}Body Schema
| Parameter | Type | Default | Constraints | Description |
|---|---|---|---|---|
canonical_id | string | Required | Valid Canonical ID | The root document ID to begin BFS traversal from. |
direction | string | "both" | "in", "out", "both" | Traversal direction (in = citing documents, out = cited documents). |
edge_types | string[] | All | Subset of edge enum | Filter by relationship types: cites, amends, repeals, implements, interprets. |
depth | integer | 1 | 1–3 | Maximum graph hop distance from the root node. |
limit | integer | 50 | 1–100 | Maximum total nodes returned. |
Code Examples
curl -X POST https://api.dike.it.com/v1/graph/traverse \
-H "Authorization: Bearer $DIKE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"canonical_id": "eg-leg-1948-131",
"direction": "in",
"edge_types": ["amends", "repeals"],
"depth": 1
}'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/graph/traverse",
json={
"canonical_id": "eg-leg-1948-131",
"direction": "both",
"edge_types": ["amends", "repeals", "cites"],
"depth": 1,
},
)
data = response.json()
print(f"Discovered {len(data['nodes'])} connected nodes and {len(data['edges'])} edges.")
for edge in data["edges"]:
print(f"[{edge['edge_type'].upper()}] {edge['from_id']} -> {edge['to_id']} (Confidence: {edge['confidence']:.2f})")async function traverseLegalGraph(canonicalId: string) {
const res = await fetch('https://api.dike.it.com/v1/graph/traverse', {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.DIKE_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
canonical_id: canonicalId,
direction: 'both',
depth: 1,
limit: 50,
}),
});
const { nodes, edges } = await res.json();
return { nodes, edges };
}Response Schema
{
"nodes": [
{
"canonical_id": "eg-leg-1948-131",
"title": "القانون المدني رقم 131 لسنة 1948",
"doc_type": "legislation",
"year": 1948,
"status": "in_force"
},
{
"canonical_id": "eg-leg-2021-45",
"title": "قانون رقم 45 لسنة 2021 بتعديل بعض أحكام القانون المدني",
"doc_type": "legislation",
"year": 2021,
"status": "in_force"
}
],
"edges": [
{
"from_id": "eg-leg-2021-45",
"to_id": "eg-leg-1948-131",
"edge_type": "amends",
"article_ref": "34",
"confidence": 0.99
}
]
}Edge Relationship Taxonomy
amends: Target document modified by source document.repeals: Target document superseded or annulled by source document.implements: Source decree or regulation puts target legislation into executive effect.interprets: Judicial cassation ruling or fatwa provides authoritative construction of target article.cites: General statutory cross-reference between texts.
Error Codes
| Status | Code | Cause |
|---|---|---|
401 | unauthorized | Missing or invalid API key |
404 | not_found | canonical_id root does not exist in graph |
422 | validation_error | Invalid direction, depth > 3, or limit > 100 |