API Documentation

Pro & Enterprise Only

Integrate JelyTech chatbot capabilities into your applications programmatically

📢 API Access Requirements

API access is available exclusively for Pro and Enterprise plan customers. To get started with the API, upgrade your plan and generate your API key from the dashboard.

View Pricing Plans

Getting Started

1. Generate Your API Key

  1. Log in to your JelyTech dashboard
  2. Navigate to Settings → API Keys
  3. Click "Generate New API Key"
  4. Copy and securely store your API key

⚠️ Important: Keep your API key secure. Never expose it in client-side code or public repositories.

2. Base URL

All API requests should be made to:

https://api.jelytech.com/v1

3. Authentication

Include your API key in the request headers:

Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

API Endpoints

POST/chat/send

Send a message to your chatbot and receive a response.

Request Body:

{
  "botId": "your-bot-id",
  "message": "What are your business hours?",
  "conversationId": "optional-conversation-id",
  "userId": "optional-user-id",
  "metadata": {
    "source": "website",
    "userAgent": "Mozilla/5.0..."
  }
}

Response:

{
  "success": true,
  "response": "We're open Monday through Friday, 9 AM to 5 PM EST.",
  "conversationId": "conv_123456",
  "messageId": "msg_789012",
  "timestamp": "2025-01-10T14:30:00Z"
}

Example Request:

curl -X POST https://api.jelytech.com/v1/chat/send \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "botId": "bot_abc123",
    "message": "What are your business hours?"
  }'
GET/chat/history/:conversationId

Retrieve the full conversation history for a specific conversation.

URL Parameters:

  • conversationId - The unique conversation identifier

Response:

{
  "success": true,
  "conversationId": "conv_123456",
  "messages": [
    {
      "id": "msg_001",
      "role": "user",
      "content": "What are your business hours?",
      "timestamp": "2025-01-10T14:30:00Z"
    },
    {
      "id": "msg_002",
      "role": "assistant",
      "content": "We're open Monday through Friday...",
      "timestamp": "2025-01-10T14:30:05Z"
    }
  ]
}
POST/bots

Create a new chatbot programmatically.

Request Body:

{
  "name": "Customer Support Bot",
  "description": "Handles customer inquiries",
  "configuration": {
    "greeting": "Hello! How can I help you today?",
    "theme": {
      "primaryColor": "#007bff",
      "position": "bottom-right"
    }
  }
}

Response:

{
  "success": true,
  "bot": {
    "id": "bot_xyz789",
    "name": "Customer Support Bot",
    "status": "active",
    "createdAt": "2025-01-10T14:30:00Z"
  }
}
POST/bots/:botId/train

Upload training documents to your chatbot.

Request (multipart/form-data):

Content-Type: multipart/form-data

file: [document.pdf]
metadata: {
  "title": "Product Documentation",
  "category": "support"
}

Example:

curl -X POST https://api.jelytech.com/v1/bots/bot_abc123/train \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "file=@document.pdf" \
  -F 'metadata={"title":"Product Documentation"}'
GET/bots/:botId/analytics

Retrieve analytics data for your chatbot.

Query Parameters:

  • startDate - Start date (ISO 8601 format)
  • endDate - End date (ISO 8601 format)
  • metrics - Comma-separated list of metrics (messages, users, satisfaction)

Response:

{
  "success": true,
  "analytics": {
    "totalMessages": 1250,
    "uniqueUsers": 423,
    "averageSatisfaction": 4.5,
    "responseTime": "1.2s",
    "topQuestions": [
      "What are your business hours?",
      "How do I reset my password?"
    ]
  }
}

Error Handling

All API responses include a success field. When an error occurs:

{
  "success": false,
  "error": {
    "code": "INVALID_API_KEY",
    "message": "The provided API key is invalid or expired",
    "statusCode": 401
  }
}

Common Error Codes

CodeStatusDescription
INVALID_API_KEY401API key is invalid or expired
RATE_LIMIT_EXCEEDED429Too many requests in a short period
BOT_NOT_FOUND404The specified bot ID does not exist
QUOTA_EXCEEDED403Monthly message quota exceeded
INVALID_REQUEST400Request body is malformed or missing required fields

Rate Limits

API rate limits vary by plan:

  • Pro Plan: 1,000 requests per hour
  • Enterprise Plan: Custom limits based on your needs

Rate limit information is included in response headers:

X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 950
X-RateLimit-Reset: 1641820800

Webhooks

Configure webhooks to receive real-time notifications about chatbot events.

Available Events

  • message.received - New message from user
  • message.sent - Bot response sent
  • conversation.started - New conversation initiated
  • conversation.ended - Conversation closed
  • quota.warning - Approaching message quota

Webhook Payload Example

{
  "event": "message.received",
  "timestamp": "2025-01-10T14:30:00Z",
  "data": {
    "botId": "bot_abc123",
    "conversationId": "conv_123456",
    "message": {
      "id": "msg_789012",
      "content": "What are your business hours?",
      "userId": "user_456789"
    }
  }
}

SDKs & Libraries

Official SDKs are available for popular programming languages:

Node.js / JavaScript

npm install @jelytech/node-sdk

Python

pip install jelytech

PHP

composer require jelytech/php-sdk

Ruby

gem install jelytech

Quick Start Example (Node.js)

const JelyTech = require('@jelytech/node-sdk');

const client = new JelyTech({
  apiKey: 'YOUR_API_KEY'
});

async function sendMessage() {
  const response = await client.chat.send({
    botId: 'bot_abc123',
    message: 'What are your business hours?'
  });
  
  console.log(response.data.response);
}

sendMessage();

Best Practices

  • Security: Never expose your API key in client-side code. Use server-side requests only.
  • Error Handling: Always check the success field and handle errors gracefully.
  • Rate Limiting: Implement exponential backoff when rate limits are reached.
  • Caching: Cache responses when appropriate to reduce API calls.
  • Monitoring: Track API usage and errors to identify issues early.
  • Versioning: Always specify the API version in your requests.

Need Help?

Our support team is here to help you with API integration.