Messages and reactions API
6 endpoints. See Send a message via the API for the prose-driven version.
Messages#
| Method | Path | Purpose |
|---|---|---|
GET |
/v1/rooms/{room_id}/messages |
List messages with pagination by stream_position. |
POST |
/v1/rooms/{room_id}/send |
Create a new event. |
POST |
/v1/rooms/{room_id}/events/{event_id}/edit |
Edit an existing event (sender only, default 24h window). |
POST |
/v1/rooms/{room_id}/events/{event_id}/redact |
Redact (own, or power_level ≥ 50). |
GET /v1/rooms/{room_id}/messages#
Query params:
limit(default 50, max 200).from— stream position to start from.direction—back(older) orforward(newer); defaultback.
Response:
json
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | |
POST /v1/rooms/{room_id}/send#
Body fields:
content(object, required).event_uuid(string, optional; for idempotency).as_participant_id(string, optional; bot-send-on-behalf, requirespower_level ≥ 100).
See Send a message via the API for content shapes.
POST /v1/rooms/{room_id}/events/{event_id}/edit#
json
1 | |
Edits expire 24h after creation by default. The original content
is preserved in event.original_content.
POST /v1/rooms/{room_id}/events/{event_id}/redact#
json
1 | |
Body of the event is wiped; metadata + event id remain. Cannot be undone.
Reactions#
| Method | Path | Purpose |
|---|---|---|
POST |
/v1/rooms/{room_id}/events/{event_id}/reaction |
Add a reaction. |
DELETE |
/v1/rooms/{room_id}/events/{event_id}/reaction |
Remove your reaction. |
Body for POST:
json
1 | |
Each (event, sender, emoji) is a unique reaction — re-posting the
same emoji from the same sender is a no-op.
Errors#
SW_EVENT_NOT_FOUND— event id doesn't exist.SW_EVENT_TOO_OLD_TO_EDIT— edit past the window.SW_REDACT_FORBIDDEN— not yours and you lack power level.SW_RATE_LIMIT_EXCEEDED— over the tenant's send rate.SW_CONTENT_TOO_LARGE— content exceeds 64 KB.