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.comResponse 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#
| Code | Description |
|---|---|
VALIDATION_ERROR | Invalid request parameters |
AUTHENTICATION_ERROR | Invalid or missing API key |
AUTHORIZATION_ERROR | Insufficient permissions |
NOT_FOUND | Resource not found |
RATE_LIMIT_EXCEEDED | Rate limit exceeded |
INTERNAL_ERROR | Server internal error |
SDKs and Libraries#
**Coming Soon**: Official SDKs for popular languages
Community Libraries#
- chatapi-js - JavaScript/TypeScript SDK
- chatapi-python - Python SDK
- chatapi-go - Go SDK
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#
- REST API Reference - Complete REST endpoint documentation
- WebSocket API Reference - Real-time API documentation
- API Examples - Code samples and use cases