Call your agent from your own code: chat, background runs, tasks and schedules, and website knowledge.
To put the agent inside your web app as a sidebar, see the embed docs. For how-to answers on plans, credits and settings, see Help.
Go to Settings, API Keys, and create a key with Chat access. To create tasks or add websites, give it Manage access too. Copy it when it is shown: you will not see it again.
curl -X POST https://lotsagent.com/api/v1/agents/YOUR_AGENT_HANDLE/chat \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"message": "What does the Pro plan include?"}'Send your key as a Bearer token on every request.
Authorization: Bearer YOUR_API_KEYA key acts as you, the owner. It reaches your own agents. Keep it on your server. Never put it in a web page or an app people can download.
Base URL: https://lotsagent.com/api/v1. In every path below, use the agent's handle or its id.
/api/v1/agents/{agent}/chatSend one message and get the agent's answer. Pass session_id from an earlier answer to continue the same chat.
{
"message": "What does the Pro plan include?",
"session_id": "optional, from an earlier answer",
"stream": false
}{
"success": true,
"data": {
"session_id": "uuid",
"status": "completed",
"message": "Pro includes 5 agents and $25 of credits every month...",
"runtime": "claude_managed"
}
}Without stream, the request waits up to 110 seconds for the answer. status is completed, incomplete (it ran out of time: ask again in the same chat), refused or failed.
With "stream": true the answer arrives as server-sent events, for up to 150 seconds:
data: {"type":"text-delta","delta":"Pro includes"}
data: {"type":"text-delta","delta":" 5 agents"}
data: {"type":"finish","session_id":"uuid","status":"completed"}
data: [DONE]Over the API nobody can press a Confirm card, so a tool that would ask for Confirm is not run. File attachments can't be sent over the API.
For longer work, start a run and check on it later. The run keeps going if your connection drops.
/api/v1/agent-runsStart a run. Returns at once with run_id.
{
"agent_id": "the agent's id",
"message": "Summarise this week's new support questions",
"source": "api",
"session_id": "optional"
}{
"success": true,
"data": { "run_id": "uuid", "status": "queued", "session_id": "uuid" }
}/api/v1/agent-runs/{run_id}The run's status and, when it is done, its answer in final_answer.
{
"success": true,
"data": {
"id": "uuid",
"status": "completed",
"final_answer": "Here is this week's summary...",
"summary": "...",
"steps": []
}
}A task is saved instructions the agent runs by hand, once at a set time, or on a schedule. You can also make them in the console, in the agent's Deploy tab, under Tasks and schedules.
/api/v1/agents/{agent}/tasksList the agent's tasks.
{ "success": true, "data": [ { "id": "uuid", "name": "Morning summary", "schedule_type": "cron" } ], "total": 1 }/api/v1/agents/{agent}/tasksCreate a task. schedule_type is manual, once (with scheduled_at) or cron (with cron_expression).
{
"name": "Morning summary",
"instructions": "Summarise yesterday's new support questions in five lines.",
"schedule_type": "cron",
"cron_expression": "0 9 * * 1-5",
"timezone": "Europe/London"
}{ "success": true, "data": { "id": "uuid", "name": "Morning summary" }, "next_execution_at": "2026-11-03T09:00:00Z" }/api/v1/tasks/{task}/executeRun a task now. It waits for the result; send wait: false to get a run_id at once and poll /agent-runs/{run_id}.
{ "wait": false, "input": {} }{ "success": true, "data": { "run_id": "uuid", "status": "queued", "poll_url": "/api/v1/agent-runs/uuid" } }/api/v1/tasks/{task}/executionsThe task's past runs.
{ "success": true, "data": [ { "id": "uuid", "status": "completed" } ] }Add your docs or help site as knowledge. LotsAgent reads the pages, keeps them up to date on the schedule you pick, and answers link to the page they came from.
/api/v1/agents/{agent}/knowledge/websitesAdd a website. mode is pages_under (the default: the page and the pages under it) or single_page; a sitemap address (.xml) reads every page in it. schedule is off, daily or weekly.
{ "url": "https://example.com/help", "mode": "pages_under", "schedule": "daily" }{ "success": true, "data": { "id": "uuid", "url": "https://example.com/help" } }/api/v1/agents/{agent}/knowledge/websitesList the agent's websites and their pages.
{ "success": true, "data": [ { "id": "uuid", "url": "https://example.com/help" } ] }/api/v1/agents/{agent}/knowledge/websites/{site}/syncRe-sync a website now. Answers 409 while a sync is already running.
{ "success": true, "data": { "id": "uuid" } }Use your agent from any MCP client, such as Claude, ChatGPT or Cursor. Turn on Allow MCP connections in the agent's Deploy tab, under API and MCP (it is off by default), then add this address to your client:
https://lotsagent.com/api/v1/agents/YOUR_AGENT_HANDLE/mcpThe client finds the sign-in by itself (OAuth). You can also send an API key as a Bearer token.
An agent on the current engine can call your own API. Add actions on the agent's Tools tab: import an OpenAPI 3 document (URL, or paste or upload JSON or YAML), or add one HTTP request with an https URL template such as https://api.example.com/orders/{order_id}. Auth: none, an API key in a header or the query, or a bearer token, stored encrypted and never shown again.
Each action has a class: read, write, send or delete. Reads run; the rest show a Confirm card, as app tools do. Through the chat API, MCP and scheduled runs nobody can press Confirm, so those calls are refused and the reply says so. Calls go only to public https addresses (checked again at call time, same-host redirects only), stop at the action's timeout (1 to 30 seconds) and size cap (up to 1 MB), and are limited to 60 a minute per agent. Each call is listed in Activity, Action calls.
To manage actions from code or an AI app, use the LotsAgent API at https://api.lotsagent.com/mcp: list_agent_actions, preview_openapi_actions, import_openapi_actions, add_agent_read_action, add_agent_write_action, update_agent_read_action, update_agent_write_action, remove_agent_action, test_agent_action and list_agent_action_calls.
Errors use standard HTTP status codes, with a JSON body:
{
"success": false,
"error": { "code": "AUTHENTICATION_REQUIRED", "message": "Authentication required" }
}