import requests
url = "https://api.hydradb.com/list/graph_relations_by_id"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.hydradb.com/list/graph_relations_by_id', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request GET \
--url https://api.hydradb.com/list/graph_relations_by_id \
--header 'Authorization: Bearer <token>'{
"relations": [],
"success": true,
"message": "Relations retrieved successfully"
}{
"detail": {
"success": true,
"message": "Error occurred",
"error_code": "<string>"
}
}{
"detail": {
"success": true,
"message": "Error occurred",
"error_code": "<string>"
}
}{
"detail": {
"success": true,
"message": "Error occurred",
"error_code": "<string>"
}
}{
"detail": {
"success": true,
"message": "Error occurred",
"error_code": "<string>"
}
}{
"detail": {
"success": true,
"message": "Error occurred",
"error_code": "<string>"
}
}{
"detail": {
"success": true,
"message": "Error occurred",
"error_code": "<string>"
}
}{
"detail": {
"success": true,
"message": "Error occurred",
"error_code": "<string>"
}
}Graph Relations By Source ID
Retrieve all entity relationships extracted from a single source.
import requests
url = "https://api.hydradb.com/list/graph_relations_by_id"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.hydradb.com/list/graph_relations_by_id', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request GET \
--url https://api.hydradb.com/list/graph_relations_by_id \
--header 'Authorization: Bearer <token>'{
"relations": [],
"success": true,
"message": "Relations retrieved successfully"
}{
"detail": {
"success": true,
"message": "Error occurred",
"error_code": "<string>"
}
}{
"detail": {
"success": true,
"message": "Error occurred",
"error_code": "<string>"
}
}{
"detail": {
"success": true,
"message": "Error occurred",
"error_code": "<string>"
}
}{
"detail": {
"success": true,
"message": "Error occurred",
"error_code": "<string>"
}
}{
"detail": {
"success": true,
"message": "Error occurred",
"error_code": "<string>"
}
}{
"detail": {
"success": true,
"message": "Error occurred",
"error_code": "<string>"
}
}{
"detail": {
"success": true,
"message": "Error occurred",
"error_code": "<string>"
}
}When to use it
- Debugging graph construction – verify HydraDB extracted the relationships you expected
- Visualizations – build entity graphs in admin UIs
- Audit – confirm what entities and connections exist for a specific document
Endpoint
- Auth: Bearer token
- Idempotency: Read-only
- Async: No
Example
curl 'https://api.hydradb.com/list/graph_relations_by_id?source_id=doc_12345&tenant_id=my_first_tenant&limit=100' \
-H "Authorization: Bearer <your_api_key>"
const response = await client.fetch.graphRelationsBySourceId({
source_id: "doc_12345",
tenant_id: "my_first_tenant",
limit: 100
});
response = client.fetch.graph_relations_by_source_id(
source_id="doc_12345",
tenant_id="my_first_tenant",
limit=100,
)
Query parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
source_id | string | No (defaults to root) | – | The source to fetch relations for. Optional - if omitted, returns top-level entity relations. |
tenant_id | string | Yes | – | The tenant the source belongs to. |
sub_tenant_id | string | No | default | Sub-tenant scope. |
is_memory | boolean | No | false | Set true to fetch relations for a memory; false for knowledge. |
limit | integer | No | 250 | Maximum number of relations to return. |
Response
{
"success": true,
"message": "Relations retrieved successfully",
"relations": [
{
"source": {
"name": "Pricing Strategy",
"type": "PROJECT",
"entity_id": "ent_abc123",
"namespace": "default"
},
"target": {
"name": "Product Team",
"type": "ORGANIZATION",
"entity_id": "ent_def456",
"namespace": "default"
},
"relations": [
{
"canonical_predicate": "OWNED_BY",
"raw_predicate": "is owned by",
"context": "The Q4 pricing strategy was developed and is owned by the Product Team...",
"confidence": 0.92,
"relationship_id": "rel_xyz789",
"chunk_id": "chunk_001"
}
],
"chunk_id": "chunk_001"
}
]
}
| Field | Description |
|---|---|
relations[] | Array of triplets extracted from this source. |
relations[].source | Subject entity. |
relations[].target | Object entity. |
relations[].relations[] | Evidence for the relationship. Multiple entries mean the same connection appears in multiple chunks. |
relations[].relations[].canonical_predicate | Normalized relationship type (e.g., OWNED_BY, REPORTS_TO, WORKS_FOR). |
relations[].relations[].raw_predicate | The original phrasing extracted from the text. |
relations[].relations[].context | Surrounding context for the relationship. |
relations[].relations[].confidence | Extraction confidence (0.0–1.0). |
relations[].chunk_id | The chunk this triplet came from. |
Entity types
Thetype field on each entity is normalized at extraction. Common types:
| Type | Examples |
|---|---|
PERSON | Named individuals |
ORGANIZATION | Companies, teams, departments |
PROJECT | Initiatives, products, releases |
PRODUCT | Specific products or services |
ERROR_CODE | Error identifiers |
LOCATION | Geographic entities |
Behavior notes
is_memory: true to look up relations for a memory item. The default (false) targets knowledge sources.Related endpoints
- Browse sources first: List data – find the
source_idyou want to inspect - Retrieve content: Fetch content – get the original file or text
- Use in recall: Full recall with
graph_context: true– see graph context applied to a query
Errors
Common codes:400 INVALID_PARAMETERS, 404 SOURCE_NOT_FOUND, 422 VALIDATION_ERROR. See Error Responses for the full list.
Read more: Essentials → Context GraphsAuthorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Query Parameters
The source ID to fetch relations for
"<str>"
Unique identifier for the tenant/organization
"tenant_1234"
Whether to fetch relations for memories
"<str>"
Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.
"sub_tenant_4567"
Maximum number of relations to return
"<str>"
Response
Successful Response
List of relations retrieved
Triple with multiple evidence items from different chunks
Show child attributes
Show child attributes
[]
Indicates whether the request was successful
true
Response message describing the operation result
Was this page helpful?
