API Documentation

Complete guide to integrating with our platform

Need Help?

Our team is here to assist you with integration

Schedule a Call

Getting Started

Welcome to the NiceBot.chat API documentation. Our API allows you to integrate AI-powered customer support into your applications, manage training data, and access conversation insights.

Base URL

https://your-domain.com/api

Quick Setup Steps:

  1. Create an API key in your dashboard (Settings β†’ Developer β†’ API Keys)
  2. Include the API key in your request headers
  3. Make your first API call
  4. Monitor requests in the Request Logs tab

Authentication

All API requests must include your API key in the Authorization header:

Authorization: Bearer YOUR_API_KEY

Security Best Practices

  • β€’ Never expose API keys in client-side code
  • β€’ Rotate keys regularly
  • β€’ Use environment variables to store keys
  • β€’ Revoke unused or compromised keys immediately

API Endpoints

Chat API

POST
/api/chat

Send a message to the AI chatbot and receive a response. Maintains conversation context via chatRoomId.

Request Body:

FieldTypeRequiredDescription
messagestringRequiredThe user's message/question
chatRoomIdstringOptionalSession ID to maintain conversation context. If not provided, a new session is created.
referenceIdstringOptionalReference ID for context (e.g., order number, ticket ID)
curl -X POST https://your-domain.com/api/chat \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "message": "What are your business hours?",
    "chatRoomId": "optional-room-id",
    "referenceId": "optional-reference"
  }'

Response Fields:

FieldTypeDescription
successbooleanWhether the request was successful
messagestringAI chatbot's response message
conversationIdstringConversation/chat room ID (use for follow-up messages)
referenceIdstring | nullReference ID if provided or extracted by AI
specialActionobject | undefinedSpecial action if AI needs additional info (form to show)

Success Response Example:

{
  "success": true,
  "message": "We're open Monday-Friday, 9 AM - 5 PM EST",
  "conversationId": "550e8400-e29b-41d4-a716-446655440000",
  "referenceId": null,
  "specialAction": null
}

Upload Document

POST
/api/documents/upload

Upload training documents to enhance your chatbot's knowledge base.

Form Data:

FieldTypeRequiredDescription
fileFileRequiredDocument file (PDF, DOCX, DOC, XLSX, XLS, CSV, RTF, TXT, MD)
domainIdstringRequiredYour domain ID from settings
documentTypeenumOptionalDocument type for better search (e.g., PRODUCT_CATALOG, USER_MANUAL, FAQ). Defaults to OTHER.

File Limits: Max 10MB per file. Document count limited by your plan.

curl -X POST https://your-domain.com/api/documents/upload \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "file=@document.pdf" \
  -F "domainId=YOUR_DOMAIN_ID" \
  -F "documentType=USER_MANUAL"

Document Types: Specify a type to improve search accuracy and help the chatbot find relevant information faster.

πŸ“¦ Product & Catalog:

PRODUCT_CATALOGPRODUCT_PRICINGPRODUCT_AVAILABILITYPRODUCT_COMPARISON

πŸ“‹ Policies & Legal:

RETURN_POLICYSHIPPING_POLICYPRIVACY_POLICYTERMS_OF_SERVICEWARRANTY_POLICY

πŸ› οΈ Support & Help:

USER_MANUALTROUBLESHOOTINGFAQSETUP_GUIDE

🏒 Company Info:

COMPANY_INFOBUSINESS_HOURSTEAM_INFO

πŸ“¦ Orders & Transactions:

ORDER_STATUSORDER_CONFIRMATIONSHIPPING_UPDATEDELIVERY_NOTIFICATION

πŸ’³ Payments & Billing:

PAYMENT_STATUSINVOICEREFUND_STATUSSUBSCRIPTION_UPDATE

πŸ‘€ Account & Profile:

ACCOUNT_UPDATEPASSWORD_RESETPREFERENCES_UPDATEVERIFICATION

🎫 Support & Tickets:

SUPPORT_TICKETTICKET_UPDATERESOLUTION

πŸ”” Notifications & Alerts:

PROMOTIONANNOUNCEMENTREMINDERSYSTEM_ALERTSECURITY_ALERT

⭐ Reviews & Feedback:

PRODUCT_REVIEWCUSTOMER_FEEDBACKTESTIMONIAL

πŸ“Š Inventory & Stock:

STOCK_ALERTRESTOCK_NOTIFICATIONINVENTORY_UPDATE

πŸ“’ Marketing & Content:

BLOG_POSTNEWSLETTERPRESS_RELEASE

πŸ”§ Technical:

