Supported Events
Registering a Webhook
1
Send a POST request to /webhooks
Provide the HTTPS URL of your endpoint, the array of event types you want to subscribe to, and an optional secret for signature verification. See the endpoint reference below.
2
Confirm your endpoint is reachable
Immediately after registration, the platform sends a
webhook.test event to your URL with a challenge string in the payload. Your endpoint must respond with 200 OK within 5 seconds. If the test delivery fails, the webhook is not activated.3
Store the webhook ID
The
POST /webhooks response returns a webhook object containing an id (prefixed with wh_). Store this ID — you will need it to update or delete the webhook later.Create a Webhook
Register a new webhook endpoint.Request Body
string
required
The fully-qualified HTTPS URL that the platform will POST event payloads to. HTTP (non-TLS) URLs are not accepted.
array
required
An array of event type strings to subscribe to. Use
["*"] to subscribe to all current and future event types.string
A secret string used to generate an HMAC-SHA256 signature for each delivery. The signature is sent in the
X-Semai-Signature header so you can verify the payload originated from the platform. Strongly recommended — see Signature Verification below.Example Request
Example Response
List Webhooks
Retrieve all registered webhooks for your account.Example Request
Delete a Webhook
Remove a registered webhook. The platform will immediately stop delivering events to the associated URL.Path Parameters
string
required
The unique webhook ID (e.g.,
wh_01jabcd).Example Request
204 No Content on success.
Webhook Payload Structure
Every event delivery is an HTTP POST to your registered URL with the following headers and a JSON body.Request Headers
Example Payload
Verifying Webhook Signatures
Verify theX-Semai-Signature header on every inbound delivery to confirm that the payload was sent by the SemaiSens platform and has not been tampered with. Use the secret you provided when registering the webhook.
X-Semai-Signature header, and your webhook secret. Return 403 Forbidden to the sender if verification fails.
Always use
hmac.compare_digest (or your language’s equivalent constant-time comparison) rather than == to prevent timing attacks when comparing the expected and actual signatures.Retry Policy
If your endpoint returns a non-2xx HTTP status code, or does not respond within 5 seconds, the platform automatically retries delivery with exponential backoff:
After 5 consecutive failed delivery attempts, the webhook is automatically disabled and its
status is set to disabled. Re-enable it from the dashboard or by sending a PATCH /webhooks/{id} request with "status": "active".