file = client.context.inspect(
id="policy_main",
database="acme_corp",
mode="both",
expiry_seconds=3600,
)
const file = await client.context.inspect({
id: "policy_main",
database: "acme_corp",
mode: "both",
expirySeconds: 3600,
});
curl -G 'https://api.hydradb.com/context/inspect' \
-H "Authorization: Bearer <your_api_key>" \
-H "API-Version: 2" \
--data-urlencode "id=policy_main" \
--data-urlencode "database=acme_corp" \
--data-urlencode "mode=both" \
--data-urlencode "expiry_seconds=3600"
{
"success": true,
"data": {
"success": true,
"id": "policy_main",
"content": null,
"content_base64": "JVBERi0xLjcKJeLjz9MKMSAwIG9iago8PC9UeXBlL0NhdGFsb2c...",
"inferred_content": null,
"presigned_url": "https://storage.hydradb.com/.../policy_main.pdf?X-Amz-...",
"content_type": "application/pdf",
"size_bytes": 1842233,
"message": "File fetched successfully",
"error": null
},
"error": null,
"meta": {
"request_id": "9d13aef4-02f4-4e73-8c62-4c2601d04f9d",
"latency_ms": 12.3
}
}
{
"success": false,
"data": null,
"error": {
"code": "NOT_FOUND",
"message": "Source 'policy_main' not found. Verify the id is correct and the source has been ingested."
},
"meta": {
"request_id": "9d13aef4-02f4-4e73-8c62-4c2601d04f9d",
"latency_ms": 4.8
}
}
Context
Inspect Context
Read the original content of a knowledge source or memory, or get a download URL.
GET
/
context
/
inspect
file = client.context.inspect(
id="policy_main",
database="acme_corp",
mode="both",
expiry_seconds=3600,
)
const file = await client.context.inspect({
id: "policy_main",
database: "acme_corp",
mode: "both",
expirySeconds: 3600,
});
curl -G 'https://api.hydradb.com/context/inspect' \
-H "Authorization: Bearer <your_api_key>" \
-H "API-Version: 2" \
--data-urlencode "id=policy_main" \
--data-urlencode "database=acme_corp" \
--data-urlencode "mode=both" \
--data-urlencode "expiry_seconds=3600"
{
"success": true,
"data": {
"success": true,
"id": "policy_main",
"content": null,
"content_base64": "JVBERi0xLjcKJeLjz9MKMSAwIG9iago8PC9UeXBlL0NhdGFsb2c...",
"inferred_content": null,
"presigned_url": "https://storage.hydradb.com/.../policy_main.pdf?X-Amz-...",
"content_type": "application/pdf",
"size_bytes": 1842233,
"message": "File fetched successfully",
"error": null
},
"error": null,
"meta": {
"request_id": "9d13aef4-02f4-4e73-8c62-4c2601d04f9d",
"latency_ms": 12.3
}
}
{
"success": false,
"data": null,
"error": {
"code": "NOT_FOUND",
"message": "Source 'policy_main' not found. Verify the id is correct and the source has been ingested."
},
"meta": {
"request_id": "9d13aef4-02f4-4e73-8c62-4c2601d04f9d",
"latency_ms": 4.8
}
}
Return the stored original of one knowledge source or memory by
In
id: its content inline, a presigned download URL, or both. Use it to show a source behind a query result or to let a user download the original file.
file = client.context.inspect(
id="policy_main",
database="acme_corp",
mode="both",
expiry_seconds=3600,
)
const file = await client.context.inspect({
id: "policy_main",
database: "acme_corp",
mode: "both",
expirySeconds: 3600,
});
curl -G 'https://api.hydradb.com/context/inspect' \
-H "Authorization: Bearer <your_api_key>" \
-H "API-Version: 2" \
--data-urlencode "id=policy_main" \
--data-urlencode "database=acme_corp" \
--data-urlencode "mode=both" \
--data-urlencode "expiry_seconds=3600"
{
"success": true,
"data": {
"success": true,
"id": "policy_main",
"content": null,
"content_base64": "JVBERi0xLjcKJeLjz9MKMSAwIG9iago8PC9UeXBlL0NhdGFsb2c...",
"inferred_content": null,
"presigned_url": "https://storage.hydradb.com/.../policy_main.pdf?X-Amz-...",
"content_type": "application/pdf",
"size_bytes": 1842233,
"message": "File fetched successfully",
"error": null
},
"error": null,
"meta": {
"request_id": "9d13aef4-02f4-4e73-8c62-4c2601d04f9d",
"latency_ms": 12.3
}
}
{
"success": false,
"data": null,
"error": {
"code": "NOT_FOUND",
"message": "Source 'policy_main' not found. Verify the id is correct and the source has been ingested."
},
"meta": {
"request_id": "9d13aef4-02f4-4e73-8c62-4c2601d04f9d",
"latency_ms": 4.8
}
}
Fetch modes
| Mode | Returns | Use when |
|---|---|---|
content | Original text in content, or binary data encoded as base64 in content_base64. The unused field is null. | You want the content inline. It is the stored original, so a PDF comes back as base64, not extracted text. Check both fields for unknown types. |
url | Presigned URL (presigned_url) valid for expiry_seconds. content, content_base64, and inferred_content are null. | You want a client or a service to download the original file directly without proxying through your backend. |
both (default) | Everything content returns, and the presigned URL. | UI flows that show text inline plus a “Download original” link. |
content and both modes, the response also includes inferred_content when available: the model-derived text for the source (for memories, the inferred memory statement; for knowledge, derived or normalized content). It is null when the source has no inferred content.
Mode examples
- mode=content
- mode=url
- mode=both (binary file)
- Memory source (mode=both)
{
"success": true,
"data": {
"success": true,
"id": "policy_main",
"content": null,
"content_base64": "JVBERi0xLjcKJeLjz9MKMSAwIG9iago8PC9UeXBlL0NhdGFsb2c...",
"inferred_content": null,
"presigned_url": null,
"content_type": "application/pdf",
"size_bytes": 1842233,
"message": "File fetched successfully",
"error": null
},
"error": null,
"meta": {
"request_id": "9d13aef4-02f4-4e73-8c62-4c2601d04f9d",
"latency_ms": 12.3
}
}
{
"success": true,
"data": {
"success": true,
"id": "policy_main",
"content": null,
"content_base64": null,
"inferred_content": null,
"presigned_url": "https://storage.hydradb.com/.../policy_main.pdf?X-Amz-...",
"content_type": "application/pdf",
"size_bytes": 1842233,
"message": "File fetched successfully",
"error": null
},
"error": null,
"meta": {
"request_id": "9d13aef4-02f4-4e73-8c62-4c2601d04f9d",
"latency_ms": 12.3
}
}
{
"success": true,
"data": {
"success": true,
"id": "diagram_png",
"content": null,
"content_base64": "iVBORw0KGgoAAAANSUhEUgAA...",
"inferred_content": null,
"presigned_url": "https://storage.hydradb.com/.../diagram.png?X-Amz-...",
"content_type": "image/png",
"size_bytes": 92844,
"message": "File fetched successfully",
"error": null
},
"error": null,
"meta": {
"request_id": "9d13aef4-02f4-4e73-8c62-4c2601d04f9d",
"latency_ms": 12.3
}
}
{
"success": true,
"data": {
"success": true,
"id": "mem_user_alex_tone",
"content": "Prefers concise answers and dark mode.",
"content_base64": null,
"inferred_content": "User prefers concise answers and dark mode.",
"presigned_url": "https://storage.hydradb.com/.../mem_user_alex_tone?X-Amz-...",
"content_type": "text/plain; charset=utf-8",
"size_bytes": 38,
"message": "File fetched successfully",
"error": null
},
"error": null,
"meta": {
"request_id": "9d13aef4-02f4-4e73-8c62-4c2601d04f9d",
"latency_ms": 12.3
}
}
Behavior notes
- Recently ingested sources: Fetching immediately after ingestion returns the stored original, but
inferred_contentstaysnulluntil indexing produces it. For reliable reads, check Ingestion Status first. - Presigned URL TTL: The URL is valid only for
expiry_seconds, from60to604800(7 days), default3600. Anyone with the URL can download the file during that window, so treat it as a short-lived secret. - Memories: Fetching a memory’s
idreturns its raw text content (a conversation memory returns its stored JSON, withuser_nameandpairs). Memories are stored like files, somode=urlandmode=bothalso return apresigned_url. - Access control:
acllists the principals to answer as. A source they cannot see returns the same404as a missing one. Repeat or comma-separate values, or omitaclfor no caller-supplied ACL filtering. For enforced connectors, the authenticated caller is used instead; see ACL enforcement.
Errors
Common codes:400 INVALID_INPUT (missing id or database, an unknown mode, or expiry_seconds outside 60 to 604800), 404 DATABASE_NOT_FOUND, 404 NOT_FOUND (the source does not exist, or acl is set and its principals may not see it), 500 INTERNAL_ERROR (a transient storage error; retry). See Error Responses for the full list.
Related resources
- Before this: List Context: find a source ID
- Before this: Ingestion Status: confirm indexing finished
- Related: Connected Subgraph: find the sources connected to this one
Authorizations
Query Parameters
Response
OK
Show child attributes
Show child attributes
Example:
{
"content": "# Q4 Report\n\nRevenue grew 23% quarter over quarter.",
"content_type": "application/pdf",
"error": null,
"id": "HydraDoc1234",
"inferred_content": "Summary: Q4 revenue rose 23% QoQ, driven by enterprise expansion.",
"message": "Success",
"presigned_url": "https://storage.hydradb.com/sources/HydraDoc1234?sig=...",
"size_bytes": 20480,
"success": true
}
Show child attributes
Show child attributes
Example:
{
"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",
"warnings": [
{
"code": "acl_ignored_by_connector_enforcement",
"collections": ["team_docs", "engineering"],
"message": "This connector enforces ACL, so the request's acl was ignored."
}
]
}
Was this page helpful?
