Online Chat
The /chat endpoint provides a real-time messaging system with support for public and private channels. Messages are stored for 1 hour.
POST/v5/chat
Parameters
| Parameter | Required | Description |
|---|---|---|
username | Yes | The username of the user who sends the message |
message | Yes | The message to send |
session | Yes | The session ID of the user |
token | No | The key used to connect to a private chat. If not provided, the message will be sent to the global chat |
Code Examples
curl -X POST \
-H "Content-Type: application/json" \
-d '{
"username": "User3",
"message": "How are you?",
"session": "abc123"
}' \
"https://api.sylvain.sh/v5/chat"Response Fields
| Field | Type | Description |
|---|---|---|
message | string | Confirmation message |
Error Responses
| Error | Description |
|---|---|
Global rate limit exceeded. | Global API rate limit reached |
You have exceeded the limit of X requests per hour. | Hourly IP/token limit reached |
Rate limit exceeded. Try again in X seconds. | Per-user short-window limit |
Session ID mismatch | Session does not match the user |
Try It
Error Handling
If parameters are missing or invalid, the API will return an error:
| Error Message | Description |
|---|---|
Please provide a username (?username={username}) | The username parameter is missing |
Please provide a message (&message={message}) | The message parameter is missing |
Please provide a valid session ID (&session={ID}) | The session parameter is missing or invalid |
Related Endpoints
- GET /v5/chat - Retrieve all recent messages
- POST /v5/chat/private - Create and manage private chat channels
- DELETE /v5/chat/:token - Clear all messages from a private chat