Skip to content

Create a webhook endpoint (API key)

POST
/api/v2/webhooks
curl --request POST \
--url https://api.sipstack.com/api/v2/webhooks \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--data '{ "url": "https://example.com/sipstack-webhook", "events": [ "message.delivered", "message.failed" ] }'

Registers an endpoint URL for the given event types. The URL must be a public HTTPS address (localhost/private/reserved hosts are rejected). The signing secret is returned only in this response — store it now; it is never shown again. See the Webhooks guide for the event catalog.

This is the API-key (server-to-server) webhooks surface; the portal admin-console equivalent lives under the Webhooks tag.

Media type application/json
object
url
required
string format: uri
Example
https://example.com/sipstack-webhook
events
required
Array<string>
Example
[
"message.delivered",
"message.failed"
]

Endpoint created — data.secret is shown once.

Media type application/json
object
success
boolean
message
string
data

The created endpoint — a compact subset of ApiWebhookSummary (the RETURNING clause), plus the one-time secret. failure_count, last_triggered_at, and updated_at are NOT included on create; read them back from GET /api/v2/webhooks.

object
id
string format: uuid
uuid
string format: uuid
url
string
events
Array<string>
is_active
boolean
created_at
string format: date-time
secret

HMAC signing secret — shown only here.

string
signature

How to verify webhook deliveries — echoed by the API-key webhook endpoints.

object
header
string
format
string
Example
{
"message": "Webhook created. Store the secret now — it will not be shown again.",
"data": {
"url": "https://example.com/sipstack-webhook",
"events": [
"message.delivered",
"message.failed"
]
},
"signature": {
"header": "X-Webhook-Signature",
"format": "sha256=<hex-hmac-sha256 of the raw request body, keyed by the endpoint secret>"
}
}

Missing/invalid URL (including an SSRF-rejected host) or empty events array.

Media type application/json

Inline error shape used by the messaging API and management endpoints.

object
success
boolean
error
string
Example
{
"success": false,
"error": "Recipient phone number (to) is required"
}

Missing or invalid API key.

Media type application/json

Inline error shape used by the messaging API and management endpoints.

object
success
boolean
error
string
Example
{
"success": false,
"error": "Recipient phone number (to) is required"
}

Organization not provisioned for webhooks.

Media type application/json

Inline error shape used by the messaging API and management endpoints.

object
success
boolean
error
string
Example
{
"success": false,
"error": "Recipient phone number (to) is required"
}

Internal error.

Media type application/json

Inline error shape used by the messaging API and management endpoints.

object
success
boolean
error
string
Example
{
"success": false,
"error": "Recipient phone number (to) is required"
}