import requests
url = "https://api.hydradb.com/fetch/content"
payload = {
"tenant_id": "tenant_1234",
"source_id": "<source_id>",
"sub_tenant_id": "sub_tenant_4567",
"mode": "content",
"expiry_seconds": 1
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
tenant_id: 'tenant_1234',
source_id: '<source_id>',
sub_tenant_id: 'sub_tenant_4567',
mode: 'content',
expiry_seconds: 1
})
};
fetch('https://api.hydradb.com/fetch/content', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://api.hydradb.com/fetch/content \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"tenant_id": "tenant_1234",
"source_id": "<source_id>",
"sub_tenant_id": "sub_tenant_4567",
"mode": "content",
"expiry_seconds": 1
}
'{
"source_id": "<source_id>",
"success": true,
"content": "<string>",
"content_base64": "<string>",
"presigned_url": "<string>",
"content_type": "<string>",
"size_bytes": 123,
"message": "File fetched successfully",
"error": "<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>"
}
}{
"detail": {
"success": true,
"message": "Error occurred",
"error_code": "<string>"
}
}Fetch Content
Retrieve the original content of an ingested source.
import requests
url = "https://api.hydradb.com/fetch/content"
payload = {
"tenant_id": "tenant_1234",
"source_id": "<source_id>",
"sub_tenant_id": "sub_tenant_4567",
"mode": "content",
"expiry_seconds": 1
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
tenant_id: 'tenant_1234',
source_id: '<source_id>',
sub_tenant_id: 'sub_tenant_4567',
mode: 'content',
expiry_seconds: 1
})
};
fetch('https://api.hydradb.com/fetch/content', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://api.hydradb.com/fetch/content \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"tenant_id": "tenant_1234",
"source_id": "<source_id>",
"sub_tenant_id": "sub_tenant_4567",
"mode": "content",
"expiry_seconds": 1
}
'{
"source_id": "<source_id>",
"success": true,
"content": "<string>",
"content_base64": "<string>",
"presigned_url": "<string>",
"content_type": "<string>",
"size_bytes": 123,
"message": "File fetched successfully",
"error": "<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>"
}
}{
"detail": {
"success": true,
"message": "Error occurred",
"error_code": "<string>"
}
}When to use it
- Download original files – PDFs, DOCX, etc. that you uploaded
- Generate temporary share links – presigned URLs for client-side access
- Re-extract content – rebuild downstream caches from the source of truth
- Preview – display original content alongside recall results
Endpoint
- Auth: Bearer token
- Idempotency: Read-only
- Async: No
Example
curl -X POST 'https://api.hydradb.com/fetch/content' \
-H "Authorization: Bearer <your_api_key>" \
-H "Content-Type: application/json" \
-d '{
"tenant_id": "my_first_tenant",
"source_id": "doc_12345",
"mode": "url",
"expiry_seconds": 3600
}'
const result = await client.fetch.content({
tenant_id: "my_first_tenant",
source_id: "doc_12345",
mode: "url",
expiry_seconds: 3600
});
result = client.fetch.content(
tenant_id="my_first_tenant",
source_id="doc_12345",
mode="url",
expiry_seconds=3600,
)
Request parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
tenant_id | string | Yes | – | The tenant the source belongs to. |
source_id | string | Yes | – | The source to fetch. |
sub_tenant_id | string | No | default | Sub-tenant scope. |
mode | enum | No | content | What to return. See Modes. |
expiry_seconds | integer | No | 3600 | Presigned URL expiry (60–604800, i.e., 1 minute to 7 days). Only relevant when mode includes url. |
Modes
| Mode | Returns |
|---|---|
content (default) | File content as text, or base64 for binary files |
url | Presigned URL only |
both | Content and presigned URL |
url for client-side downloads where you don’t want to proxy bytes through your backend.
Use content when you need to process the file inline.
Response
{
"success": true,
"source_id": "doc_12345",
"content": "Q4 Pricing Strategy\n\nThis document outlines...",
"content_base64": null,
"presigned_url": "https://storage.hydradb.com/presigned/...",
"content_type": "application/pdf",
"size_bytes": 245760,
"message": "File fetched successfully"
}
| Field | Description |
|---|---|
success | true on a successful fetch. |
source_id | The source that was fetched. |
content | Text content (when mode is content or both and the file is text). |
content_base64 | Base64-encoded content for binary files. |
presigned_url | Time-limited download URL (when mode is url or both). |
content_type | MIME type of the source. |
size_bytes | Size of the original file. |
error | Error message if fetch failed. |
Behavior notes
content is empty and the data is in content_base64. For markdown, plain text, or extracted text, content is populated directly.expiry_seconds elapses, the URL stops working. Generate a fresh URL for each long-lived integration rather than caching them.Related endpoints
- Find sources first: List data – browse to find a
source_id - Inspect relationships: Graph relations by source ID – see entities extracted from this source
Errors
Common codes:400 INVALID_PARAMETERS, 404 SOURCE_NOT_FOUND, 422 VALIDATION_ERROR. See Error Responses for the full list.Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
Request to fetch source file content.
Unique identifier for the tenant/organization
"tenant_1234"
Source ID of the file to fetch
"<source_id>"
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"
Fetch mode: 'content' returns file content, 'url' returns presigned URL, 'both' returns both
content, url, both Expiry time in seconds for presigned URL (60-604800, default: 3600)
60 <= x <= 6048001
Response
Successful Response
Response for file fetch request.
Source ID of the fetched file
"<source_id>"
Whether the fetch was successful
true
File content as string (if mode includes 'content')
File content as base64 encoded string (for binary files, if mode includes 'content')
Presigned URL to access the file (if mode includes 'url')
Content type of the file
Size of the file in bytes
Response message
Error message if fetch failed
Was this page helpful?
