API docs

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.

Quick start

1. Make an API key

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.

2. Ask your agent something

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?"}'

Authentication

Send your key as a Bearer token on every request.

Authorization: Bearer YOUR_API_KEY

A 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.

Chat

POST/api/v1/agents/{agent}/chat

Send one message and get the agent's answer. Pass session_id from an earlier answer to continue the same chat.

Request body

{
  "message": "What does the Pro plan include?",
  "session_id": "optional, from an earlier answer",
  "stream": false
}

Answer

{
  "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.

Background runs

For longer work, start a run and check on it later. The run keeps going if your connection drops.

POST/api/v1/agent-runs

Start a run. Returns at once with run_id.

Request body

{
  "agent_id": "the agent's id",
  "message": "Summarise this week's new support questions",
  "source": "api",
  "session_id": "optional"
}

Answer

{
  "success": true,
  "data": { "run_id": "uuid", "status": "queued", "session_id": "uuid" }
}
GET/api/v1/agent-runs/{run_id}

The run's status and, when it is done, its answer in final_answer.

Answer

{
  "success": true,
  "data": {
    "id": "uuid",
    "status": "completed",
    "final_answer": "Here is this week's summary...",
    "summary": "...",
    "steps": []
  }
}

Tasks and schedules

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.

GET/api/v1/agents/{agent}/tasks

List the agent's tasks.

Answer

{ "success": true, "data": [ { "id": "uuid", "name": "Morning summary", "schedule_type": "cron" } ], "total": 1 }
POST/api/v1/agents/{agent}/tasks

Create a task. schedule_type is manual, once (with scheduled_at) or cron (with cron_expression).

Request body

{
  "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"
}

Answer

{ "success": true, "data": { "id": "uuid", "name": "Morning summary" }, "next_execution_at": "2026-11-03T09:00:00Z" }
POST/api/v1/tasks/{task}/execute

Run a task now. It waits for the result; send wait: false to get a run_id at once and poll /agent-runs/{run_id}.

Request body

{ "wait": false, "input": {} }

Answer

{ "success": true, "data": { "run_id": "uuid", "status": "queued", "poll_url": "/api/v1/agent-runs/uuid" } }
GET/api/v1/tasks/{task}/executions

The task's past runs.

Answer

{ "success": true, "data": [ { "id": "uuid", "status": "completed" } ] }

Website knowledge

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.

POST/api/v1/agents/{agent}/knowledge/websites

Add 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.

Request body

{ "url": "https://example.com/help", "mode": "pages_under", "schedule": "daily" }

Answer

{ "success": true, "data": { "id": "uuid", "url": "https://example.com/help" } }
GET/api/v1/agents/{agent}/knowledge/websites

List the agent's websites and their pages.

Answer

{ "success": true, "data": [ { "id": "uuid", "url": "https://example.com/help" } ] }
POST/api/v1/agents/{agent}/knowledge/websites/{site}/sync

Re-sync a website now. Answers 409 while a sync is already running.

Answer

{ "success": true, "data": { "id": "uuid" } }

MCP

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/mcp

The client finds the sign-in by itself (OAuth). You can also send an API key as a Bearer token.

Your own API as actions

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

Errors use standard HTTP status codes, with a JSON body:

{
  "success": false,
  "error": { "code": "AUTHENTICATION_REQUIRED", "message": "Authentication required" }
}
API docs | LotsAgent