Skip to main content

/streams/rest/v1/streams REST Method

Creates a new Stream.

Updated on
May 9, 2024

/streams/rest/v1/streams REST Method

Body Parameters

name
string
REQUIRED
A name for your stream.
network
string
REQUIRED
The network for this stream. ENUM: "arbitrum-mainnet", "arbitrum-sepolia", "avalanche-fuji", "avalanche-mainnet", "b3-mainnet", "b3-sepolia", "base-mainnet", "base-sepolia", "bera-artio", "bera-bartio", "bitcoin-mainnet", "blast-mainnet", "blast-sepolia", "bnbchain-mainnet", "bnbchain-testnet", "camp-sepolia", "celo-mainnet", "cyber-mainnet", "cyber-sepolia", "ethereum-holesky", "ethereum-mainnet", "ethereum-sepolia", "fantom-mainnet", "fraxtal-mainnet", "gnosis-mainnet", "kaia-mainnet", "kaia-testnet", "imx-mainnet", "imx-testnet", "mantle-mainnet", "mantle-sepolia", "mode-mainnet", "morph-holesky", "nova-mainnet", "optimism-mainnet", "optimism-sepolia", "omni-omega", "polygon-mainnet", "polygon-amoy", "race-mainnet", "race-testnet", "redstone-mainnet", "scroll-mainnet", "scroll-testnet", "solana-devnet", "solana-mainnet", "solana-testnet", "story-testnet", "tron-mainnet", "xai-mainnet", "xai-sepolia", "zkevm-mainnet", "zksync-mainnet", "zksync-sepolia", "zora-mainnet"
dataset
string
REQUIRED
The dataset for this stream. ENUM: "block", "block_with_receipts", "receipts", "logs", "transactions", "trace_blocks", "debug_traces", "block_with_receipts_debug_trace", "block_with_receipts_trace_block", "programs_with_logs"
filter_function
string
JS/ECMAScript compliant filter encoded in base64.
region
string
The region where this stream should run. ENUM: "usa_east"
start_range
integer
REQUIRED
Block number to start streaming at.
end_range
integer
Stream until block number. If omitted, stream will run continuously.
dataset_batch_size
integer
REQUIRED
How many blocks of data to send together as a batch.
include_stream_metadata
string
REQUIRED
Where to include the metadata about the stream. ENUM: "body", "header", "none"
status
string
REQUIRED
The initial status of the stream. ENUM: "active", "paused"
notification_email
string
Email address to send notifications to if stream terminates.
destination
string
REQUIRED
The destination type for this stream. ENUM: "webhook", "s3", "postgres", "snowflake"
destination_attributes
object
The attributes for a webhook destination.
url
string
REQUIRED
The webhook url.
compression
string
REQUIRED
Compression for the data sent to the webhook. ENUM: "none", "gzip"
headers
object
An object containing custom headers to send to the webhook.
key-value
string
Your custom header. Example: "Content-Type": "Test"
max_retry
integer
REQUIRED
The maximum number of times to retry delivery.
retry_interval_sec
integer
REQUIRED
The number of seconds to wait between retries.
post_timeout_sec
integer
REQUIRED
The number of seconds to wait before timing out.
destination_attributes
object
The attributes for an s3 destination.
endpoint
string
REQUIRED
Endpoint of your S3-compatible storage without scheme. Example: s3.amazonaws.com
access_key
string
The s3 access key. Your unique identifier for storage access found in your storage service's IAM section or account settings.
secret_key
string
REQUIRED
The s3 secret key. Works with your Access Key ID for authentication. Retrieve at creation in your storage service settings.
bucket
string
REQUIRED
The s3 bucket.
object_prefix
string
The object prefix.
file_compression_type
string
REQUIRED
File compression type. ENUM: "none", "gzip"
file_type
string
REQUIRED
File type. ENUM: ".json"
max_retry
integer
REQUIRED
The maximum number of times to retry delivery.
retry_interval_sec
integer
REQUIRED
The number of seconds to wait between retries.
use_ssl
boolean
REQUIRED
Whether to use SSL.
destination_attributes
object
The attributes for a postgres destination.
username
string
REQUIRED
The postgres username.
password
string
REQUIRED
The postgres password
host
string
REQUIRED
The database host url.
port
integer
REQUIRED
The database port number.
ssl_mode
string
REQUIRED
The database ssl mode. ENUM: "require", "disable"
table_name
string
REQUIRED
The name of the table.
max_retry
integer
REQUIRED
The maximum number of times to retry delivery.
retry_interval_sec
integer
REQUIRED
The number of seconds to wait between retries.
destination_attributes
object
The attributes for a snowflake destination.
username
string
REQUIRED
The snowflake username.
account
string
REQUIRED
The snowflake account
warehouse
string
REQUIRED
The snowflake warehouse.
host
string
REQUIRED
The snowflake host url.
port
integer
The snowflake port number.
database
string
REQUIRED
The snowflake database.
protocol
string
REQUIRED
The snowflake protocol.
schema
string
REQUIRED
The snowflake schema.
table_name
string
REQUIRED
The name of the table.
max_retry
integer
REQUIRED
The maximum number of times to retry delivery.
retry_interval_sec
integer
REQUIRED
The number of seconds to wait between retries.

