Knowledge Graph
Build temporal, provenance-linked knowledge with entities, relationships, current truth, and retained history. Query what was valid at a point in time without losing superseded eras.
Availability by operation
The plan catalog includes Knowledge Graph from Starter. Basic graph reads are also available on lower tiers where the deployment's read gate permits them (default: Free). Manual graph writes, deletion and inference require Pro or higher. These are different capabilities, not one universal graph tier. Check the live error and plan catalog for your operation.
01. Key Concepts
- Entities. Named objects like people, companies, concepts, or topics extracted from your data.
- Relationships. Typed connections between entities like "works_at", "mentions", "related_to", with validity and recorded-time provenance.
- Traversal. Query across relationships to discover multi-hop connections and patterns at the current time or a supplied timestamp.
02. Automatic Entity Extraction
When you add memories or documents, Hebbrix automatically:
- Extracts named entities (people, organizations, locations, concepts)
- Creates relationships with source-memory and temporal provenance
- Links entities to source memories for provenance tracking
- Merges duplicate entities
03. Endpoints
List all entities in your knowledge graph with optional filtering. Each entity is returned with its inline `relationships` array so you don't need a second call.
Request body
| Field | Type | Description |
|---|---|---|
entity_type | string | Filter by entity type (person, organization, concept, tool, etc.) |
collection_id | string | Filter entities by collection (only returns entities created with this collection_id) |
limit | integer | Max entities to return (default and max: 100) |
Response
| Field | Type | Description |
|---|---|---|
entities | array | List of entities, each with inline relationships |
entities[].name | string | Entity name (serves as its identifier) |
entities[].type | string | Entity type |
entities[].canonical_name | string? | Canonical name for this entity (if consolidated) |
entities[].confidence | number? | Model confidence in the entity extraction (0-1) |
entities[].relationship_count | integer | Total number of relationships in Neo4j |
entities[].relationships | array | Up to 25 inline relationships: [{type, target, direction}] |
entities[].relationships[].type | string | Relationship type (e.g., KNOWS, WORKS_AT) |
entities[].relationships[].target | string | Name of the connected entity |
entities[].relationships[].direction | string | "outgoing" (this entity is source) or "incoming" (this entity is target) |
count | integer | Total entities returned |
Get entity details including all relationships and source memories.
Response
| Field | Type | Description |
|---|---|---|
entity_name | string | The entity name (path param echo) |
details | object | Full entity record from Neo4j (name, type, properties, ...) |
relationships | Relationship[] | All relationships involving this entity (no cap) |
related_memories | object[] | Full memory objects that mention this entity (content, timestamp, collection_id, memory_id) |
source_memories | string[] | Convenience list of just the memory_ids from related_memories |
timeline | object[] | Temporal timeline of mentions |
stats | object | Aggregated entity statistics |
Manually create an entity in the knowledge graph. The response returns a stable canonical entity ID and canonical name; reuse the returned ID for deterministic reads and deletes.
Request body
| Field | Type | Description |
|---|---|---|
namerequired | string | Entity display name; the service resolves it to a stable canonical identity |
typerequired | string | Entity type string, preferably person | organization | location | event | concept | object | time | tool | other |
collection_id | string | Scope entity to a collection for filtered queries |
properties | object | Additional properties |
Response
| Field | Type | Description |
|---|---|---|
status | string | "created" on success |
entity | object | The created entity |
entity.entity_id | string | Stable canonical entity identifier; accepted by subsequent read and delete paths |
entity.name | string | Canonical entity name; legacy name-addressed clients remain supported |
entity.type | string | Entity type |
Create a relationship between two entities. Use the short field names (`source`, `target`, `type`); the long names are accepted as legacy aliases.
Request body
| Field | Type | Description |
|---|---|---|
sourcerequired | string | Source entity name. Preferred field. |
targetrequired | string | Target entity name. Preferred field. |
typerequired | string | Relationship type (e.g., WORKS_AT, KNOWS, MENTIONS). Preferred field. |
source_entity | string | Legacy alias of `source`. Still accepted. |
target_entity | string | Legacy alias of `target`. Still accepted. |
relationship_type | string | Legacy alias of `type`. Still accepted. |
collection_id | string | Scope this relationship to a collection |
properties | object | Additional relationship properties |
Delete an entity and all its relationships.
Delete a relationship between two entities. Both short names (preferred) and long names are accepted as query parameters.
Request body
| Field | Type | Description |
|---|---|---|
sourcerequired | string (query param) | Source entity name. Preferred. |
targetrequired | string (query param) | Target entity name. Preferred. |
type | string (query param) | Specific relationship type to delete (omit to delete all between source and target). Preferred field. |
source_entity | string (query param) | Legacy alias of `source`. |
target_entity | string (query param) | Legacy alias of `target`. |
relationship_type | string (query param) | Legacy alias of `type`. |
Query temporal relationships valid at a specific time. A standalone free-text `query` is NOT a supported graph filter: when `query` is supplied you must anchor it with `entity` (and/or `relation_type`), otherwise the request returns HTTP 422. If `query` is provided it must also be non-empty (whitespace-only values are rejected with HTTP 422).
Request body
| Field | Type | Description |
|---|---|---|
query | string | Optional free-text query. Not supported on its own — must be anchored with `entity` and/or `relation_type`, or the request returns HTTP 422. Must also be non-empty if supplied; empty/whitespace strings return HTTP 422. |
entity | string | Anchor the query to relationships touching this entity (by name). Required (alongside or instead of `relation_type`) whenever `query` is supplied. |
timestamp | datetime | Point in time to query (default: now) |
relation_type | string | Filter by relationship type. Can be used to anchor a `query` (alongside or instead of `entity`). |
collection_id | string | Scope to a specific collection |
limit | integer | Max results (default: 100, max: 1000) |
04. Code Examples
Explore Entities
import requests
# GET /v1/knowledge-graph/entities: list entities with their inline
# relationships already attached (capped at 25 per entity).
r = requests.get(
"https://api.hebbrix.com/v1/knowledge-graph/entities",
headers={"Authorization": "Bearer <your-api-key>"},
params={"entity_type": "PERSON", "limit": 20},
)
data = r.json()
for entity in data["entities"]:
rels = entity.get("relationships", [])
print(f"{entity['name']} ({entity['type']}): {len(rels)} relationships")
for rel in rels:
arrow = "-->" if rel["direction"] == "outgoing" else "<--"
print(f" {arrow} {rel['target']} [{rel['type']}]")Inspect a Single Entity
import requests
# GET /v1/knowledge-graph/entities/{entity_name}
# The path accepts the stable entity_id returned by create, or a legacy name.
# The response bundles relationships and the memory_ids that mention the entity.
r = requests.get(
"https://api.hebbrix.com/v1/knowledge-graph/entities/Acme%20Corp",
headers={"Authorization": "Bearer <your-api-key>"},
)
body = r.json()
print(body["details"]) # raw entity row from Neo4j
print(body["relationships"]) # full relationship list (no cap)
print(body["source_memories"]) # list of memory_ids that mention itCreate a Relationship
import requests
# POST /v1/knowledge-graph/relationships: use the short field names
# (source / target / type). The legacy long names
# (source_entity / target_entity / relationship_type) are still accepted.
r = requests.post(
"https://api.hebbrix.com/v1/knowledge-graph/relationships",
headers={"Authorization": "Bearer <your-api-key>"},
json={
"source": "John Doe",
"target": "Acme Corp",
"type": "WORKS_AT",
},
)
print(r.json()) # {"status": "created", "relationship": {...}}05. cURL Example
/v1/knowledge-graph/querycurl -X POST "https://api.hebbrix.com/v1/knowledge-graph/query" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"timestamp": "2026-03-30T00:00:00",
"relation_type": "MENTIONS",
"collection_id": "col_abc123",
"limit": 10
}'06. Common Entity Types
personorganizationlocationconceptobjecteventtimetoolother