Ir al contenido principal

Test a Filter – Streams REST API

Actualizado el
20 de julio de 2026

Resumen

Tests your filter function with data from a specific block before deploying it to a stream. This allows you to validate your filter logic and see the transformed output without affecting any live streams.

Key use cases:

  • Validate filter function syntax and logic
  • Preview transformed data output
  • Debug filter functions before deployment
  • Test filters against historical block data

Endpoint

Send a POST request to test a filter function.

POST https://api.quicknode.com/streams/rest/v1/streams/test_filter

Parámetros de la solicitud

ParameterTipoObligatorioDescripción
redcadenaBlockchain network (see Supported Chains)
datasetcadenaDataset type (see Data Sources)
filter_functioncadenaBase64-encoded JavaScript filter function
blockcadenaBlock number to test against

Example Request

curl -X POST "https://api.quicknode.com/streams/rest/v1/streams/test_filter" \
-H "accept: application/json" \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d '{
"network": "ethereum-mainnet",
"dataset": "block",
"filter_function": "ZnVuY3Rpb24gbWFpbihkYXRhKSB7CiAgcmV0dXJuIHsKICAgIGhhc2g6IGRhdGEuc3RyZWFtRGF0YS5oYXNoLAogICAgbnVtYmVyOiBwYXJzZUludChkYXRhLnN0cmVhbURhdGEubnVtYmVyLCAxNikKICB9Owp9",
"block": "18000000"
}'

Respuesta

On success, the API returns the result of applying your filter function to the specified block's data.

{
"logs": [],
"result": "{...}"
}

Campos de respuesta

CampoTipoDescripción
registrosmatrizAny console logs output by your filter function
resultadocadenaThe result of the filter test
consejo

If your filter function has errors, the response will contain error details to help you debug the issue.