Basics
- Base URL:
https://api.recursivechat.dev - JSON in and out, over HTTPS only.
- Most requests need your
workspaceId, and requests about one website, agent or conversation also need itssiteId. IDs are shown in the dashboard and returned by the API.
curl "https://api.recursivechat.dev/v1/conversations?workspaceId=ws_123&status=needs_human" \
-H "Authorization: Bearer rc_sk_your_secret_key"API keys and scopes
Create keys in the dashboard under API. A key is shown once, starts with rc_sk_, and is sent as a Bearer token. Store it on your server; never put it in a web page or app.
Give each key only what it needs. Scopes come in read and write pairs:
| Scope | Covers |
|---|---|
conversations:read | List and read conversations and messages, export transcripts. |
conversations:write | Reply as the team, add notes, take over, close, reopen, assign, mark read. |
agents:read / write | Read, create, update and delete agents; test an agent. |
knowledge:read / write | Read, add, refresh and delete knowledge sources. |
sites:read / write | Read, add, update and delete websites. |
visitors:read / write | Read visitors and their page views; set tags. |
members:read / write | Read the team, invite, change roles and remove people. |
usage:read | Read this month’s usage. |
A key can also be limited to some of your websites. Keys can never create or delete other keys: that needs a signed in person in the dashboard.
Requests, responses and errors
Successful responses wrap the result in data. Errors return an error object with a stable code, a readable message and a requestId to quote if you contact us.
{
"data": {
"conversations": [
{
"conversation": { "id": "conv_…", "status": "open", "mode": "ai", "needsHuman": true, … },
"visitor": { "id": "vis_…", "email": "sam@example.com", "metadata": { "plan": "Pro" }, … }
}
]
}
}{
"error": {
"code": "forbidden",
"message": "API key is missing the conversations:write scope",
"requestId": "req_…"
}
}| Status | Code | Meaning |
|---|---|---|
| 401 | unauthenticated | Missing or invalid key. |
| 403 | forbidden | The key lacks a scope or access to that website. |
| 404 | not_found | No such item, or it belongs to another workspace. |
| 409 | conflict | Not possible in the current state, such as replying to a closed conversation. |
| 413 | payload_too_large | The upload or text is too big. |
| 422 | validation_failed | A field is missing or wrong. The message says which. |
| 429 | rate_limited | Too many requests. Wait and retry with backoff. |
| 500 | internal | Something went wrong on our side. |
Conversations
List and detail requests take workspaceId and siteId as query parameters. Actions take them in the JSON body.
- GET/v1/conversationsconversations:readList conversations, newest first. Query:
status(open,needs_human,closedorall),siteId,limitup to 100. - GET/v1/conversations/:idconversations:readOne conversation with its visitor.
- GET/v1/conversations/:id/messagesconversations:readThe messages, including internal notes.
- GET/v1/conversations/:id/exportconversations:readTranscript download. Query:
format(jsonorcsv),anonymize(trueorfalse). - POST/v1/conversations/:id/messagesconversations:writeReply as the team. Body:
content. Replying takes the conversation over from the AI and clears Needs you. - POST/v1/conversations/:id/notesconversations:writeInternal note the visitor never sees. Body:
content. - POST/v1/conversations/:id/handoffconversations:writeBody:
action(takeoverstops the AI,returnhands back to it). - POST/v1/conversations/:id/closeconversations:writeClose the conversation.
- POST/v1/conversations/:id/reopenconversations:writeReopen it.
- POST/v1/conversations/:id/assignconversations:writeBody:
assigneeUid, ornullto unassign. - POST/v1/conversations/:id/readconversations:writeMark it read by the team.
curl -X POST "https://api.recursivechat.dev/v1/conversations/conv_123/messages" \
-H "Authorization: Bearer rc_sk_your_secret_key" \
-H "Content-Type: application/json" \
-d '{
"workspaceId": "ws_123",
"siteId": "site_123",
"content": "Thanks for waiting. I have refreshed your account, please try again."
}'Agents
Agent requests take workspaceId and siteId as query parameters. The fields match the agent's Settings in the dashboard.
- GET/v1/agentsagents:readList agents. Query:
siteIdto filter. - POST/v1/agentsagents:writeCreate an agent. Body:
siteId,name, and any settings below. - GET/v1/agents/:agentIdagents:readRead an agent.
- PATCH/v1/agents/:agentIdagents:writeUpdate settings. Send only the fields you change.
- DELETE/v1/agents/:agentIdagents:writeSwitch an agent off. It stops answering and no longer appears on your site.
- POST/v1/agents/:agentId/chatagents:readTest the agent without starting a real conversation. Body:
message, optionalhistory.
| Field | Type |
|---|---|
instructions | Text, 10 to 8,000 characters. |
tone | friendly, professional or concise. |
language | auto to reply in the visitor's language, or a language code such as en. |
welcomeMessage | First message shown in the chat. |
fallbackMessage | What the AI may say when it cannot help. |
humanHandoffEnabled | true or false. |
handoffStyle | solve_first or offer_early. |
replyTime | Text such as "within one working day", or null. |
teamHours | Set hours: days (0 Sunday to 6 Saturday), start and end as 24 hour HH:MM, and an IANA timeZone such as Europe/London. Or null. |
supportHours | Hours in your own words, used only when teamHours is null. |
aiContextFields | Visitor metadata keys the AI may see, up to 25. |
aiSeesCurrentPage | true or false. |
requireEmail | Ask for an email in the chat after the first message. |
status | active or disabled. |
appearance | Colours, position, launcher style, header text and more. Send only the fields you change. |
curl -X PATCH "https://api.recursivechat.dev/v1/agents/agent_123?workspaceId=ws_123&siteId=site_123" \
-H "Authorization: Bearer rc_sk_your_secret_key" \
-H "Content-Type: application/json" \
-d '{
"handoffStyle": "solve_first",
"replyTime": "within one working day",
"teamHours": {
"days": [1, 2, 3, 4, 5],
"start": "09:00",
"end": "17:00",
"timeZone": "Europe/London"
},
"aiContextFields": ["plan"]
}'Knowledge
Knowledge requests take workspaceId and siteId as query parameters. New and refreshed sources are read in the background: check status until it is ready. For a web page, mediaCount says how many same-site images and videos were kept with its passages. When the AI answers from one of those passages, its message can carry a media list (each with kind image or video, src, poster and alt), which the widget shows as cards.
- GET/v1/agents/:agentId/sourcesknowledge:readList sources with their status.
- POST/v1/agents/:agentId/sourcesknowledge:writeAdd a source. Body:
typeurlwithurl, ortypetextwithtitleandtext(up to 200,000 characters). - GET/v1/agents/:agentId/sources/:sourceIdknowledge:readOne source.
- GET/v1/agents/:agentId/sources/:sourceId/chunksknowledge:readThe passages the AI searches, to check what it has read.
- POST/v1/agents/:agentId/sources/:sourceId/syncknowledge:writeRead the source again, for example after the page changed.
- DELETE/v1/agents/:agentId/sources/:sourceIdknowledge:writeRemove a source.
curl -X POST "https://api.recursivechat.dev/v1/agents/agent_123/sources?workspaceId=ws_123&siteId=site_123" \
-H "Authorization: Bearer rc_sk_your_secret_key" \
-H "Content-Type: application/json" \
-d '{
"type": "text",
"title": "Product guide",
"text": "# Getting started\n..."
}'Websites
- GET/v1/sitessites:readList websites, with their widget IDs.
- POST/v1/sitessites:writeAdd a website.
- GET/v1/sites/:siteIdsites:readOne website.
- PATCH/v1/sites/:siteIdsites:writeUpdate a website.
- DELETE/v1/sites/:siteIdsites:writeRemove a website. Its chat stops working.
Visitors
Visitor requests take workspaceId and siteId as query parameters.
- GET/v1/visitors/:idvisitors:readA visitor, with location, browser, metadata and tags.
- GET/v1/visitors/:id/pageviewsvisitors:readPages they have visited.
- GET/v1/visitors/:id/conversationsvisitors:readTheir conversations.
- PATCH/v1/visitors/:id/tagsvisitors:writeReplace their tags. Body:
workspaceId,siteId,tags(up to 20).
Team and usage
- GET/v1/membersmembers:readYour team and their roles.
- PATCH/v1/members/:uidmembers:writeChange a role or which websites someone can see.
- DELETE/v1/members/:uidmembers:writeRemove someone.
- GET/v1/invitationsmembers:readPending invitations.
- POST/v1/invitationsmembers:writeInvite someone by email.
- DELETE/v1/invitations/:invitationIdmembers:writeCancel an invitation.
- GET/v1/usageusage:readThis month’s AI replies and other usage.