Skip to main content
POST
/
api
/
v1
/
causality-graph
curl -X POST "https://api.factagora.com/api/v1/causality-graph" \
  -H "Authorization: Bearer fct_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"text": "Rising interest rates cause lower consumer spending, which leads to reduced GDP growth and higher unemployment."}'
{
  "nodes": [
    { "id": "n1", "label": "Rising interest rates" },
    { "id": "n2", "label": "Lower consumer spending" },
    { "id": "n3", "label": "Reduced GDP growth" },
    { "id": "n4", "label": "Higher unemployment" }
  ],
  "edges": [
    { "from": "n1", "to": "n2", "label": "causes" },
    { "from": "n2", "to": "n3", "label": "leads to" },
    { "from": "n3", "to": "n4", "label": "leads to" }
  ],
  "meta": {
    "total_nodes": 4,
    "total_edges": 3,
    "executionTimeMs": 640
  }
}
Extract a causal relationship graph from a given URL or text. Returns nodes (concepts/events) and directed edges (causal relationships) that can be used to visualize cause-and-effect chains.

Request Body

url
string
URL of the page or document to extract causal relationships from.
text
string
Raw text content to extract causal relationships from.
At least one of url or text is required.

Response

nodes
array
List of concept or event nodes in the graph.
edges
array
List of directed causal relationships between nodes.
meta
object
curl -X POST "https://api.factagora.com/api/v1/causality-graph" \
  -H "Authorization: Bearer fct_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"text": "Rising interest rates cause lower consumer spending, which leads to reduced GDP growth and higher unemployment."}'
{
  "nodes": [
    { "id": "n1", "label": "Rising interest rates" },
    { "id": "n2", "label": "Lower consumer spending" },
    { "id": "n3", "label": "Reduced GDP growth" },
    { "id": "n4", "label": "Higher unemployment" }
  ],
  "edges": [
    { "from": "n1", "to": "n2", "label": "causes" },
    { "from": "n2", "to": "n3", "label": "leads to" },
    { "from": "n3", "to": "n4", "label": "leads to" }
  ],
  "meta": {
    "total_nodes": 4,
    "total_edges": 3,
    "executionTimeMs": 640
  }
}