API Reference
Complete API reference for RocketFlow platform
API Reference
RocketFlow provides a comprehensive REST API for integrating chatbot functionality into your applications.
Base URL
All API requests should be made to:
https://api.getrocketflow.io/v1Authentication
RocketFlow uses API keys for authentication. Include your API key in the Authorization header:
Authorization: Bearer YOUR_API_KEYGetting Your API Key
- Log into your RocketFlow Dashboard
- Go to Settings > API Keys
- Create a new API key
- Copy the key and store it securely
⚠️ Warning: Never expose your API key in client-side code. Always use server-side requests for API calls.
Rate Limits
API requests are rate limited to ensure fair usage:
- Free Plan: 1,000 requests per month
- Pro Plan: 10,000 requests per month
- Enterprise Plan: 100,000 requests per month
Rate limit headers are included in all responses:
X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 999
X-RateLimit-Reset: 1640995200Error Handling
The API uses standard HTTP status codes and returns errors in the following format:
{
"error": {
"code": "INVALID_REQUEST",
"message": "The request is missing required parameters",
"details": {
"field": "chatbot_id",
"reason": "required"
}
}
}Common Error Codes
| Code | Status | Description |
|---|---|---|
INVALID_REQUEST | 400 | Request is malformed or missing required parameters |
UNAUTHORIZED | 401 | Invalid or missing API key |
FORBIDDEN | 403 | Insufficient permissions |
NOT_FOUND | 404 | Resource not found |
RATE_LIMITED | 429 | Rate limit exceeded |
SERVER_ERROR | 500 | Internal server error |
Endpoints
Chat
Send Message
Send a message to your chatbot and receive a response.
POST /chatRequest Body:
{
"message": "Hello, how can I help you?",
"chatbot_id": "chatbot_123",
"session_id": "session_456",
"user_id": "user_789",
"context": {
"page_url": "https://example.com/products",
"user_agent": "Mozilla/5.0..."
}
}Response:
{
"response": "Hello! I'm here to help you with any questions about our products.",
"session_id": "session_456",
"message_id": "msg_123",
"timestamp": "2024-01-15T10:30:00Z",
"sources": [
{
"title": "Product Information",
"url": "https://example.com/products",
"relevance": 0.95
}
]
}Get Chat History
Retrieve the conversation history for a session.
GET /chat/history/{session_id}Query Parameters:
| Parameter | Type | Description |
|---|---|---|
limit | integer | Number of messages to return (default: 50) |
offset | integer | Number of messages to skip (default: 0) |
Response:
{
"messages": [
{
"id": "msg_123",
"type": "user",
"content": "Hello, how can I help you?",
"timestamp": "2024-01-15T10:30:00Z"
},
{
"id": "msg_124",
"type": "assistant",
"content": "Hello! I'm here to help you with any questions about our products.",
"timestamp": "2024-01-15T10:30:01Z",
"sources": [...]
}
],
"total": 2,
"has_more": false
}Chatbots
List Chatbots
Get a list of all your chatbots.
GET /chatbotsResponse:
{
"chatbots": [
{
"id": "chatbot_123",
"name": "Customer Support Bot",
"description": "AI assistant for customer support",
"status": "active",
"created_at": "2024-01-01T00:00:00Z",
"updated_at": "2024-01-15T10:30:00Z"
}
],
"total": 1
}Get Chatbot Details
Get detailed information about a specific chatbot.
GET /chatbots/{chatbot_id}Response:
{
"id": "chatbot_123",
"name": "Customer Support Bot",
"description": "AI assistant for customer support",
"status": "active",
"settings": {
"welcome_message": "Hello! How can I help you today?",
"response_style": "friendly",
"max_tokens": 500
},
"knowledge_sources": [
{
"id": "source_123",
"type": "website",
"url": "https://example.com/docs",
"status": "active"
}
],
"created_at": "2024-01-01T00:00:00Z",
"updated_at": "2024-01-15T10:30:00Z"
}Analytics
Get Chatbot Analytics
Get analytics data for a specific chatbot.
GET /analytics/chatbots/{chatbot_id}Query Parameters:
| Parameter | Type | Description |
|---|---|---|
start_date | string | Start date (ISO 8601 format) |
end_date | string | End date (ISO 8601 format) |
granularity | string | Data granularity: day, week, month |
Response:
{
"period": {
"start_date": "2024-01-01T00:00:00Z",
"end_date": "2024-01-31T23:59:59Z"
},
"metrics": {
"total_conversations": 1250,
"total_messages": 3750,
"average_response_time": 1.2,
"user_satisfaction": 4.5,
"top_questions": [
{
"question": "How do I reset my password?",
"count": 45
}
]
}
}SDKs
We provide official SDKs for popular programming languages:
JavaScript/Node.js
npm install @rocketflow/sdkimport { RocketFlowClient } from '@rocketflow/sdk';
const client = new RocketFlowClient('YOUR_API_KEY');
const response = await client.chat.sendMessage({
message: 'Hello!',
chatbotId: 'chatbot_123',
sessionId: 'session_456'
});
console.log(response.response);Python
pip install rocketflow-sdkfrom rocketflow import RocketFlowClient
client = RocketFlowClient('YOUR_API_KEY')
response = client.chat.send_message(
message='Hello!',
chatbot_id='chatbot_123',
session_id='session_456'
)
print(response.response)PHP
composer require rocketflow/sdkuse RocketFlow\RocketFlowClient;
$client = new RocketFlowClient('YOUR_API_KEY');
$response = $client->chat->sendMessage([
'message' => 'Hello!',
'chatbot_id' => 'chatbot_123',
'session_id' => 'session_456'
]);
echo $response->response;Webhooks
RocketFlow can send webhooks to notify your application of events.
Supported Events
message.received- New message receivedmessage.sent- Response sent to userconversation.started- New conversation startedconversation.ended- Conversation ended
Webhook Configuration
POST /webhooksRequest Body:
{
"url": "https://your-app.com/webhooks/rocketflow",
"events": ["message.received", "conversation.started"],
"secret": "your-webhook-secret"
}Webhook Payload
{
"event": "message.received",
"data": {
"message_id": "msg_123",
"chatbot_id": "chatbot_123",
"session_id": "session_456",
"user_id": "user_789",
"content": "Hello, I need help with my order",
"timestamp": "2024-01-15T10:30:00Z"
},
"timestamp": "2024-01-15T10:30:00Z"
}Testing
Use our sandbox environment for testing:
https://api-sandbox.getrocketflow.io/v1The sandbox environment has the same API structure but uses test data and doesn't count against your rate limits.
Support
Last updated on