Webhooks

Know when something changes, and trust that the call is real

TenancyEngine calls your endpoint when a customer is created, a plan changes, or usage reaches a limit. Every call is signed, retried when it fails, and logged.

Webhook endpoints on every plan. Managing them from code needs an API key with the webhooks.manage scope.

What you get

The events you can subscribe to

tenant.created, tenant.updated, tenant.deleted, user.invited, user.role_assigned, entitlement.changed, subscription.synced, usage.near_limit, usage.at_limit, and sms.inbound_message. Pick some, or take everything.

Signed, with a timestamp

Each delivery carries an X-TE-Signature header with a timestamp and an HMAC-SHA256 signature of the raw body. The SDK helper rejects a signature older than five minutes, so a captured request cannot be replayed later.

Retried, then logged

A failed delivery is retried with growing delays, from 10 seconds up to 24 hours, for up to six attempts. The console shows the last 50 attempts for each endpoint, and you can send a test event on demand.

Rotate without downtime

After you rotate a secret, deliveries carry both signatures for 24 hours, so your receiver keeps working while you deploy the new secret. If the old secret leaked, rotate with no overlap.

Manage them from code

List, create, update, and delete endpoints, and rotate secrets, from your backend. The signing secret is shown once.

In your code

These calls come from the TenancyEngine.Sdk package on NuGet. Every capability is also a REST API, so any language that can make an HTTPS request can use it.

Verify a delivery
// TenancyEngine calls you: verify the signature before you trust the event.
using var reader = new StreamReader(req.Body);
var rawBody = await reader.ReadToEndAsync();
var signature = req.Headers["X-TE-Signature"].ToString();

return WebhookSignatureVerifier.Verify(rawBody, signature, webhookSecret)
    ? Results.Ok()
    : Results.BadRequest();
Create an endpoint
var created = await te.CreateWebhookAsync(
    applicationId,
    "https://api.example.com/webhooks/tenancyengine",
    "tenant.created,entitlement.changed",
    ct);

// The signing secret is shown once. Store it now.
var secret = created.PlainSecret;

What to know before you build on it

  • A delivery can arrive more than once. Make your handler safe to repeat.
  • After the last attempt a failed delivery is set aside. It is not retried again on its own.
  • Endpoints must use HTTPS. Verify the exact raw request body, not a re-serialised copy.

Questions developers ask

Which headers should I read?

X-TE-Signature carries the timestamp and signature, and X-TE-Event carries the event type, such as entitlement.changed.

Can I verify a signature without the SDK?

Yes. Compute HMAC-SHA256 over the timestamp, a dot, and the raw body, using your secret. Compare it with v1 in constant time, and reject a timestamp older than five minutes.

What if my endpoint is down?

TenancyEngine retries with growing delays for up to six attempts. You can see each attempt in the delivery log.

Try it on the free Starter plan

One app and up to five customer workspaces. Upgrade when you need more.

Request access