Agent / Chat
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.
Agent / Chat
Send messages to the AI agent for analysis. The agent has access to project videos and documents, and can examine frames, compare visuals, and search project documents to answer your question.
POST/api/v1/projects/:projectId/agent/processSend message for AI processing
Send message for AI processing
Request body:
{
"message": "What companies signed the NDA?",
"streaming": true,
"useUnifiedSSE": true,
"sessionId": "unique-session-id",
"videoId": ["VIDEO_ID_1"]
}message (required) — the user query
streaming — enable streaming response via SSE
useUnifiedSSE — use unified SSE channel (recommended)
sessionId — session ID for multi-turn memory
videoId — specific video(s). If omitted, all project videos are used.
arrayId — use a video array instead of individual IDs
curl -X POST https://platform.endlessai.com/api/v1/projects/PROJECT_ID/agent/process \
-H "X-Api-Key: YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"message": "Describe what happens in the first 10 seconds",
"sessionId": "session-001"
}'import requests
resp = requests.post(
f"{BASE}/projects/{PROJECT_ID}/agent/process",
headers={"X-Api-Key": API_KEY, "Content-Type": "application/json"},
json={
"message": "Describe what happens in the first 10 seconds",
"sessionId": "session-001"
},
timeout=300
)
print(resp.json())const res = await fetch(
`${BASE}/projects/${projectId}/agent/process`,
{
method: "POST",
headers: { "X-Api-Key": API_KEY, "Content-Type": "application/json" },
body: JSON.stringify({
message: "Describe what happens in the first 10 seconds",
sessionId: "session-001"
})
}
);
const result = await res.json();Response shape (non-streaming):
{
"success": true,
"sessionId": "session-001",
"summary": {
"iterations": 1,
"processingTimeMs": 4200
},
"timestamp": "2026-02-23T10:30:00.000Z"
}summary gives you iteration count, token totals, and processing time for the run.
POST/api/v1/projects/:projectId/agent/askAsk a question and poll for the answer
Ask a question and poll for the answer
Starts a run and returns 202 with a run_id to poll. Pass video_id to ask about one video; otherwise the project's videos are used. One run at a time per credential — a second ask while one is running returns 409 with the active run_id. Returns 402 with code: "budget_stopped" when the project's token budget is paused.
curl -X POST https://platform.endlessai.com/api/v1/projects/PROJECT_ID/agent/ask \
-H "X-Api-Key: YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"question": "When did the first truck arrive?", "video_id": "VIDEO_ID"}'
# Then poll the run
curl https://platform.endlessai.com/api/v1/projects/PROJECT_ID/agent/runs/RUN_ID \
-H "X-Api-Key: YOUR_KEY"import time, requests
headers = {"X-Api-Key": API_KEY}
run = requests.post(
f"{BASE}/projects/{PROJECT_ID}/agent/ask",
headers=headers,
json={"question": "When did the first truck arrive?", "video_id": VIDEO_ID},
).json()
while True:
result = requests.get(
f"{BASE}/projects/{PROJECT_ID}/agent/runs/{run['run_id']}",
headers=headers,
).json()
if result["status"] != "running":
break
time.sleep(5)
print(result.get("answer") or result.get("error"))const headers = { "X-Api-Key": API_KEY, "Content-Type": "application/json" };
const { run_id } = await (await fetch(
`${BASE}/projects/${projectId}/agent/ask`,
{
method: "POST",
headers,
body: JSON.stringify({ question: "When did the first truck arrive?", video_id: videoId }),
}
)).json();
let result;
do {
await new Promise((r) => setTimeout(r, 5000));
result = await (await fetch(
`${BASE}/projects/${projectId}/agent/runs/${run_id}`,
{ headers }
)).json();
} while (result.status === "running");
console.log(result.answer ?? result.error);// Response (202 Accepted)
{
"run_id": "RUN_ID",
"status": "running",
"poll": "/api/v1/projects/PROJECT_ID/agent/runs/RUN_ID"
}GET/api/v1/projects/:projectId/agent/runs/:runIdGet an ask run
Get an ask run
status is running, complete, error or timeout. A run is kept for one hour. A completed run may later gain a correction field; the original answer is never changed.
{
"run_id": "RUN_ID",
"project_id": "PROJECT_ID",
"status": "complete",
"question": "When did the first truck arrive?",
"answer": "The first truck backs into bay 2 at 00:04:12.",
"error": null,
"started_at": "2026-10-01T09:30:00.000Z",
"completed_at": "2026-10-01T09:30:41.000Z"
}POST/api/v1/qna/agentAsk a question about a video, collection or video list
Ask a question about a video, collection or video list
Project key only; answers within the request. Send question and exactly one of videoId, arrayId or videoIds. Reuse the returned sessionId to ask follow-up questions with the same memory.
// Request
{
"question": "Did any forklift enter the pedestrian lane?",
"arrayId": "ARRAY_ID",
"sessionId": "session-001"
}
// Response
{
"success": true,
"sessionId": "session-001",
"content": "Yes — twice: at 00:12 and at 03:47.",
"summary": { "iterations": 4, "processingTimeMs": 18342 },
"timestamp": "2026-10-01T09:30:00.000Z"
}