Skip to main content
The ContextGPT API allows you to programmatically manage chatbots, send messages, access conversation history, and configure settings. All endpoints use REST principles and return JSON responses.
This page documents the legacy /api/v1 API. For new integrations, use API Reference → v2 from the version selector.

Base URL

All API requests are made to:
https://ContextGPT.in/api/v1

Authentication

ContextGPT uses API keys for authentication. Include your API key in the Authorization header of every request.

Getting your API key

  1. Sign in to your ContextGPT account
  2. Navigate to Billing or Profile > API Access
  3. Copy your API key
  4. Store it securely (never commit to version control)
Keep your API key secure. Anyone with your key can access and modify your chatbots.

Using your API key

Include your API key in the Authorization header with the Bearer scheme:
Authorization: Bearer YOUR_API_KEY

Example request

curl https://ContextGPT.in/api/v1/chatbots \
  -H "Authorization: Bearer YOUR_API_KEY"

Authentication errors

{
  "success": false,
  "message": "Authorization header does not contain a valid API key"
}

Response format

All API responses use a consistent JSON structure:
{
  "statusCode": 200,
  "success": true,
  "message": "Operation completed successfully",
  "data": {
    // Response data here
  }
}

Error handling

  • 200 OK - Request succeeded
  • 400 Bad Request - Invalid request parameters or body
  • 401 Unauthorized - Missing or invalid API key
  • 403 Forbidden - Insufficient permissions
  • 404 Not Found - Resource doesn’t exist
  • 405 Method Not Allowed - HTTP method not supported
  • 500 Internal Server Error - Server error
  • API_KEY_NOT_VALID - Invalid or missing API key
  • REQUEST_VALIDATION_FAILED - Request body validation failed
  • CHATBOT_NOT_FOUND - Chatbot doesn’t exist
  • CHATBOT_FETCH_FORBIDDEN - No permission to access chatbot
  • CHATBOT_LIMIT_REACHED - Exceeded chatbot quota
  • MESSAGES_LIMIT_REACHED - Exceeded message quota

Validation errors

When request validation fails, the errors array contains specific field errors:
{
  "success": false,
  "message": "Request body is not valid",
  "errors": [
    {
      "path": ["chatbotName"],
      "message": "Required"
    }
  ]
}

Rate limiting

API requests are rate-limited at multiple levels to ensure platform stability and fair usage.

Generic API limits

All requests are subject to these limits regardless of plan (to make platform accessible to all users):
LimitValueScope
Per IP100 req/secApplied globally before authentication —
Per user500 req/60sApplied after authentication on all endpoints
Concurrency10 simultaneousUpload/ingestion endpoints only

AI & messaging limits

Requests that trigger AI responses have additional per-plan limits:
PlanMessages/minAI replies/min
Starter600150
Growth3,000750
Scale12,0003,000
Monthly message quotas are also enforced per plan. When the monthly quota is exhausted, further requests return 429 with MESSAGES_LIMIT_REACHED.

Rate limit response

When you exceed any rate limit, you’ll receive a 429 Too Many Requests response with a Retry-After header:
{
  "success": false,
  "message": "Rate limit exceeded. Too many requests — please wait before trying again.",
  "retryAfter": 45,
  "limit": 500,
  "remaining": 0,
  "windowSeconds": 60
}

Pagination

List endpoints support pagination using query parameters:
GET /v1/chatbots?page=1&limit=20
Parameters:
  • page - Page number (default: 1)
  • limit - Results per page (default: 20, max: 100)
Paginated responses include metadata:
{
  "success": true,
  "message": "Fetched chatbots successfully",
  "data": {
    "chatbots": [...],
    "pagination": {
      "page": 1,
      "limit": 20,
      "total": 45,
      "pages": 3
    }
  }
}

Making requests

curl -X POST https://ContextGPT.in/api/v1/chatbots \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "chatbotName": "My New Chatbot"
  }'

Common workflows

1

Create chatbot

POST /v1/chatbots/account/{accountId}/create-chatbot
2

Update appearance

PUT /v1/chatbots/chatbot/{chatbotId}/appearance
3

Add conversation starters

POST /v1/chatbots/chatbot/{chatbotId}/conversation-starters
4

Configure settings

PUT /v1/chatbots/chatbot/{chatbotId}/settings
5

Add instructions or persona

POST /v1/chatbots/chatbot/{chatbotId}/instructions
1

Create thread

POST /v1/chatting/{chatbotId}/threads
2

Send message

POST /v1/chatting/{chatbotId}/thread/{threadId}/message
3

Fetch response

Included in send message response
4

Update reaction

PATCH /v1/chatting/{chatbotId}/message/{messageId}
1

Fetch all threads

GET /v1/chatting/{chatbotId}/threads
2

Get thread details

GET /v1/chatting/{chatbotId}/thread/{threadId}
3

Get thread messages

GET /v1/chatting/{chatbotId}/thread/{threadId}/messages
4

Escalate to agent

POST /v1/chatting/{chatbotId}/thread/{threadId}/escalate
5

Update thread

PATCH /v1/chatting/{chatbotId}/thread/update-thread

API resources

The ContextGPT API provides endpoints for:
  • Chatbots - Create, read, update, delete chatbots
  • Appearance - Customize chatbot visual design
  • Conversation Starters - Manage conversation starter prompts
  • Follow-up Prompts - Post-response suggestions
  • Instructions - Manage chatbot instruction sets
  • Personas - Manage chatbot personas
  • Localization - Configure locale-specific settings
  • Lead Settings - Configure lead capture behavior
  • Human Support Settings - Configure escalation and handoff
  • Settings - Configure general chatbot behavior
  • Messages - Send and receive messages
  • Threads - Manage conversation threads
  • Text Snippets - Manage reusable text content

Best practices

Never expose API keys - Keep them server-side only
Use environment variables - Don’t hardcode keys
Rotate keys regularly - Generate new keys periodically
Limit key scope - Use separate keys for different environments

Webhooks

Instead of polling the API, use webhooks to receive real-time updates:
  • New messages
  • Lead captures
  • Conversation escalations
  • Custom events
Configure webhooks in your chatbot settings or via the API. See Chatbot Settings - Advanced for webhook configuration.

SDKs and libraries

Official SDKs

Currently, ContextGPT doesn’t provide official SDKs. Use standard HTTP libraries in your language of choice.

Community libraries

Check our community forum for user-contributed libraries and wrappers.

Support

Need help with the API?
  • Documentation - Browse the API reference
  • Email - support@ContextGPT.in
  • Community - Join our Slack or forum
  • Enterprise - Dedicated support for enterprise customers

Next steps

Chatbot endpoints

Create and manage chatbots programmatically

Messages

Send messages and handle conversations

Settings

Configure chatbot behavior via API

Threads

Manage conversation threads