Multi-Turn Conversation History
Preserves multi-turn chat message arrays with user, assistant, and system roles for contextual continuity.
Conversational text completion and multi-turn chat API for building intelligent assistants and interactive web apps.
https://rsflowhub.com/api/v1/ai/chat
X-API-Key header{
"message": "What is the capital of France?",
"conversation": [
{
"role": "user",
"content": "Hello AI."
},
{
"role": "assistant",
"content": "Hello! How can I help you?"
}
],
"system_prompt": "You are a helpful geography expert."
}
{
"result": {
"message": "Here are three ideas: 1) PocketPlan, 2) CampusCash, 3) SemesterSaver."
}
}
AI Conversational Chat API is a REST API on RSFlowHub for web, mobile and AI agent applications. Send a JSON request to POST /api/v1/ai/chat with your API key; RSFlowHub runs it on a tuned AI model, falls back to a backup provider if needed, and returns a structured JSON result, usually within 1 to 3 seconds.
POST /api/v1/ai/chatX-API-Key headerSend these fields as a JSON body. An invalid or missing field returns a 422 error that names the field.
| Field | Type | Required | Description |
|---|---|---|---|
message |
string | Required | The latest message from the user (Max: 15,000 chars) |
conversation |
array of objects | Optional | Previous chat history to maintain context. Each object must have "role" (system, user, assistant) and "content" (string). |
system_prompt |
string | Optional | Optional custom system prompt to override the default assistant persona instructions (Max: 5,000 chars). |
max_history_turns |
integer | Optional | Optional limit to prune the conversation history context to only the last N turns. Prevents token inflation (1 to 20). |
safe_mode |
boolean | Optional | Optional. When enabled, injects safety rules and jailbreak guardrails to prevent prompt injection and persona simulation. Default is false. |
Copy, replace rfh_your_api_key with your key and run. Prefer a client library? See the official SDKs.
curl -X POST "https://rsflowhub.com/api/v1/ai/chat" \
-H "Content-Type: application/json" \
-H "X-API-Key: rfh_your_api_key" \
-d '{"message":"What is the capital of France?","conversation":[{"role":"user","content":"Hello AI."},{"role":"assistant","content":"Hello! How can I help you?"}],"system_prompt":"You are a helpful geography expert."}'
<?php
$client = new \GuzzleHttp\Client();
$response = $client->post('https://rsflowhub.com/api/v1/ai/chat', [
'headers' => [
'Content-Type' => 'application/json',
'X-API-Key' => 'rfh_your_api_key',
],
'json' => array (
'message' => 'What is the capital of France?',
'conversation' =>
array (
0 =>
array (
'role' => 'user',
'content' => 'Hello AI.',
),
1 =>
array (
'role' => 'assistant',
'content' => 'Hello! How can I help you?',
),
),
'system_prompt' => 'You are a helpful geography expert.',
),
]);
echo $response->getBody();
const response = await fetch('https://rsflowhub.com/api/v1/ai/chat', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-Key': 'rfh_your_api_key'
},
body: JSON.stringify({"message":"What is the capital of France?","conversation":[{"role":"user","content":"Hello AI."},{"role":"assistant","content":"Hello! How can I help you?"}],"system_prompt":"You are a helpful geography expert."})
});
const data = await response.json();
console.log(data);
import requests
url = "https://rsflowhub.com/api/v1/ai/chat"
headers = {
"Content-Type": "application/json",
"X-API-Key": "rfh_your_api_key"
}
payload = {"message":"What is the capital of France?","conversation":[{"role":"user","content":"Hello AI."},{"role":"assistant","content":"Hello! How can I help you?"}],"system_prompt":"You are a helpful geography expert."}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
Every RSFlowHub endpoint uses the same envelope, so one parser handles all of them. Failed calls are not charged.
{
"success": true,
"request_id": "req_3f9a2c7e-5b1d-4e8a-9c2f-7d6e1a0b4c8d",
"data": {
"result": {
"message": "Here are three ideas: 1) PocketPlan, 2) CampusCash, 3) SemesterSaver."
}
},
"meta": {
"version": "v1",
"timestamp": "2026-10-05T09:30:00Z"
}
}
{
"success": false,
"request_id": "req_8c1d4e2a-7f3b-4a9c",
"error": {
"code": "VALIDATION_ERROR",
"message": "The given data was invalid.",
"details": {
"message": [
"This field is required."
]
}
},
"meta": {
"version": "v1",
"timestamp": "2026-10-05T09:30:00Z"
}
}
| Field | Type | Meaning |
|---|---|---|
success | boolean | true when the call worked, false on any error. |
request_id | string | Unique id for this call. Quote it when you contact support. |
data.result | object | The result of this endpoint (see the example). |
error | object | Only on failure: code, message and details per field. |
meta | object | API version and server timestamp. |
All error codes: Errors reference
Preserves multi-turn chat message arrays with user, assistant, and system roles for contextual continuity.
Control assistant persona, business guardrails, and system grounding rules via system prompts.
High-throughput infrastructure optimized for real-time chat widgets and web application backends.
Returns structured JSON envelopes with status code, execution metrics, and clean response payload.
How teams use the AI Conversational Chat API in production.
Deploy intelligent in-app chat assistants to answer common customer inquiries 24/7.
Our support team is available Monday through Friday from 9 AM to 6 PM EST.Answers routine customer inquiries automatically so agents focus on complex cases.
Build interactive learning bots that guide students step-by-step through complex subjects.
Photosynthesis is how plants turn sunlight, water, and air into food and oxygen!Delivers personalized 1-on-1 tutoring at unlimited scale.
Embed conversational prompts inside SaaS dashboards to help users perform complex actions.
Go to Billing > Invoices, then click the "Download Monthly PDF" button.Accelerates user onboarding and boosts feature adoption.
If you want full control of the chat experience, the chat API gives your own app a conversational reply from a single endpoint, with provider fallback and one bill. Combine it with a knowledge base so replies are grounded in your content.
How it works in a chatbot
Build the chat interface yourself and keep the system prompt and tone under your control.
No separate OpenAI, Gemini or DeepSeek accounts to manage.
The RSFlowHub chat widget gives you a finished chatbot with leads, tickets and auto replies from one script tag.
Want a chatbot without building one? The RSFlowHub AI chatbot for your website is live in about 5 minutes with one script tag: it answers from your documents, captures leads and creates support tickets. Read the chat widget guide, try the live chatbot demo, see chatbot pricing, or build your own with the chatbots API.
The same job done three ways.
| Topic | RSFlowHub API | Raw LLM prompts | Rules / regex |
|---|---|---|---|
| Output | Validated JSON fields | Free text you have to parse | Fixed patterns only |
| Setup | One POST request, no prompts | Write and maintain prompts and parsing | Write and maintain rule lists |
| Provider outage | Automatic fallback to a backup model | You build retries and a second vendor | Not applicable |
| Pricing | 1 credit per call, failed calls free | Per token, per vendor | Your own servers and upkeep |
| Understands context | Yes, AI model | Yes, AI model | No, keywords only |
Free plan with 100 credits/month + 1,000 bonus credits when you sign in before 23 Nov. Test it in the playground first, no code needed.
Flowy
AI assistant