Skip to content
moxon home

Online Chat

The /chat endpoint allows retrieving and sending messages in a global or private chat.

Get Messages

gethttps://api.moxon.dev/v2/chat

The /chat endpoint retrieves all messages sent during the last hour. This endpoint does not require any options.

Request Example

Request
GET /v2/chat

Response

Response
[
    {
        "username": "User1",
        "message": "Hi!",
        "timestamp": "2025-01-21T08:27:11.068Z"
    },
    {
        "username": "User3",
        "message": "How are you?",
        "timestamp": "2025-01-21T08:28:43.070Z"
    },
    {
        "username": "User8",
        "message": "Yeah great, and you?",
        "timestamp": "2025-01-21T08:32:07.215Z"
    }
]

cURL

cURL
curl -X GET "https://api.moxon.dev/v2/chat"

Send Message

posthttps://api.moxon.dev/v2/chat

The /chat endpoint allows sending a message to the global chat or a private chat.

Parameters

  • usernamestringrequired

    The username of the user who sends the message

  • messagestringrequired

    The message to send

  • sessionstringrequired

    The session ID of the user

  • tokenstringoptional

    The key used to connect to a private chat. If not provided, the message will be sent to the global chat

Request Example

Request
curl -X POST -d "username=User3&message=How are you?&session=abc123&token=41a43360-9874-4c7a-9ca8-eec29e765a0e" "https://api.moxon.dev/v2/chat"

Response

Response
{
    "message": "Message sent successfully"
}

Error Handling

If the value of username, message or session is empty, an error will be returned.