Documents
Manage your videos, ask questions, and build applications with the Platform API. Explore the operations below for request details, responses, and examples.
No matching documentation. Try a different search.
Documents
Upload reference documents (PDFs, policies, manuals) that provide context for the AI agent. Documents have three states:
GET/api/v1/projects/:projectId/documentsList documents
List documents
Query params: category, status, search
POST/api/v1/projects/:projectId/documentsUpload document
Upload document
Multipart form-data. Field: file. Max 50MB. Supported: PDF, DOCX, TXT, MD, CSV, JSON, PNG, JPEG.
Additional form fields: name, category, description, status, tags (JSON array).
Default status: available. Set to included to auto-compile into agent prompt.
curl -X POST https://platform.endlessai.com/api/v1/projects/PROJECT_ID/documents \
-H "X-Api-Key: YOUR_KEY" \
-F "file=@policy.pdf" \
-F "name=Content Moderation Policy" \
-F "category=moderation_policy" \
-F "status=included"import requests
with open("policy.pdf", "rb") as f:
resp = requests.post(
f"{BASE}/projects/{PROJECT_ID}/documents",
headers={"X-Api-Key": API_KEY},
files={"file": ("policy.pdf", f, "application/pdf")},
data={
"name": "Content Moderation Policy",
"category": "moderation_policy",
"status": "included"
},
)
print(resp.json())const form = new FormData();
form.append("file", fileBlob, "policy.pdf");
form.append("name", "Content Moderation Policy");
form.append("category", "moderation_policy");
form.append("status", "included");
const res = await fetch(
`${BASE}/projects/${projectId}/documents`,
{ method: "POST", headers: { "X-Api-Key": API_KEY }, body: form }
);GET/api/v1/projects/:projectId/documents/:docIdGet document metadata
Get document metadata
Send the request to https://platform.endlessai.com/api/v1/projects/:projectId/documents/:docId using your project key or user token.
PUT/api/v1/projects/:projectId/documents/:docIdBetaUpdate document metadata / change status
Update document metadata / change status
Beta: this operation may change before it is final.
Update name, description, category, status, tags.
Status values:
available — the agent looks it up when a question needs it
included — the agent always takes it into account
archived — the agent does not use it
Changing the status to or from included updates the agent right away.
# Make document available (searchable by agent tool)
curl -X PUT https://platform.endlessai.com/api/v1/projects/PROJECT_ID/documents/DOC_ID \
-H "X-Api-Key: YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"status": "available"}'
# Include in agent prompt (auto-compiles)
curl -X PUT https://platform.endlessai.com/api/v1/projects/PROJECT_ID/documents/DOC_ID \
-H "X-Api-Key: YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"status": "included"}'
# Archive (hide from agent)
curl -X PUT https://platform.endlessai.com/api/v1/projects/PROJECT_ID/documents/DOC_ID \
-H "X-Api-Key: YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"status": "archived"}'import requests
# Change document status
resp = requests.put(
f"{BASE}/projects/{PROJECT_ID}/documents/{DOC_ID}",
headers={"X-Api-Key": API_KEY, "Content-Type": "application/json"},
json={"status": "included"}, # or "available" or "archived"
)
print(resp.json())const res = await fetch(
`${BASE}/projects/${projectId}/documents/${docId}`,
{
method: "PUT",
headers: { "X-Api-Key": API_KEY, "Content-Type": "application/json" },
body: JSON.stringify({ status: "included" })
}
);DELETE/api/v1/projects/:projectId/documents/:docIdDelete document and file
Delete document and file
Send the request to https://platform.endlessai.com/api/v1/projects/:projectId/documents/:docId using your project key or user token.
GET/api/v1/projects/:projectId/documents/:docId/contentDownload/serve file
Download/serve file
Send the request to https://platform.endlessai.com/api/v1/projects/:projectId/documents/:docId/content using your project key or user token.
POST/api/v1/projects/:projectId/documents/compileTrigger context compilation
Trigger context compilation
Refresh what the agent knows from all includeddocuments. Returns the updated context.
GET/api/v1/projects/:projectId/documents/compiledGet current compiled context
Get current compiled context
Send the request to https://platform.endlessai.com/api/v1/projects/:projectId/documents/compiled using your project key or user token.
GET/api/v1/projects/:projectId/documents/:docId/textGet a document's text
Get a document's text
Returns the full text by default. Query: section_id for one section of a compiled policy, or clause (a verbatim quote) for the passage around it — clause_offset and clause_length mark the match.
{
"data": {
"doc_id": "DOC_ID",
"name": "Community guidelines.pdf",
"mode": "clause_window",
"text": "...Threats of violence against a person or group are not allowed...",
"clause_found": true,
"clause_offset": 3,
"clause_length": 64,
"truncated_window": true
}
}