Dike logoDocs

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

Request Parameters

{
  "canonical_id": "eg-leg-1948-131",
  "direction": "both",
  "edge_types": ["cites", "amends", "repeals", "implements", "interprets"],
  "depth": 1,
  "limit": 50
}

Body Schema

ParameterTypeDefaultConstraintsDescription
canonical_idstringRequiredValid Canonical IDThe root document ID to begin BFS traversal from.
directionstring"both""in", "out", "both"Traversal direction (in = citing documents, out = cited documents).
edge_typesstring[]AllSubset of edge enumFilter by relationship types: cites, amends, repeals, implements, interprets.
depthinteger11–3Maximum graph hop distance from the root node.
limitinteger501–100Maximum 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

StatusCodeCause
401unauthorizedMissing or invalid API key
404not_foundcanonical_id root does not exist in graph
422validation_errorInvalid direction, depth > 3, or limit > 100

On this page