API_DOCUMENTATIONCHANGELOGTECHNICAL_SPECS

βž• Fallback:

OTHER

πŸ’‘ Tip: Choosing the right type helps the chatbot filter searches and provide more accurate, faster responses.

Success Response Example:

{
  "success": true,
  "message": "Document uploaded successfully",
  "documentId": "doc-uuid-here",
  "charCount": 15234
}

Delete Document

DELETE
/api/documents/:id

Delete a training document from your chatbot's knowledge base.

Path Parameters:

FieldTypeRequiredDescription
idstring (UUID)RequiredThe ID of the document to delete
curl -X DELETE https://your-domain.com/api/documents/550e8400-e29b-41d4-a716-446655440000 \
  -H "Authorization: Bearer YOUR_API_KEY"

Success Response Example:

{
  "success": true,
  "message": "Document deleted successfully"
}

Upload Event

POST
/api/events

Upload event data to train your chatbot on dynamic, real-time information (e.g., orders, tickets, user actions).

Request Body:

FieldTypeRequiredDescription
domainIdstring (UUID)RequiredYour domain ID from settings
eventTypestringRequiredEvent category (e.g., "purchase", "ticket", "order")
contentstringRequiredEvent details in free-form text (max 500 chars per event)
privacyTypestringRequiredEither "PUBLIC" or "PRIVATE". Private events require referenceId for access.
referenceIdstringOptionalUnique identifier (e.g., order ID, ticket number). Required for private events.

Event Limits: Subject to monthly event limits and hourly rate limits based on your plan. Private events require a referenceId.

curl -X POST https://your-domain.com/api/events \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "domainId": "YOUR_DOMAIN_ID",
    "eventType": "purchase",
    "content": "Customer John Doe purchased premium plan for $99. Order ID: ORD-12345",
    "privacyType": "PRIVATE",
    "referenceId": "ORD-12345"
  }'

Success Response Example:

{
  "success": true,
  "message": "Event uploaded successfully",
  "eventId": "evt-uuid-here"
}

Code Examples

JavaScript / Node.js

const response = await fetch('https://your-domain.com/api/chat', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    message: 'What are your business hours?'
  })
});

const data = await response.json();
console.log(data.message);

Python

import requests

response = requests.post(
    'https://your-domain.com/api/chat',
    headers={
        'Authorization': 'Bearer YOUR_API_KEY',
        'Content-Type': 'application/json'
    },
    json={
        'message': 'What are your business hours?'
    }
)

data = response.json()
print(data['message'])

Error Handling

The API uses standard HTTP status codes. All error responses include a JSON body with details:

Status CodeMeaningCommon Causes
200SuccessRequest completed successfully
400Bad RequestMissing required fields, invalid JSON, or malformed data
401UnauthorizedMissing, invalid, or revoked API key
403ForbiddenAPI key valid but lacks permission for resource
404Not FoundResource (document, event) does not exist
413Payload Too LargeFile exceeds 10MB limit
429Too Many RequestsRate limit exceeded (hourly or per-minute)
500Server ErrorInternal server error - contact support if persists

Error Response Structure:

{
  "success": false,
  "message": "Invalid API key",
  "error": "AUTHENTICATION_FAILED",
  "code": "AUTH_ERROR"
}

Tip: Always check the success field in responses. When false, the message field contains a human-readable error description.

Rate Limits

Rate limits vary by plan. All plans have monthly LLM call limits (chatbot responses), monthly event ingestion limits, and general API rate limits:

Monthly LLM Call Limits (Chatbot Responses)

Starter

100

calls / month

Professional

5,248

calls / month

Premium

11,500

calls / month

Business

15,700

calls / month

Enterprise

Unlimited

Custom limits

Monthly Event Ingestion Limits

Starter

0

events / month

Professional

10,000

events / month

Premium

50,000

events / month

Business

100,000

events / month

Enterprise

Unlimited

Custom limits

General API Rate Limits (Developer Endpoints)

Rate limits for document uploads, event submissions, and other API operations:

Starter

60

requests / hour

10/min burst

Professional

1,000

requests / hour

60/min burst

Premium

2,500

requests / hour

100/min burst

Business

5,000

requests / hour

200/min burst

Enterprise

Unlimited

Custom limits

No burst limit

Note: Monthly LLM call limits refer to chatbot responses powered by the language model. Event ingestion limits are measured monthly and have additional hourly rate limits for burst protection. General API rate limits apply to developer endpoints (document uploads, event submissions, etc.) and are separate from LLM call limits. Contact us for custom Enterprise limits.

Ready to Get Started?

Create your API key in the dashboard and start building today.