Webhooks
Instead of asking Axis every few minutes whether anything has happened, give it a URL and it will post each event to you as it happens: a SIM change finishing, an order shipping, a SIM running low on data.
The events
| Event | When | data |
|---|---|---|
| ticket.completed | A change sent to the network finished | ticketId, simId, iccid, type (e.g. suspend), status |
| ticket.failed | The network couldn't make the change | as above |
| order.updated | An order's status changed | orderId, status, trackingNumber, carrier |
| watchdog.sim.threshold | A SIM passed a usage threshold rule | alertId, alertType, action, scope, simId, iccid, thresholdPercent, usageBytes, allowanceBytes, message |
| watchdog.sim.burn_rate | A SIM is on course to use its whole allowance before the month ends | as above, plus projectedBytes |
| watchdog.pool.threshold | A pool passed a usage threshold rule | as above, with poolId and poolName instead of the SIM |
| watchdog.pool.burn_rate | A pool is on course to use its whole allowance early | as above, plus projectedBytes |
When a Watchdog rule suspends something, action is "suspend" and the SIM (or every SIM in the pool) is already
being suspended. See Usage alerts.
What they look like
Every event has the same envelope; only data changes.
- ticket.completed
- order.updated
- watchdog.sim.threshold
- watchdog.pool.burn_rate
{
"id": "evt_9f1c2b7a4e3d4c8b9a0f1e2d3c4b5a69",
"type": "ticket.completed",
"createdAt": "2026-10-08T14:30:41.2210000Z",
"test": false,
"data": {
"ticketId": "3f2b8c1e-7d4a-4f9e-9b61-2c0d5e8a7f13",
"simId": 4183,
"iccid": "8944501234567890123",
"type": "suspend",
"status": "completed"
}
}
{
"id": "evt_0b4f7d2e9c1a4e6f8b3d5c7a9e1f2d4b",
"type": "order.updated",
"createdAt": "2026-10-09T10:05:12.0000000Z",
"test": false,
"data": {
"orderId": 318,
"status": "shipped",
"trackingNumber": "AB123456789GB",
"carrier": "Royal Mail"
}
}
{
"id": "evt_5e2a8c1f7b3d4e9a8c6b2d1f0e9a7c3b",
"type": "watchdog.sim.threshold",
"createdAt": "2026-10-20T06:12:03.0000000Z",
"test": false,
"data": {
"alertId": 21,
"alertType": "threshold",
"action": "suspend",
"scope": "sim",
"simId": 4183,
"iccid": "8944501234567890123",
"poolId": null,
"poolName": null,
"thresholdPercent": 100,
"usageBytes": 5402263552,
"allowanceBytes": 5368709120,
"projectedBytes": null,
"message": "SIM exceeded 100% threshold and was suspended"
}
}
{
"id": "evt_c3d9e1a7b5f24c6e8a0b2d4f6e8c1a3d",
"type": "watchdog.pool.burn_rate",
"createdAt": "2026-10-11T06:00:00.0000000Z",
"test": false,
"data": {
"alertId": 9,
"alertType": "burn_rate",
"action": "warn",
"scope": "pool",
"simId": null,
"iccid": null,
"poolId": 7,
"poolName": "UK Fleet",
"thresholdPercent": null,
"usageBytes": 48318382080,
"allowanceBytes": 107374182400,
"projectedBytes": 134217728000,
"message": "Pool UK Fleet is on track to exceed its data allowance before the end of the month."
}
}
Each request also carries Axis-Event-Id and Axis-Event-Type headers (the same id and type), and
User-Agent: Axis-Webhooks/1.0.
Set it up
- Build an endpoint
Any
httpsURL on the public internet that accepts aPOSTwith a JSON body. Axis only connects to public addresses, and doesn't follow redirects (a3xxcounts as a failed delivery), so give it the final URL. - Give Axis the URL
In the portal (Settings > Tenant > Developer API > Webhooks), or with the API:
curl -X PUT https://app.zentarinetworks.com/api/v1/webhook \-H "Authorization: Bearer $AXIS_API_KEY" \-H "Content-Type: application/json" \-d '{ "url": "https://example.com/axis/webhooks" }'{"url": "https://example.com/axis/webhooks","enabled": true,"secretHint": "…f81c","secret": "whsec_4Tg2yQ7mN1pXc8Rk0VbL5sHf3Wd9Ja6E","events": ["watchdog.sim.threshold", "watchdog.sim.burn_rate", "watchdog.pool.threshold","watchdog.pool.burn_rate", "order.updated", "ticket.completed", "ticket.failed"]}Store the
secret. It's what you check signatures with. It's only returned when it's first made (and when you roll it);GET /webhookshows just its last characters. Changing the URL later keeps the same secret. - Check the signature on every request
See below. Reject anything that doesn't match.
- Send yourself a testcurl -X POST https://app.zentarinetworks.com/api/v1/webhook/test \-H "Authorization: Bearer $AXIS_API_KEY" \-H "Content-Type: application/json" \-d '{ "event": "ticket.completed" }'
Axis sends an example of that event, with made-up data and
"test": true, and tells you what your endpoint said:{ "delivered": true, "statusCode": 200, "problem": null }The portal has the same test button. Make sure your code ignores (or only logs) events with
"test": true.
Checking the signature
Every request has an Axis-Signature header:
Axis-Signature: t=1791297041,v1=5257a869e7ecebeda32affa62cdca3fa51cad7e77a0e56ff536d0ce8e108d8bd
tis when it was signed (Unix seconds).v1is an HMAC-SHA256 of{t}.{the raw request body}, using your whole secret (includingwhsec_) as the key, written in lowercase hex.
To check it: work out the same HMAC from the raw body exactly as received (before any JSON parsing), compare it
with v1 in constant time, and reject the request if they differ or if t is more than 5 minutes old (that stops
someone replaying an old request).
- Node.js
- Python
- C#
- PHP
import crypto from 'node:crypto';
import express from 'express';
const secret = process.env.AXIS_WEBHOOK_SECRET; // whsec_…
const app = express();
// express.raw keeps the body exactly as sent, which the signature needs.
app.post('/axis/webhooks', express.raw({ type: 'application/json' }), (req, res) => {
const header = req.get('Axis-Signature') ?? '';
const parts = Object.fromEntries(header.split(',').map((p) => p.split('=')));
const expected = crypto.createHmac('sha256', secret).update(`${parts.t}.${req.body}`).digest('hex');
const fresh = Math.abs(Date.now() / 1000 - Number(parts.t)) < 300;
const valid = parts.v1?.length === expected.length &&
crypto.timingSafeEqual(Buffer.from(parts.v1), Buffer.from(expected));
if (!fresh || !valid) return res.sendStatus(400);
const event = JSON.parse(req.body);
queue.add(event); // do the real work later
res.sendStatus(200); // answer within 5 seconds
});
import hashlib, hmac, os, time
from flask import Flask, request, abort
app = Flask(__name__)
SECRET = os.environ["AXIS_WEBHOOK_SECRET"] # whsec_…
@app.post("/axis/webhooks")
def axis_webhook():
raw = request.get_data() # the body exactly as sent
parts = dict(p.split("=", 1) for p in request.headers.get("Axis-Signature", "").split(",") if "=" in p)
expected = hmac.new(SECRET.encode(), f"{parts.get('t')}.".encode() + raw, hashlib.sha256).hexdigest()
fresh = abs(time.time() - int(parts.get("t", 0))) < 300
if not fresh or not hmac.compare_digest(expected, parts.get("v1", "")):
abort(400)
event = request.get_json()
queue.put(event) # do the real work later
return "", 200
// ASP.NET Core minimal API
app.MapPost("/axis/webhooks", async (HttpRequest request, IConfiguration config) =>
{
var secret = config["Axis:WebhookSecret"]!; // whsec_…
using var reader = new StreamReader(request.Body);
var raw = await reader.ReadToEndAsync(); // the body exactly as sent
var parts = request.Headers["Axis-Signature"].ToString()
.Split(',', StringSplitOptions.RemoveEmptyEntries)
.Select(p => p.Split('=', 2))
.Where(p => p.Length == 2)
.ToDictionary(p => p[0], p => p[1]);
if (!parts.TryGetValue("t", out var t) || !parts.TryGetValue("v1", out var v1)) return Results.BadRequest();
using var hmac = new HMACSHA256(Encoding.UTF8.GetBytes(secret));
var expected = Convert.ToHexString(hmac.ComputeHash(Encoding.UTF8.GetBytes($"{t}.{raw}"))).ToLowerInvariant();
var fresh = Math.Abs(DateTimeOffset.UtcNow.ToUnixTimeSeconds() - long.Parse(t)) < 300;
var valid = CryptographicOperations.FixedTimeEquals(Encoding.ASCII.GetBytes(expected), Encoding.ASCII.GetBytes(v1));
if (!fresh || !valid) return Results.BadRequest();
var evt = JsonDocument.Parse(raw).RootElement;
await queue.EnqueueAsync(evt); // do the real work later
return Results.Ok();
});
<?php
$secret = getenv('AXIS_WEBHOOK_SECRET'); // whsec_…
$raw = file_get_contents('php://input'); // the body exactly as sent
$parts = [];
foreach (explode(',', $_SERVER['HTTP_AXIS_SIGNATURE'] ?? '') as $p) {
[$k, $v] = array_pad(explode('=', $p, 2), 2, '');
$parts[$k] = $v;
}
$expected = hash_hmac('sha256', ($parts['t'] ?? '') . '.' . $raw, $secret);
$fresh = abs(time() - (int)($parts['t'] ?? 0)) < 300;
if (!$fresh || !hash_equals($expected, $parts['v1'] ?? '')) {
http_response_code(400);
exit;
}
$event = json_decode($raw, true);
// queue $event, then:
http_response_code(200);
How delivery works
- Answer quickly. Reply with any
2xxwithin 5 seconds. Anything else, or no answer in time, is a failed delivery. Do the real work after you've replied (a queue is ideal). - Each event is sent once. There are no automatic retries. If your endpoint was down, the failed delivery is kept
and Axis can send it again: ask support. For anything you can't afford to
miss, also check the API now and then (for example,
GET /tickets?status=processing). - A resent event keeps its
id(with a fresh signature), so store the ids you've handled and ignore repeats. - Order isn't guaranteed. Use
createdAt, or fetch the latest state from the API, rather than relying on the order events arrive in. - New event types may be added. Ignore any
typeyou don't recognise rather than failing.
Managing webhooks
| The URL, whether webhooks are on, the end of the secret, and the events sent | |
| A new secret, returned once. Webhooks signed with the old one stop verifying straight away, so update your endpoint at the same time | |
| Turns webhooks off. The secret is kept, so turning them back on uses the same one |