Generated documents
Generated documents are files that agents create for you with the deployment's generation tools: text, Markdown, HTML, Word and PowerPoint documents, PDFs, spreadsheets, charts and images. Each document belongs to the user it was generated for, and you can only list, download and delete your own. They are separate from the files people upload to chats.
A document's id is an opaque string. The download links that agents include in their answers use the same id.
- GET /api/documents List generated documents
- GET /api/documents/{doc_id} Download a generated document
- DEL /api/documents/{doc_id} Delete a generated document
Paths are relative to /agent-hub-api
The generated document object
One file an agent generated for the caller.
Attributes
-
idstringOpaque identifier of the document. Use it to download or delete the document.
-
created_atstringWhen the document was generated (UTC, ISO 8601).
-
user_idstringId of the user the document belongs to, as a string. Always the caller.
-
session_idnullable stringId of the session the document was generated in, when known.
-
categorystringRecord category. Generated documents are recorded as
generated. -
filenamestringFile name used for downloads. Generation tools prefix it with the generation time.
-
mime_typestringMedia type of the file.
{
"id": "NDIvZ2VuZXJhdGVkLzIwMjYwOTAxXzA5MzAwMF9yZWxlYXNlLW5vdGVzLTQtMi5kb2N4",
"created_at": "2026-09-01T09:30:00.412816",
"user_id": "42",
"session_id": "5b8e1f3a-2c9d-4a67-b1e4-7f0c3d9a2e58",
"category": "generated",
"filename": "release-notes-4-2.docx",
"mime_type": "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
} List generated documents
GET /agent-hub-api/api/documents
Returns the documents generated for the caller, newest first.
- Authentication
- Bearer token How it works
Query parameters
-
session_idstringOnly documents generated in this session.
-
categorystringOnly documents recorded under this category.
-
limitintegerMaximum number of documents to return, from 1 to 1,000. Values outside that range are clamped.
-
offsetintegerNumber of documents to skip.
Returns
Returns documents, a page of generated document objects, with total (the number of matching documents), offset, limit and the caller's user_id.
curl "$VDF_BASE_URL/agent-hub-api/api/documents?session_id=5b8e1f3a-2c9d-4a67-b1e4-7f0c3d9a2e58&limit=20" \
-H "Authorization: Bearer $VDF_ACCESS_TOKEN" const response = await fetch(`${process.env.VDF_BASE_URL}/agent-hub-api/api/documents?session_id=5b8e1f3a-2c9d-4a67-b1e4-7f0c3d9a2e58&limit=20`, {
headers: {
Authorization: `Bearer ${process.env.VDF_ACCESS_TOKEN}`,
},
});
if (!response.ok) throw new Error(`Request failed with status ${response.status}`);
const data = await response.json(); import os
import requests
response = requests.get(
f"{os.environ['VDF_BASE_URL']}/agent-hub-api/api/documents",
headers={"Authorization": f"Bearer {os.environ['VDF_ACCESS_TOKEN']}"},
params={
"session_id": "5b8e1f3a-2c9d-4a67-b1e4-7f0c3d9a2e58",
"limit": 20,
},
timeout=30,
)
response.raise_for_status()
data = response.json() {
"success": true,
"user_id": "42",
"total": 2,
"offset": 0,
"limit": 20,
"documents": [
{
"id": "NDIvZ2VuZXJhdGVkLzIwMjYwOTAxXzEwMTUxMl9xMy1yZXZlbnVlLWNoYXJ0LnBuZw",
"created_at": "2026-09-01T10:15:12.084511",
"user_id": "42",
"session_id": "5b8e1f3a-2c9d-4a67-b1e4-7f0c3d9a2e58",
"category": "generated",
"filename": "q3-revenue-chart.png",
"mime_type": "image/png"
},
{
"id": "NDIvZ2VuZXJhdGVkLzIwMjYwOTAxXzA5MzAwMF9yZWxlYXNlLW5vdGVzLTQtMi5kb2N4",
"created_at": "2026-09-01T09:30:00.412816",
"user_id": "42",
"session_id": "5b8e1f3a-2c9d-4a67-b1e4-7f0c3d9a2e58",
"category": "generated",
"filename": "release-notes-4-2.docx",
"mime_type": "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
}
]
} Download a generated document
GET /agent-hub-api/api/documents/{doc_id}
Downloads one of the caller's generated documents.
The file is sent as an attachment named after the document's filename, with the document's mime_type. Responses carry an ETag, so clients can revalidate with If-None-Match.
- Authentication
- Bearer token How it works
Path parameters
-
doc_idstring RequiredThe document's
id.
Returns
Returns the document's contents as a file download.
Errors
- 400
doc_idis not a valid document id. - 404 You have no document with this id, or its file no longer exists.
curl "$VDF_BASE_URL/agent-hub-api/api/documents/NDIvZ2VuZXJhdGVkLzIwMjYwOTAxXzA5MzAwMF9yZWxlYXNlLW5vdGVzLTQtMi5kb2N4" \
-H "Authorization: Bearer $VDF_ACCESS_TOKEN" \
-o documents.bin const response = await fetch(`${process.env.VDF_BASE_URL}/agent-hub-api/api/documents/NDIvZ2VuZXJhdGVkLzIwMjYwOTAxXzA5MzAwMF9yZWxlYXNlLW5vdGVzLTQtMi5kb2N4`, {
headers: {
Authorization: `Bearer ${process.env.VDF_ACCESS_TOKEN}`,
},
});
if (!response.ok) throw new Error(`Request failed with status ${response.status}`);
const file = await response.blob(); import os
import requests
response = requests.get(
f"{os.environ['VDF_BASE_URL']}/agent-hub-api/api/documents/NDIvZ2VuZXJhdGVkLzIwMjYwOTAxXzA5MzAwMF9yZWxlYXNlLW5vdGVzLTQtMi5kb2N4",
headers={"Authorization": f"Bearer {os.environ['VDF_ACCESS_TOKEN']}"},
stream=True,
timeout=30,
)
response.raise_for_status()
with open("documents.bin", "wb") as output:
for chunk in response.iter_content(chunk_size=65536):
output.write(chunk) Delete a generated document
DEL /agent-hub-api/api/documents/{doc_id}
Permanently deletes one of the caller's generated documents.
Deletes the file and its record. Download links to the document stop working.
- Authentication
- Bearer token How it works
Path parameters
-
doc_idstring RequiredThe document's
id.
Returns
Returns the deleted document's id, deleted_file (whether a file was removed from storage), and removed_registry_entries (the number of document records removed).
Errors
- 400
doc_idis not a valid document id. - 404 You have no document with this id.
- 500 The file could not be removed; the document is left unchanged.
curl -X DELETE "$VDF_BASE_URL/agent-hub-api/api/documents/NDIvZ2VuZXJhdGVkLzIwMjYwOTAxXzA5MzAwMF9yZWxlYXNlLW5vdGVzLTQtMi5kb2N4" \
-H "Authorization: Bearer $VDF_ACCESS_TOKEN" const response = await fetch(`${process.env.VDF_BASE_URL}/agent-hub-api/api/documents/NDIvZ2VuZXJhdGVkLzIwMjYwOTAxXzA5MzAwMF9yZWxlYXNlLW5vdGVzLTQtMi5kb2N4`, {
method: 'DELETE',
headers: {
Authorization: `Bearer ${process.env.VDF_ACCESS_TOKEN}`,
},
});
if (!response.ok) throw new Error(`Request failed with status ${response.status}`);
const data = await response.json(); import os
import requests
response = requests.delete(
f"{os.environ['VDF_BASE_URL']}/agent-hub-api/api/documents/NDIvZ2VuZXJhdGVkLzIwMjYwOTAxXzA5MzAwMF9yZWxlYXNlLW5vdGVzLTQtMi5kb2N4",
headers={"Authorization": f"Bearer {os.environ['VDF_ACCESS_TOKEN']}"},
timeout=30,
)
response.raise_for_status()
data = response.json() {
"success": true,
"user_id": "42",
"id": "NDIvZ2VuZXJhdGVkLzIwMjYwOTAxXzA5MzAwMF9yZWxlYXNlLW5vdGVzLTQtMi5kb2N4",
"deleted_file": true,
"removed_registry_entries": 1
}