logoRocketFlow

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/v1

Authentication

RocketFlow uses API keys for authentication. Include your API key in the Authorization header:

Authorization: Bearer YOUR_API_KEY

Getting Your API Key

  1. Log into your RocketFlow Dashboard
  2. Go to Settings > API Keys
  3. Create a new API key
  4. 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: 1640995200

Error 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

CodeStatusDescription
INVALID_REQUEST400Request is malformed or missing required parameters
UNAUTHORIZED401Invalid or missing API key
FORBIDDEN403Insufficient permissions
NOT_FOUND404Resource not found
RATE_LIMITED429Rate limit exceeded
SERVER_ERROR500Internal server error

Endpoints

Chat

Send Message

Send a message to your chatbot and receive a response.

POST /chat

Request 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:

ParameterTypeDescription
limitintegerNumber of messages to return (default: 50)
offsetintegerNumber 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 /chatbots

Response:

{
  "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:

ParameterTypeDescription
start_datestringStart date (ISO 8601 format)
end_datestringEnd date (ISO 8601 format)
granularitystringData 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/sdk
import { 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-sdk
from 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/sdk
use 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 received
  • message.sent - Response sent to user
  • conversation.started - New conversation started
  • conversation.ended - Conversation ended

Webhook Configuration

POST /webhooks

Request 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/v1

The sandbox environment has the same API structure but uses test data and doesn't count against your rate limits.

Support

Last updated on