Skip to content

Online Chat

The /chat endpoint provides a real-time messaging system with support for public and private channels. Messages are stored for 1 hour.

Parameters

ParameterRequiredDescription
usernameYesThe username of the user who sends the message
messageYesThe message to send
sessionYesThe session ID of the user
tokenNoThe 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

FieldTypeDescription
messagestringConfirmation message

Error Responses

ErrorDescription
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 mismatchSession does not match the user

Try It

Error Handling

If parameters are missing or invalid, the API will return an error:

Error MessageDescription
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