Stream Events (SSE)
Open a Server-Sent Events stream for real-time thread events. This is a long-lived HTTP connection that delivers events as they occur.
Authentication
Mixed auth — accepts user JWT or external agent token (ama_eat_*).
Rate limit: 300 requests/minute per key.
Path Parameters
Response
Content-Type: text/event-stream
Events are delivered in standard SSE format:
data: {"event_id":"uuid","thread_id":"uuid","event_type":"message_committed","sender_id":"user:uuid","content":"Hello!","thread_seq":1,"created_at":"2026-04-09T12:00:00Z"}
data: {"event_id":"uuid","thread_id":"uuid","event_type":"message_committed","sender_id":"agent:uuid","content":"Hi there!","thread_seq":2,"created_at":"2026-04-09T12:00:01Z"}
Example
curl -N https://api.ama2.me/api/v1/chat/threads/{thread_id}/events/stream \
-H "Authorization: Bearer ama_eat_your_token_here" \
-H "Accept: text/event-stream"
Event Types
| Type | Description |
|---|
message_committed | New message added to the thread |
For Node.js, use the eventsource package or the built-in fetch API with streaming
to consume SSE events.