API Documentation

Integrate Cyberbuddies AI into your applications

Get API Keys

Authentication

All API requests require authentication using an API key. Include your API key in the Authorization header:

Authorization: Bearer YOUR_API_KEY

You can generate and manage your API keys in the API Keys section.

Rate Limits

Free Plan: 100 requests per hour
Pro Plan: 1,000 requests per hour
Enterprise Plan: Unlimited requests

Chat API

Start Chat Session

POST
/api/chat/start

Start a new chat session with the AI.

Request Body:

Parameter Type Required Description
message string Yes The message to send to the AI
user_id string No Optional user identifier
session_id string No Optional session identifier to continue existing conversation
{
  "message": "Hello, I need help with my order",
  "user_id": "user123",
  "session_id": "optional_session_id"
}

Response:

{
  "session_id": "chat_session_123",
  "message_id": "msg_456",
  "response": "Hello! I'd be happy to help you with your order...",
  "timestamp": "2025-01-08T17:00:00Z",
  "status": "success"
}

Send Message

POST
/api/chat/{session_id}/message

Send a message to an existing chat session.

Request Body:

{
  "message": "What's the status of my order?"
}

Response:

{
  "message_id": "msg_789",
  "response": "I can help you check your order status...",
  "timestamp": "2025-01-08T17:01:00Z"
}

Get Conversation

GET
/api/chat/{session_id}

Retrieve the full conversation history.

Response:

{
  "session_id": "chat_session_123",
  "messages": [
    {
      "id": "msg_456",
      "type": "user",
      "content": "Hello, I need help",
      "timestamp": "2025-01-08T17:00:00Z"
    },
    {
      "id": "msg_457",
      "type": "bot",
      "content": "Hello! How can I help you?",
      "timestamp": "2025-01-08T17:00:05Z"
    }
  ]
}

Integrations API

List Integrations

GET
/api/integrations

Get a list of all connected integrations.

Response:

{
  "integrations": [
    {
      "id": 1,
      "platform": "slack",
      "status": "connected",
      "created_at": "2025-01-08T17:00:00Z"
    },
    {
      "id": 2,
      "platform": "wordpress",
      "status": "connected",
      "created_at": "2025-01-08T16:30:00Z"
    }
  ]
}

Trigger Integration

POST
/api/integrations/{integration_id}/trigger

Manually trigger an integration action.

Request Body:

{
  "action": "sync_data",
  "parameters": {
    "date_range": "last_7_days"
  }
}

Analytics API

Get Analytics

GET
/api/analytics

Get analytics data for your account.

Query Parameters:

  • date_range: last_7_days, last_30_days, last_3_months
  • metrics: conversations, users, resolution_rate, response_time

Response:

{
  "date_range": "last_7_days",
  "metrics": {
    "total_conversations": 2847,
    "active_users": 1234,
    "resolution_rate": 89.2,
    "avg_response_time": 2.3
  },
  "daily_data": [
    {
      "date": "2025-01-08",
      "conversations": 412,
      "users": 189
    }
  ]
}

Webhooks

Configure webhooks to receive real-time notifications about events in your Cyberbuddies AI account.

Supported Events:

  • chat.started - New chat session started
  • chat.ended - Chat session ended
  • integration.connected - New integration connected
  • integration.error - Integration error occurred

Webhook Payload:

{
  "event": "chat.started",
  "timestamp": "2025-01-08T17:00:00Z",
  "data": {
    "session_id": "chat_session_123",
    "user_id": "user456"
  },
  "signature": "sha256=webhook_signature"
}

Error Handling

The API returns standard HTTP status codes and error responses in the following format:

{
  "error": {
    "code": "INVALID_API_KEY",
    "message": "The provided API key is invalid",
    "details": "Please check your API key and try again"
  }
}

Common Error Codes:

  • 400 - Bad Request: Invalid request parameters
  • 401 - Unauthorized: Invalid or missing API key
  • 403 - Forbidden: Insufficient permissions
  • 404 - Not Found: Resource does not exist
  • 429 - Too Many Requests: Rate limit exceeded
  • 500 - Internal Server Error: Server error occurred