Step 3. Create a Variable

Create a variable to monitor transactions for specific wallets or addresses.

❗️

Note

Each call incurs a fixed CU charge, plus additional CUs for API operations. See the Compute Units Usage page for details.

As outlined in the Introduction page, event streaming supports two variable types:

  • address, which will produce confirmed_tx and confirmed_balance.
  • event_type, which will produce block.

Both variables return an id which is the unique identifier of the resource. We need this id for two reasons:

  • To reference the variables used in a rule.
  • To add values to a variable.

In this step, we'll create a variable of type address.

Request Payload

curl --location 'https://svc.blockdaemon.com/streaming/v2/variables' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data '   
		{
        "description": "Polkadot mainnet addresses",
        "name": "Polkadot mainnet addresses",
        "type": "string"
    }'

Response Payload

A successful response will return a "201 - Created" status with the variable details.

{
    "created_at": "2024-03-06T14:44:40.940488Z",
    "description": "Polkadot mainnet addresses",
    "id": "3c1c1483-d8e0-4ecb-95a0-1e18a5d03244",
    "name": "Polkadot mainnet addresses",
    "type": "string",
    "updated_at": "2024-03-06T14:44:40.940488Z"
}


Managing Variable

Update an existing variable using its ID. All fields in the request body will replace the existing values.

Example Payload

curl --request PUT \
     --url https://svc.blockdaemon.com/streaming/v2/variables/{VARIABLE ID HERE} \
     --header 'accept: application/json' \
     --header 'authorization: Bearer YOUR_API_KEY' \
     --header 'content-type: application/json' \
     --data '
{
  "name": "new name",
  "description": "new description",
  "type": "string | number | bool"
}
'
{
  "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "name": "new name",
  "description": "new description",
  "type": "string",
  "created_at": "2025-08-05T14:26:13.150Z",
  "updated_at": "2025-08-05T14:26:13.150Z"
}

Delete a variable by its ID. This action cannot be undone.

Example Payload

curl --request DELETE \
     --url https://svc.blockdaemon.com/streaming/v2/variables/{VARIABLE ID HERE} \
     --header 'accept: application/json' \
     --header 'authorization: Bearer YOUR_API_KEY'
A 204 response status indicates the variable was successfully deleted.

👋 Need Help?

Contact us through email or our support page for any issues, bugs, or assistance you may need.