Your user IDs
Each call carries your externalUserId. Flutch keeps that person's conversations and contact, so history, limits and handoff work per user.
Send your users' messages to the agent with your own user IDs and get the reply in one response or as a stream. Conversations, history, uploads and buttons come with the same API key, and a ready React chat is on npm.
POST /api/v1/agents/{agentId}/invoke returns the reply, and /stream sends it as server-sent events. Pass your own externalUserId, and Flutch creates that user on the first call.
curl https://api.flutch.ai/api/v1/agents/$AGENT_ID/invoke \
-H "X-API-Key: $FLUTCH_API_KEY" \
-H "Content-Type: application/json" \
-d '{"externalUserId": "customer-42",
"content": {"text": "Do you ship to Spain?"}}'The stream sends a heartbeat every 30 seconds, and the reply keeps generating if the client drops. Reconnect with Last-Event-ID or ?after= and the missed events are replayed for up to an hour, or stop a running reply with the cancel endpoint.
curl -N "https://api.flutch.ai/api/v1/agents/$AGENT_ID/messages/$MESSAGE_ID/stream?userId=customer-42" \
-H "X-API-Key: $FLUTCH_API_KEY" \
-H "Last-Event-ID: 1-7"List a user's conversations and their messages, download attachments and upload files, set reactions and send button presses back to the agent. A reply that is still running can be cancelled.
GET /threads
GET /threads/{threadId}/messages
GET /threads/{threadId}/attachments/{attachmentId}
GET /messages/{messageId}/stream
POST /uploads
PATCH /messages/{messageId}/reactions
POST /callbacks/{token}
POST /cancel@flutchai/chat-core is the client with streaming and conversation state, @flutchai/chat-react is a themeable chat UI on top of it, and @flutchai/chat-contract holds the types. The packages are MIT-licensed on npm. The chat talks to your backend, which adds the API key.
import { ChatProvider, Chat } from "@flutchai/chat-react";
import { createFlutchClient } from "@flutchai/chat-core";
import "@flutchai/chat-react/styles.css";
const client = createFlutchClient({
baseUrl: "/api/chat", // your backend adds X-API-Key
agentId: "<agentId>",
});
export const Support = () => (
<ChatProvider client={client}>
<Chat showThreads />
</ChatProvider>
);Each call carries your externalUserId. Flutch keeps that person's conversations and contact, so history, limits and handoff work per user.
The agent you call over the API also answers in the widget, Instagram and Telegram once you connect them.
The Chat API carries your users' messages. The management API covers datasets, contacts and funnels and sends contact and funnel events to your webhook. Agents, configs and channels are set up in the console and through the MCP connector.
Sign up, start from a ready graph and talk to your agent in the playground. New workspaces start with $5 of credit.