eth_subscribe

Subscribes to specific event types and returns a subscription ID to receive asynchronous notifications via the `eth_subscription` method. ⚠️ **WARNING: WebSocket-Only Method** ⚠️ > This method REQUIRES a WebSocket connection using `wss://` protocol. It will NOT work with standard HTTP/HTTPS requests or `curl`. > See the [WebSocket documentation](https://docs.alchemy.com/reference/subscription-api) for examples.

Path Parameters

apiKeystringRequiredDefaults to docs-demo

Request

This endpoint expects an object.
Subscription TypestringOptional

The type of event to subscribe to (e.g., “newHeads”, “logs”, “newPendingTransactions”, “syncing”).

Optionsmap from strings to anyOptional

Optional subscription parameters, such as filtering topics for logs.

Response

A unique identifier for the subscription, returned as a 32-byte hex string.