Skip to content
Back to documentation

API reference

The two APIs behind AgentPro: the widget API and the dashboard API.

Base URL

https://agentpro.chat/api/v1

All paths below are relative to this base. Requests and responses are JSON unless noted; errors return { error, message } with a matching HTTP status (400 validation, 401 authentication, 403 forbidden, 404 not found, 429 rate limited).

Widget API

Authentication

Each agent has its own widget API key, starting with cbp_. Find it in the agent's Embed tab (or rotate it there). Send it on every request as the X-API-Key header. The key only works while the agent is Active and, if you configured allowed domains, from pages on those domains.

curl -X POST "https://agentpro.chat/api/v1/widget/chat" \
  -H "X-API-Key: cbp_YOUR_WIDGET_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "message": "How do I track my order?", "visitorId": "visitor-123" }'

Endpoints

GET/widget/config

Agent name, status, welcome and fallback messages, colours, position, pre-chat form flags, business hours and the active theme.

POST/widget/chat

Send a visitor message and receive the AI reply.

Body: { message (1–2000 chars), conversationId?, visitorId?, visitorToken?, pageUrl?, pageTitle?, referrer?, utmSource?, utmMedium?, utmCampaign? }. Response: { conversationId, visitorMessageId, messageId, timestamp, response, citations[], handoff }. When a human agent has taken over, response is null and handoff is true; poll the messages endpoint for their reply.

GET/widget/conversations/:id/messages

Poll a conversation for new messages (how the widget sees agent replies).

Query: after? (ISO date), visitorId?. Response: { conversationId, aiEnabled, status, messages[] } with up to 50 messages, each { id, senderType, content, createdAt, sources }.

POST/widget/conversations/:id/visitor

Attach visitor details captured by your own form.

Body: { visitorId?, visitorName?, visitorEmail?, visitorPhone? }. Response: { conversationId, visitor }.

POST/upload

Upload attachments (multipart/form-data, one or more files plus an optional conversationId field).

Accepts X-API-Key or a dashboard bearer token. Files up to 10 MB, common document and image types only. Response: { urls[], conversationId }. Limited to 60 uploads per hour per IP.

Example response from POST /widget/chat

{
  "conversationId": "7f1a9c2e-...-...",
  "visitorMessageId": "c0ffee00-...-...",
  "messageId": "a1b2c3d4-...-...",
  "timestamp": "2026-10-13T09:15:02.000Z",
  "response": "You can track your order from the Orders page...",
  "citations": [{ "title": "Shipping FAQ", "url": "https://example.com/faq#shipping" }],
  "handoff": false
}

Reuse conversationId on the next call to keep the thread; the server rebuilds the history itself and never trusts history sent by the browser.

Dashboard API

Authentication

The dashboard API is what the AgentPro dashboard itself uses. Sign in with POST /auth/login to receive a short-lived accessToken and a refreshToken; send the access token as a Bearer header and exchange the refresh token at POST /auth/refresh when it expires. Every route is scoped to the organisation of the signed-in user.

curl -X POST "https://agentpro.chat/api/v1/auth/login" \
  -H "Content-Type: application/json" \
  -d '{ "email": "you@company.com", "password": "..." }'

curl "https://agentpro.chat/api/v1/chatbots" \
  -H "Authorization: Bearer ACCESS_TOKEN"

Authentication

POST/auth/login

Body { email, password } → { accessToken, refreshToken, user }.

POST/auth/refresh

Body { refreshToken } → new token pair.

GET/auth/me

The signed-in user and organisation.

POST/auth/logout

Invalidate the refresh token.

Agents

GET/chatbots

List agents. Query: page, limit, search.

POST/chatbots

Create. Body includes name, welcomeMessage, language, tone, aiModelId, temperature, maxTokens, systemPrompt.

GET/chatbots/:id

One agent.

PUT/chatbots/:id

Update any writable field.

DELETE/chatbots/:id

Delete the agent and its data.

GET/chatbots/:id/embed-code

The widget snippet with this agent’s API key.

POST/chatbots/:id/regenerate-key

Rotate the widget API key.

GET/chatbots/:id/stats

Totals, active conversations, average messages per conversation, average response time, top intents.

POST/chatbots/:id/test-chat

Send a test message without creating a visitor conversation.

Knowledge

GET/chatbots/:chatbotId/knowledge

List entries. Query: page, limit, type (TEXT|URL|FILE), status (PENDING|PROCESSING|ACTIVE|FAILED).

POST/chatbots/:chatbotId/knowledge

Create. JSON { type: "TEXT"|"URL", title, content?, sourceUrl? } or multipart/form-data with a file field.

GET/chatbots/knowledge

All entries across the organisation (same query parameters).

GET/chatbots/knowledge/:id

One entry.

GET/chatbots/knowledge/:id/chunks

Indexed chunks. Query: page, limit, q, pageUrl.

PUT/chatbots/knowledge/:id

Update title, content or sourceUrl (re-indexes).

POST/chatbots/knowledge/:id/reprocess

Re-crawl or re-index.

DELETE/chatbots/knowledge/:id

Delete the entry and its chunks.

Conversations and messages

GET/chatbots/:chatbotId/conversations

List. Query: page, limit, status, channelType, assignedAgentId.

GET/chatbots/:chatbotId/conversations/stats

Counts by status for one agent.

GET/chatbots/conversations/:id

One conversation with its messages.

PUT/chatbots/conversations/:id

Update status, priority, tags or assignment.

DELETE/chatbots/conversations/:id

Delete a conversation.

GET/conversations/:conversationId/messages

Messages of a conversation.

POST/messages

Append a message to a conversation.

Inbox (all agents)

GET/inbox/conversations

Organisation-wide conversation list with filters and search.

GET/inbox/stats

Open, pending, resolved and unassigned counts.

GET/inbox/conversations/:id

One conversation with messages and visitor details.

POST/inbox/conversations/:id/messages

Reply as an agent. Body { content, isInternalNote? }.

PUT/inbox/conversations/:id/ai

Pause or resume AI replies. Body { enabled }.

PUT/inbox/conversations/:id/assign

Assign to an agent. Body { agentId }.

PUT/inbox/conversations/:id/status

Body { status }.

PUT/inbox/conversations/:id/read

Mark as read.

GET/inbox/canned-responses

Saved replies (also POST, PUT /:id, DELETE /:id).

Analytics

GET/analytics/organization

Totals and per-day series for the whole organisation. Query: startDate, endDate.

GET/analytics/trends

Conversations and messages per day. Query: days (default 7), chatbotId.

GET/analytics/channels

Conversations by channel. Query: chatbotId.

GET/analytics/usage

Usage for a month. Query: month=YYYY-MM.

GET/analytics/tokens/pricing

Model price list (per 1K tokens) for the models your plan can use.

Channels (/channels), team (/team), notifications (/notifications) and billing (/subscription) follow the same pattern. Billing changes require the Owner or Admin role.

Rate limits

ScopeLimit
All endpoints300 requests per minute per IP address
POST /widget/chat30 requests per minute per API key and IP, plus the per-agent messages-per-minute limit set in the agent settings
POST /upload60 uploads per hour per IP
POST /auth/login10 attempts per 15 minutes per IP
POST /auth/register5 per hour per IP
Password reset and invite acceptance5–10 per 15 minutes per IP

Limited requests return HTTP 429 with a message saying when to retry. Limits are the same on every plan.

Questions about the API?

Tell us what you are building and we will point you at the right endpoints.