---
title: "Account events"
url: https://docs.truemarkets.co/gateway/events
description: "Stream your users' order, transfer and ramp events as they happen, over Server-Sent Events."
---

Docs index: https://docs.truemarkets.co/llms.txt

# Account events

`GET /v1/events` streams account events as they happen: every order, transfer and ramp change, as
Server-Sent Events. Each event carries the resource in the same shape its REST endpoint returns,
so you can apply it without a refetch.

## What you receive

With your organization token, the stream carries the events of every user your organization
serves. With a user's own token, it carries only that user's events. Don't send
`TM-On-Behalf-Of`: the stream belongs to the token, and the header is refused with `400`.

Each event has an `id`, an `event` type such as `order.filled` or `transfer.completed`, and a
`data` line holding the envelope: `id`, `type`, `created_at`, `user_id` and `data`, the resource
itself. A `: heartbeat` comment arrives every 15 seconds.

**curl**

```bash
curl -N -H "Authorization: Bearer $TOKEN" -H "Accept: text/event-stream" \
  https://api.truemarkets.co/v1/events
```

**Response** 200 (one order event, then a heartbeat)

```text
retry: 3127

id: 1042
event: order.filled
data: {"id":"7c1e0c4a-2c4b-4f5e-9a2f-0f3c0b1d2e3f","type":"order.filled","created_at":"2026-11-23T12:00:00.000Z","user_id":"9c1e7a52-4d3b-4f8e-a6b7-1c2d3e4f5a6b","data":{"order_id":"…","status":"complete"}}

: heartbeat
```

## Resume after a disconnect

Keep the last `id` you received. Reconnect with `Last-Event-ID` set to it, and the stream
continues right after it, with no gap and no duplicate. Wait the `retry` delay before you
reconnect, and reconnect whenever the stream ends, not only on errors.

A heartbeat carries an `id` too when the stream has moved past your last event, so your last
`id` stays current even when you get no events of your own. The stream keeps the last five
minutes of events, and a current `id` always resumes within that window.

## When the stream sends `reset`

Sometimes the stream can't continue from your `id`. It then sends an `event: reset` frame:

| `reason`         | What happened                                                                                                                    |
| ---------------- | -------------------------------------------------------------------------------------------------------------------------------- |
| `resume_too_old` | Your `id` is older than the five minutes kept, or the stream was rebuilt. A rebuild during the stream closes it after the reset. |
| `resume_invalid` | Your `id` is not one this stream issued.                                                                                         |
| `slow_client`    | You fell more than 1,024 events behind. The stream closes after the reset.                                                       |

For every reason, refetch the REST lists you keep in sync, such as orders and transfers, since
events may have been missed. Then keep reading, or reconnect if the stream closed: the reset
carries its own `id`, so your next reconnect resumes from there.

## When the stream closes

The server closes each stream normally after 30 to 35 minutes, or when your token expires,
whichever comes first, and when it restarts. Reconnect with your last `id`; nothing is lost.

While the service is starting up, or can't read the stream's position to resume your `id`,
`GET /v1/events` answers `503` with a `Retry-After` header. Too many open streams from one
network answer `429`. On any non-200 response or network error, back off (honour `Retry-After`
when present) and reconnect with your last `id`. A browser `EventSource` stops for good after a
non-200 response, so create a new one.