Private Chat
The /chat/private endpoint retrieves all messages sent during the last hour, belonging to a private chat.
POST/v4/chat/private
Parameters
| Parameter | Required | Description |
|---|---|---|
username | Yes | The username of the user who sends the message |
token | Yes | The key used to connect to the desired private chat |
Code Examples
curl -X POST \
-H "Content-Type: application/json" \
-d '{
"username": "User3",
"token": "41a43360-9874-4c7a-9ca8-eec29e765a0e"
}' \
"https://api.sylvain.sh/v4/chat/private"Response Fields
| Field | Type | Description |
|---|---|---|
username | string | Username of the message sender |
message | string | Content of the message |
timestamp | string | ISO 8601 timestamp of the message |
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 valid token (&token={key}). | The token parameter is missing or invalid |
Invalid or expired token | The token is invalid or has expired |
Rate limit exceeded | Too many requests in a short period |
Related Endpoints
- POST /v4/chat - Send a message
- GET /v4/chat - Retrieve all recent messages
- DELETE /v4/chat/:token - Clear all messages from a private chat