Skip to main content

Chat

GET /chat

Get chat messages

Retrieves chat messages from the Foundry world with optional pagination and filtering.

Parameters

NameTypeRequiredSourceDescription
clientIdstringqueryClient ID for the Foundry world
limitnumberqueryMaximum number of messages to return (default: 10)
offsetnumberqueryNumber of messages to skip for pagination
userIdstringquery, bodyFoundry user ID or username to scope permissions (omit for GM-level access)
chatTypenumberqueryFoundry chat message type (0=OOC, 1=IC, 2=Emote, 3=Whisper, 4=Roll). Named chatType to avoid collision with WS message type field.
speakerstringqueryFilter messages by speaker name or actor ID

Returns

object - Paginated list of chat messages

Try It Out


POST /chat

Send a chat message

Creates a new chat message in the Foundry world.

Parameters

NameTypeRequiredSourceDescription
contentstringbodyThe message content (supports HTML)
clientIdstringqueryClient ID for the Foundry world
whisperarraybodyArray of user IDs to whisper the message to
speakerstringbodyActor ID to use as the message speaker
aliasstringbodyDisplay name alias for the speaker
chatTypenumberbodyFoundry chat message type (0=OOC, 1=IC, 2=Emote, 3=Whisper, 4=Roll). Named chatType to avoid collision with WS message type field.
flavorstringbodyFlavor text displayed above the message content
userIdstringquery, bodyFoundry user ID or username to scope permissions (omit for GM-level access)

Returns

object - The created chat message

Try It Out


DELETE /chat/:messageId

Delete a specific chat message

Deletes a chat message by its ID. Only the message author or a GM can delete messages.

Parameters

NameTypeRequiredSourceDescription
messageIdstringparamsID of the chat message to delete
clientIdstringqueryClient ID for the Foundry world
userIdstringquery, bodyFoundry user ID or username to scope permissions (omit for GM-level access)

Returns

object - Success confirmation

Try It Out


DELETE /chat

Clear all chat messages

Flushes all chat message history. Only GMs can perform this action.

Parameters

NameTypeRequiredSourceDescription
clientIdstringqueryClient ID for the Foundry world
userIdstringquery, bodyFoundry user ID or username to scope permissions (omit for GM-level access)

Returns

object - Success confirmation

Try It Out


GET /chat/subscribe

Subscribe to real-time chat events via Server-Sent Events (SSE)

Opens a persistent SSE connection that streams chat events (create, update, delete) as they occur in the Foundry world.

Parameters

NameTypeRequiredSourceDescription
clientIdstringqueryClient ID for the Foundry world
speakerstringqueryFilter events by speaker name or actor ID
typenumberqueryFilter events by chat message type (0=OOC, 1=IC, 2=Emote, 3=Whisper, 4=Roll)
whisperOnlybooleanqueryOnly receive whispered messages
userIdstringqueryFoundry user ID or username to scope permissions (omit for GM-level access)

Returns

SSE stream - SSE event stream

Try It Out