The Platform API

Documents

Manage your videos, ask questions, and build applications with the Platform API. Explore the operations below for request details, responses, and examples.

Documents

Upload reference documents (PDFs, policies, manuals) that provide context for the AI agent. Documents have three states:

available — searchable by agent tool
included — always taken into account by the agent
archived — hidden from agent
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"
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"}'
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
            }
          }