Skip to main content
POST
/
api
/
chat
/
workflow
Stream sandbox-driven chat (Vercel Workflow)
curl --request POST \
  --url https://api.recoupable.com/api/chat/workflow \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "messages": [
    {
      "id": "<string>",
      "content": "<string>"
    }
  ],
  "chatId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "sessionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "context": {
    "contextLimit": 123
  }
}
'
"<string>"

Documentation Index

Fetch the complete documentation index at: https://developers.recoupable.com/llms.txt

Use this file to discover all available pages before exploring further.

Authorizations

x-api-key
string
header
required

Your Recoup API key. Learn more.

Body

application/json

Chat workflow request

Request body for the sandbox-driven, Workflow-backed chat endpoint. Requires an existing session, chat, and provisioned sandbox. The Bearer key from the Authorization header is forwarded into the sandbox for skill-based callbacks to the Recoup API — no separate access-token field needed.

messages
object[]
required

Conversation history as an array of UIMessage objects, matching the Vercel AI SDK UIMessage shape. The last entry is typically the new user turn — the agent loop reads the entire array and persists the latest user message before the workflow starts.

chatId
string<uuid>
required

UUID of an existing chat under sessionId. The chat's active_stream_id column is used for compare-and-set race control across concurrent requests.

sessionId
string<uuid>
required

UUID of the session that owns both the chat and the sandbox. The session must have a non-null sandbox_state — call POST /api/sandbox first if not.

context
object

Optional per-prompt context overrides forwarded into the agent loop.

Response

Server-Sent Events stream of UI message parts compatible with the Vercel AI SDK createUIMessageStreamResponse. The x-workflow-run-id response header carries the durable workflow run ID for resume/stop operations.

Server-Sent Events stream containing UI message parts