Returns

id
string
The ID of the stream.
created_at
string
The timestamp when the stream was created.
updated_at
string
The timestamp when the stream was updated.
name
string
The stream name.
network
string
The network of the stream.
dataset
string
The dataset of the stream.
region
string
The region where the stream is located.
filter_function
string
The base64 encoded filter for the stream.
start_range
integer
The block number where the stream starts.
end_range
integer
The block number where the stream will end.
dataset_batch_size
integer
The number of blocks the stream will batch together.
include_stream_metadata
string
The location of the stream metadata.
destination
string
The type of destination for the stream.
fix_block_reorgs
integer
Whether block reorgs will be resolved.
keep_distance_from_tip
integer
Number of blocks behind the tip of chain that this stream will run.
destination_attributes
object
The attributes for a webhook destination.
url
string
The webhook url.
compression
string
Compression for the data sent to the webhook. ENUM: "none", "gzip"
headers
object
An object containing custom headers to send to the webhook.
key-value
string
Your custom header. Example: "Content-Type": "Test"
max_retry
integer
The maximum number of times to retry delivery.
retry_interval_sec
integer
The number of seconds to wait between retries.
post_timeout_sec
integer
The number of seconds to wait before timing out.
security_token
string
The security token that can be used to validate the authenticity of data sent to this webhook.
destination_attributes
object
The attributes for an s3 destination.
endpoint
string
Endpoint of your S3-compatible storage without scheme. Example: s3.amazonaws.com
access_key
string
The s3 access key. Your unique identifier for storage access found in your storage service's IAM section or account settings.
secret_key
string
The s3 secret key. Works with your Access Key ID for authentication. Retrieve at creation in your storage service settings.
bucket
string
The s3 bucket.
object_prefix
string
The object prefix.
file_compression_type
string
File compression type. ENUM: "none", "gzip"
file_type
string
File type. ENUM: ".json"
max_retry
integer
The maximum number of times to retry delivery.
retry_interval_sec
integer
The number of seconds to wait between retries.
use_ssl
boolean
Whether to use SSL.
destination_attributes
object
The attributes for a postgres destination.
username
string
The postgres username.
password
string
The postgres password
host
string
The database host url.
port
integer
The database port number.
ssl_mode
string
The database ssl mode. ENUM: "require", "disable"
table_name
string
The name of the table.
max_retry
integer
The maximum number of times to retry delivery.
retry_interval_sec
integer
The number of seconds to wait between retries.
destination_attributes
object
The attributes for a snowflake destination.
username
string
The snowflake username.
account
string
The snowflake account
warehouse
string
The snowflake warehouse.
host
string
The snowflake host url.
port
integer
The snowflake port number.
database
string
The snowflake database.
protocol
string
The snowflake protocol.
schema
string
The snowflake schema.
table_name
string
The name of the table.
max_retry
integer
The maximum number of times to retry delivery.
retry_interval_sec
integer
The number of seconds to wait between retries.
status
string
The status of the stream.
notification_email
string
The email address to send notifications to if stream terminates.
sequence
integer
The last delivered block from the data range.
current_hash
string
A hash value representing the current block of the stream.
Request
1
curl -X POST \
2
"https://api.quicknode.com/streams/rest/v1/streams" \
3
-H "accept: application/json" \
4
-H "Content-Type: application/json" \
5
-H "x-api-key: YOUR_API_KEY" \
6
-d $'{
7
"name": "My Stream",
8
"network": "ethereum-mainnet",
9
"dataset": "block",
10
"filter_function": "ZnVuY3Rpb24gbWFpbihkYXRhKSB7CiAgICB2YXIgbnVtYmVyRGVjaW1hbCA9IHBhcnNlSW50KGRhdGEuc3RyZWFtRGF0YS5udW1iZXIsIDE2KTsKICAgIHZhciBmaWx0ZXJlZERhdGEgPSB7CiAgICAgICAgaGFzaDogZGF0YS5zdHJlYW1EYXRhLmhhc2gsCiAgICAgICAgbnVtYmVyOiBudW1iZXJEZWNpbWFsCiAgICB9OwogICAgcmV0dXJuIGZpbHRlcmVkRGF0YTsKfQ==",
11
"region": "usa_east",
12
"start_range": 100,
13
"end_range": 200,
14
"dataset_batch_size": 1,
15
"include_stream_metadata": "body",
16
"destination": "webhook",
17
"fix_block_reorgs": 0,
18
"keep_distance_from_tip": 0,
19
"destination_attributes": {
20
"url": "https://wehook.site",
21
"compression": "none",
22
"headers": {
23
"Content-Type": "Test",
24
"Authorization": "again"
25
},
26
"max_retry": 3,
27
"retry_interval_sec": 1,
28
"post_timeout_sec": 10
29
},
30
"status": "active"
31
}'
32
Don't have an account yet?
Create your QuickNode endpoint in seconds and start building
Get started for free