API Reference#

ChatAPI provides both REST and WebS### SDKs and Libraries

Coming Soon: Official SDKs for popular languages APIs for building chat applications. All APIs require authentication via API keys and support multi-tenant operation.

Authentication#

All API requests require authentication headers:

X-API-Key: <your-tenant-api-key>
X-User-Id: <user-identifier>
  • X-API-Key: Identifies your tenant (organization)
  • X-User-Id: Identifies the user performing the action

API Overview#

ChatAPI provides both REST and WebSocket APIs for building chat applications. All APIs require authentication and return JSON responses.

REST API#

Traditional HTTP endpoints for chat operations:

  • Rooms: Create, list, and manage chat rooms
  • Messages: Send and retrieve messages
  • Delivery: Acknowledge message delivery
  • Notifications: Send notifications to users
  • Health: Service health monitoring

WebSocket API#

Real-time bidirectional communication:

  • Connection: Persistent WebSocket connections
  • Events: Real-time message delivery
  • Presence: User online/offline status
  • Typing: Typing indicators
  • ACKs: Message acknowledgments

Base URL#

https://your-chatapi-instance.com

Response Format#

All API responses use JSON format:

{
  "success": true,
  "data": { ... },
  "error": null
}

Error responses:

{
  "success": false,
  "data": null,
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Invalid request parameters"
  }
}

Rate Limiting#

ChatAPI implements per-tenant rate limiting:

  • Default: 100 requests per second per tenant
  • Headers: Rate limit status included in responses
  • 429 Status: Returned when limits exceeded

Error Codes#

CodeDescription
VALIDATION_ERRORInvalid request parameters
AUTHENTICATION_ERRORInvalid or missing API key
AUTHORIZATION_ERRORInsufficient permissions
NOT_FOUNDResource not found
RATE_LIMIT_EXCEEDEDRate limit exceeded
INTERNAL_ERRORServer internal error

SDKs and Libraries#

**Coming Soon**: Official SDKs for popular languages

Community Libraries#

API Versions#

ChatAPI uses semantic versioning for API changes:

  • v1 (current): Initial stable API
  • Breaking changes will introduce new major versions

Testing#

Use the built-in API playground or tools like:

  • curl: Command-line testing
  • Postman: GUI API testing
  • Insomnia: Alternative to Postman
  • Swagger UI: Interactive API documentation

Next Steps#