relations = client.context.relations(
database="acme_corp",
id="billing_runbook_v3",
limit=500,
)
const relations = await client.context.relations({
database: "acme_corp",
id: "billing_runbook_v3",
limit: 500,
});
curl -G 'https://api.hydradb.com/context/relations' \
-H "Authorization: Bearer <your_api_key>" \
-H "API-Version: 2" \
--data-urlencode "database=acme_corp" \
--data-urlencode "id=billing_runbook_v3" \
--data-urlencode "limit=500"
{
"success": true,
"data": {
"relations": [
{
"source": {
"name": "PaymentsWorker",
"type": "Service",
"namespace": "default",
"entity_id": "entity_payments_worker",
"identifier": null
},
"target": {
"name": "OrdersDB",
"type": "Database",
"namespace": "default",
"entity_id": "entity_orders_db",
"identifier": null
},
"relations": [
{
"canonical_predicate": "DEPENDS_ON",
"raw_predicate": "depends on",
"context": "PaymentsWorker fetches transactions from OrdersDB during sync.",
"confidence": 0.93,
"temporal_details": "2026-02",
"timestamp": "2026-05-12T08:14:00Z",
"relationship_id": "rel_payments_orders",
"chunk_id": "policy_main_chunk_3",
"source_entity_id": "entity_payments_worker",
"target_entity_id": "entity_orders_db"
}
],
"chunk_id": "policy_main_chunk_3"
}
],
"is_truncated": false,
"next_cursor": null,
"success": true,
"message": "Relations retrieved successfully"
},
"error": null,
"meta": {
"request_id": "9d13aef4-02f4-4e73-8c62-4c2601d04f9d",
"latency_ms": 12.3
}
}
{
"success": true,
"data": {
"relations": [
{
"source": {
"name": "PaymentsWorker",
"type": "Service",
"namespace": "default",
"entity_id": "entity_payments_worker"
},
"target": {
"name": "OrdersDB",
"type": "Database",
"namespace": "default",
"entity_id": "entity_orders_db"
},
"relations": [
{
"canonical_predicate": "DEPENDS_ON",
"raw_predicate": "depends on",
"context": "PaymentsWorker depends on OrdersDB for transaction sync.",
"relationship_id": "rel_payments_orders",
"confidence": 0.88
}
],
"chunk_id": "policy_main_chunk_4"
}
],
"is_truncated": true,
"next_cursor": 0.88,
"success": true,
"message": "Relations retrieved successfully"
},
"error": null,
"meta": {
"request_id": "9d13aef4-02f4-4e73-8c62-4c2601d04f9d",
"latency_ms": 12.3
}
}
{
"success": false,
"data": null,
"error": {
"code": "SOURCE_NOT_FOUND",
"message": "Source not found"
},
"meta": {
"request_id": "9d13aef4-02f4-4e73-8c62-4c2601d04f9d",
"latency_ms": 4.8
}
}
Inspecting Context Relations
See and explore relationships that create the brain for your AI.
relations = client.context.relations(
database="acme_corp",
id="billing_runbook_v3",
limit=500,
)
const relations = await client.context.relations({
database: "acme_corp",
id: "billing_runbook_v3",
limit: 500,
});
curl -G 'https://api.hydradb.com/context/relations' \
-H "Authorization: Bearer <your_api_key>" \
-H "API-Version: 2" \
--data-urlencode "database=acme_corp" \
--data-urlencode "id=billing_runbook_v3" \
--data-urlencode "limit=500"
{
"success": true,
"data": {
"relations": [
{
"source": {
"name": "PaymentsWorker",
"type": "Service",
"namespace": "default",
"entity_id": "entity_payments_worker",
"identifier": null
},
"target": {
"name": "OrdersDB",
"type": "Database",
"namespace": "default",
"entity_id": "entity_orders_db",
"identifier": null
},
"relations": [
{
"canonical_predicate": "DEPENDS_ON",
"raw_predicate": "depends on",
"context": "PaymentsWorker fetches transactions from OrdersDB during sync.",
"confidence": 0.93,
"temporal_details": "2026-02",
"timestamp": "2026-05-12T08:14:00Z",
"relationship_id": "rel_payments_orders",
"chunk_id": "policy_main_chunk_3",
"source_entity_id": "entity_payments_worker",
"target_entity_id": "entity_orders_db"
}
],
"chunk_id": "policy_main_chunk_3"
}
],
"is_truncated": false,
"next_cursor": null,
"success": true,
"message": "Relations retrieved successfully"
},
"error": null,
"meta": {
"request_id": "9d13aef4-02f4-4e73-8c62-4c2601d04f9d",
"latency_ms": 12.3
}
}
{
"success": true,
"data": {
"relations": [
{
"source": {
"name": "PaymentsWorker",
"type": "Service",
"namespace": "default",
"entity_id": "entity_payments_worker"
},
"target": {
"name": "OrdersDB",
"type": "Database",
"namespace": "default",
"entity_id": "entity_orders_db"
},
"relations": [
{
"canonical_predicate": "DEPENDS_ON",
"raw_predicate": "depends on",
"context": "PaymentsWorker depends on OrdersDB for transaction sync.",
"relationship_id": "rel_payments_orders",
"confidence": 0.88
}
],
"chunk_id": "policy_main_chunk_4"
}
],
"is_truncated": true,
"next_cursor": 0.88,
"success": true,
"message": "Relations retrieved successfully"
},
"error": null,
"meta": {
"request_id": "9d13aef4-02f4-4e73-8c62-4c2601d04f9d",
"latency_ms": 12.3
}
}
{
"success": false,
"data": null,
"error": {
"code": "SOURCE_NOT_FOUND",
"message": "Source not found"
},
"meta": {
"request_id": "9d13aef4-02f4-4e73-8c62-4c2601d04f9d",
"latency_ms": 4.8
}
}
id to scope to a single ingested item, or omit it to return all relations in the collection. Set type=memory to inspect a memory’s relations. Pagination handles large result sets.
relations = client.context.relations(
database="acme_corp",
id="billing_runbook_v3",
limit=500,
)
const relations = await client.context.relations({
database: "acme_corp",
id: "billing_runbook_v3",
limit: 500,
});
curl -G 'https://api.hydradb.com/context/relations' \
-H "Authorization: Bearer <your_api_key>" \
-H "API-Version: 2" \
--data-urlencode "database=acme_corp" \
--data-urlencode "id=billing_runbook_v3" \
--data-urlencode "limit=500"
Query parameters
| Name | Description |
|---|---|
Owning database. Formerly tenant_id; the tenant_id alias is still accepted (deprecated). | |
When provided, returns relations for that specific source. When omitted, returns all relations across the collection. (default=null) | |
Bucket selector. Use "memory" when id belongs to a memory item. (default="knowledge") | |
Collection scope. If omitted, the default collection is used. Formerly sub_tenant_id; the sub_tenant_id alias is still accepted (deprecated). (default=null) | |
Maximum relation groups to return. Range 1–10000. (default=5000) | |
Opaque pagination cursor from a previous response’s next_cursor. (default=null) |
{
"success": true,
"data": {
"relations": [
{
"source": {
"name": "PaymentsWorker",
"type": "Service",
"namespace": "default",
"entity_id": "entity_payments_worker",
"identifier": null
},
"target": {
"name": "OrdersDB",
"type": "Database",
"namespace": "default",
"entity_id": "entity_orders_db",
"identifier": null
},
"relations": [
{
"canonical_predicate": "DEPENDS_ON",
"raw_predicate": "depends on",
"context": "PaymentsWorker fetches transactions from OrdersDB during sync.",
"confidence": 0.93,
"temporal_details": "2026-02",
"timestamp": "2026-05-12T08:14:00Z",
"relationship_id": "rel_payments_orders",
"chunk_id": "policy_main_chunk_3",
"source_entity_id": "entity_payments_worker",
"target_entity_id": "entity_orders_db"
}
],
"chunk_id": "policy_main_chunk_3"
}
],
"is_truncated": false,
"next_cursor": null,
"success": true,
"message": "Relations retrieved successfully"
},
"error": null,
"meta": {
"request_id": "9d13aef4-02f4-4e73-8c62-4c2601d04f9d",
"latency_ms": 12.3
}
}
{
"success": true,
"data": {
"relations": [
{
"source": {
"name": "PaymentsWorker",
"type": "Service",
"namespace": "default",
"entity_id": "entity_payments_worker"
},
"target": {
"name": "OrdersDB",
"type": "Database",
"namespace": "default",
"entity_id": "entity_orders_db"
},
"relations": [
{
"canonical_predicate": "DEPENDS_ON",
"raw_predicate": "depends on",
"context": "PaymentsWorker depends on OrdersDB for transaction sync.",
"relationship_id": "rel_payments_orders",
"confidence": 0.88
}
],
"chunk_id": "policy_main_chunk_4"
}
],
"is_truncated": true,
"next_cursor": 0.88,
"success": true,
"message": "Relations retrieved successfully"
},
"error": null,
"meta": {
"request_id": "9d13aef4-02f4-4e73-8c62-4c2601d04f9d",
"latency_ms": 12.3
}
}
{
"success": false,
"data": null,
"error": {
"code": "SOURCE_NOT_FOUND",
"message": "Source not found"
},
"meta": {
"request_id": "9d13aef4-02f4-4e73-8c62-4c2601d04f9d",
"latency_ms": 4.8
}
}
Pagination pattern
all_relations = []
cursor = None
while True:
page = client.context.relations(
database="acme_corp",
id="billing_runbook_v3",
limit=1000,
cursor=cursor,
)
all_relations.extend(page.relations)
if page.next_cursor is None:
break
cursor = page.next_cursor
Some additional notes
next_cursor is opaque (currently a numeric score). Don’t construct it client-side or assume meaning - pass back exactly what the server returned.- Collection-wide queries: Omitting
idreturns relations across the entire collection. This is useful for full-graph exports; pair with a smalllimitand paginate. - Knowledge vs memory: If the
idbelongs to a memory, settype=memory; otherwise the endpoint searches the Knowledge graph. The two graphs are completely separate. - Ordering: Treat
data.relations[]as ranked by relevance within the response. Preserve order for display or LLM context, but do not compare ordering across unrelated queries as an absolute signal. - Graph completeness: Source relations only fully populate once the source’s
indexing_statusreachescompleted. Items ingraph_creationare searchable but their relations may still be in flight. timestampformat differs by endpoint. On this endpoint each relation’stimestampis an ISO-8601 string (e.g.2026-05-12T08:14:00Z). The same relations surfaced as passthrough on Query (ingraph_context) and List Documents carrytimestampas a Unix epoch float (seconds) instead. Normalize before comparing relation timestamps across endpoints.
- Indexing status: Ingestion Status - confirm the graph is complete
- Query with graph context: Query with
graph_context: true - Concepts: Concepts → Context Graphs
Authorizations
API key sent as a Bearer token: "Bearer prefix.secret"
Query Parameters
Database (canonical name for the tenant scope)
"acme_corp"
Collection (canonical name for the sub-tenant scope)
"team_docs"
Deprecated alias for database
"tenant_1234"
Deprecated alias for collection
"sub_tenant_4567"
Source ID (omit for database-wide relations)
"HydraDoc1234"
Corpus type: 'knowledge' or 'memory'
knowledge, memory Max relations to return
Pagination cursor
Principals to answer as (PRO-1684 document ACLs): only relations attributable to sources they may see are returned. Repeated (acl=a&acl=b) or comma-separated. Omit for no ACL scoping.
Response
OK
Show child attributes
Show child attributes
{ "auxiliary_relations": [ { "chunk_id": "HydraEmbeddings123_0", "relations": [ { "canonical_predicate": "works_at", "chunk_id": "HydraEmbeddings123_0", "confidence": 0.92, "context": "Ada joined Acme Corp in 2024 as a staff engineer.", "raw_predicate": "is employed by", "relationship_id": "rel_1234", "source_entity_id": "entity_1a2b", "synthesized": true, "target_entity_id": "entity_3c4d", "temporal_details": "since 2024", "timestamp": "2026-07-02T10:00:00Z" } ], "source": { "entity_id": "entity_1a2b", "identifier": "Acme Corp", "name": "general", "namespace": "organization", "provider": "slack", "type": "knowledge" }, "target": { "entity_id": "entity_1a2b", "identifier": "Acme Corp", "name": "general", "namespace": "organization", "provider": "slack", "type": "knowledge" }, "truncated": true } ], "auxiliary_truncated": true, "is_truncated": false, "message": "Success", "next_cursor": 0.5, "relations": [ { "chunk_id": "HydraEmbeddings123_0", "relations": [ { "canonical_predicate": "works_at", "chunk_id": "HydraEmbeddings123_0", "confidence": 0.92, "context": "Ada joined Acme Corp in 2024 as a staff engineer.", "raw_predicate": "is employed by", "relationship_id": "rel_1234", "source_entity_id": "entity_1a2b", "synthesized": true, "target_entity_id": "entity_3c4d", "temporal_details": "since 2024", "timestamp": "2026-07-02T10:00:00Z" } ], "source": { "entity_id": "entity_1a2b", "identifier": "Acme Corp", "name": "general", "namespace": "organization", "provider": "slack", "type": "knowledge" }, "target": { "entity_id": "entity_1a2b", "identifier": "Acme Corp", "name": "general", "namespace": "organization", "provider": "slack", "type": "knowledge" }, "truncated": true } ], "success": true }
Error message, empty string on success.
Show child attributes
Show child attributes
{ "code": "DATABASE_NOT_FOUND", "message": "Database not found" }
Show child attributes
Show child attributes
{ "collection": "team_docs", "database": "acme_corp", "latency_ms": 12.3, "request_id": "9d13aef4-02f4-4e73-8c62-4c2601d04f9d", "source_type": "file", "sub_tenant_id": "sub_tenant_4567", "tenant_id": "tenant_1234" }
Whether the request succeeded.
true
Was this page helpful?
