Ask or search…
K
Links
Comment on page

Create Webhook

Programatically create a Helius webhook.
Note: It may take up to 2 minutes for webhook changes to take effect!

POST /webhooks

Creates a webhook given account addresses, transaction types, and a webhook URL. You can optionally provide an authorization header to verify that the webhook came from Helius.
Important! For a full list of supported transactionTypes —please see Transaction Types
If you'd like a raw transaction payload instead of our enhanced transaction object, please input "raw" for the webhookType. If you'd like the enhanced version, input "enhanced". Note that raw transactions have much lower latencies due to us not parsing the event types.
post
https://api.helius.xyz
/v0/webhooks
Creates a webhook.
Parameters
Query
api-key*
string
The api key.
Body
Example
Schema
{
"webhookURL": "string",
"transactionTypes": [
"UNKNOWN"
],
"accountAddresses": [
"string"
],
"webhookType": "string",
"authHeader": "string"
}
Responses
200: OK
The created webhook.

Webhook Types

Account Changes (Sample Payload)

"webhookURL": "https://TestServer.test.repl.co/webhooks",
// Use ["ACCOUNT_ADDRESS", "ACCOUNT_ADDRESS"] for multiple accountAddresses.
"accountAddresses": ["ACCOUNT_ADDRESS"],
"accountAddressOwners": [],
"authHeader": "<Optional_AuthHeader>",
"encoding": "jsonParsed",
"webhookType": "account"
}

Raw Transactions (Sample Payload)

{
"webhookURL": "https://TestServer.test.repl.co/webhooks",
"transactionTypes": ["Any"],
// Use ["ACCOUNT_ADDRESS", "ACCOUNT_ADDRESS"] for multiple accountAddresses.
"accountAddresses": ["ACCOUNT_ADDRESS"],
"webhookType": "raw", // "rawDevnet"
"txnStatus": "all", // success/failed
"authHeader": "<Optional_AuthHeader>"
}

Enhanced Transactions (Sample Payload)

{
"webhookURL": "https://TestServer.test.repl.co/webhooks",
"transactionTypes": ["NFT_SALE"],
// Use ["ACCOUNT_ADDRESS", "ACCOUNT_ADDRESS"] for multiple accountAddresses.
"accountAddresses": ["ACCOUNT_ADDRESS"],
"webhookType": "enhanced", // "enhancedDevnet"
"authHeader": "<Optional_AuthHeader>"
}

Discord Transactions (Sample Payload)

{
"webhookURL": "https://discord.com/api/webhooks/<WebhookID>/<TokenID>",
"transactionTypes": ["NFT_SALE"],
// Use ["ACCOUNT_ADDRESS", "ACCOUNT_ADDRESS"] for multiple accountAddresses.
"accountAddresses": ["ACCOUNT_ADDRESS"],
"webhookType": "discord" // "discordDevnet"
}

Basic Example

const createWebhook = async () => {
try {
const response = await fetch(
"https://api.helius.xyz/v0/webhooks?api-key=<PASTE YOUR API KEY HERE>",
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
"webhookURL": "https://TestServer.test.repl.co/webhooks",
// Wallet
"accountAddresses": ["2k5AXX4guW9XwRQ1AKCpAuUqgWDpQpwFfpVFh3hnm2Ha"],
"accountAddressOwners": [],
"encoding": "jsonParsed",
"webhookType": "account"
}),
}
);
const data = await response.json();
console.log({ data });
} catch (e) {
console.error("error", e);
}
};
createWebhook();

Testing Environments

Here are some testing environments that are quick to set up for posting webhook events: