---
title: "Subscribe events"
method: GET
path: "/subscribe_events"
tags: ["Subscribe events"]
---

# Subscribe events

`GET /subscribe_events`

IMPORTANT NOTE: This is a WebSocket connection, so the `ws://` or `wss://` schema should be used to subscribe to this endpoint.

This endpoint streams on-chain events for all blocks starting at the requested start block, up until the latest available block. Once the latest block is reached, the stream will remain open, and responses will be sent for each new block as it becomes available.

## Query parameters

- `start_height` union
  - string, uint64
  - 'final' | 'sealed'
- `start_block_id` string, hexadecimal — A 32-byte unique identifier for an entity.
- `heartbeat_interval` string, uint64
- `event_types` EventType[]
- `addresses` string[]
- `contracts` string[]

## Response `200`

OK

- SubscribeEvents
  - `BlockId` string, hexadecimal — A 32-byte unique identifier for an entity.
  - `Height` string
  - `Events` Event[]
    - `type` string, required — The qualified event type.
    - `transaction_id` string, hexadecimal, required — A 32-byte unique identifier for an entity.
    - `transaction_index` string, uint64, required
    - `event_index` string, uint64, required
    - `payload` string, byte, required

## Other responses

- `400` — Bad Request As OpenAPI does not support WebSocket description, the error code (1003) is actually returned in a close message instead of (400).
- `408` — Server Timeout As OpenAPI does not support WebSocket description, this error code (1001) is actually returned in a close message instead of (408).
- `500` — Internal Server Error As OpenAPI does not support WebSocket description, this error code (1011) is actually returned in a close message instead of (500).
- `503` — Service Unavailable As OpenAPI does not support WebSocket description, this error code (1013) is actually returned in a close message instead of (503).

## Changes

> 50 revisions in range; 1 could not be searched.

- **2024-04-17** `97c52d4464c4` — 8 info
  - added the non-success response with the status `400`
  - added the non-success response with the status `408`
  - added the non-success response with the status `500`
  - added the non-success response with the status `503`
  - …4 more
- **2023-11-29** `4e79efa55da1` — 1 info
  - endpoint added
- **2022-01-31** `7dfe2dc54c38` — 1 breaking
  - api path removed without deprecation

[Change history](https://skmtc.dev/onflow/apis/access-api/changes/subscribe_events/get.md)

---

[API](https://skmtc.dev/onflow/apis/access-api.md) · [All operations](https://skmtc.dev/onflow/apis/access-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/onflow/access-api/revisions/fd121c1fddf8/schema)
