Set the webhook configuration
Replaces the account’s webhook configuration: target URL, authentication, and the events to deliver. The response returns the signing secret - generated on the first save, the stored one on later saves - and this is the only call that returns it unmasked, so record it here. There is no GET on this path; read the stored configuration back from Get an account, which returns it under webhooks with the signing secret masked. The deliverable event types are a fixed set, unrelated to the contact event names from List event names.
/v2/ accounts/ {accountId}/ webhooksPath parameters
accountIdstringrequired
The account the request is scoped to.
Request body
authTypeone of: basic, bearer, nonerequired
How SendStreak authenticates against your webhook endpoint.
eventsarray, any of: contact.bounced, contact.complained, contact.deleted, contact.unsubscribedrequired
Contact lifecycle events to deliver. At least one is required.
passwordOrTokenstringoptional
Password (basic) or token (bearer) for the webhook endpoint. Write-only.
signingSecretstringoptional
Secret for verifying payload signatures. Write-only: returned from the PUT webhooks call, masked on account reads.
urlstring (uri)required
HTTPS endpoint that receives the webhook deliveries.
usernamestringoptional
Username for basic authentication.
Response
The stored webhook config, including the signing secret.
Errors
400
The request body or parameters failed validation.
401
Missing or invalid token, or the token is not authorized for this account/user.
See Errors and rate limits for what error responses look like.
curl --location --request PUT 'https://api.sendstreak.com/v2/accounts/YOUR_ACCOUNT_ID/webhooks' \
--header 'Authorization: Bearer YOUR_API_TOKEN' \
--header 'Content-Type: application/json' \
--data-raw '{
"authType": "basic",
"events": [
"contact.bounced"
],
"passwordOrToken": "webhook-bearer-token",
"signingSecret": "whsec_9f8e7d6c5b4a39281706",
"url": "https://example.com/webhooks/sendstreak",
"username": "smtp-user"
}'
const res = await fetch('https://api.sendstreak.com/v2/accounts/YOUR_ACCOUNT_ID/webhooks', {
method: 'PUT',
headers: {
Authorization: `Bearer ${process.env.SENDSTREAK_TOKEN}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
"authType": "basic",
"events": [
"contact.bounced"
],
"passwordOrToken": "webhook-bearer-token",
"signingSecret": "whsec_9f8e7d6c5b4a39281706",
"url": "https://example.com/webhooks/sendstreak",
"username": "smtp-user"
})
});
import os, requests
res = requests.put(
'https://api.sendstreak.com/v2/accounts/YOUR_ACCOUNT_ID/webhooks',
headers={'Authorization': f"Bearer {os.environ['SENDSTREAK_TOKEN']}"},
json={
"authType": "basic",
"events": [
"contact.bounced"
],
"passwordOrToken": "webhook-bearer-token",
"signingSecret": "whsec_9f8e7d6c5b4a39281706",
"url": "https://example.com/webhooks/sendstreak",
"username": "smtp-user"
},
)
{
"authType": "basic",
"events": [
"contact.bounced"
],
"passwordOrToken": "webhook-bearer-token",
"signingSecret": "whsec_9f8e7d6c5b4a39281706",
"url": "https://example.com/webhooks/sendstreak",
"username": "smtp-user"
}