Skip to main content

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​

EventWhendata
ticket.completedA change sent to the network finishedticketId, simId, iccid, type (e.g. suspend), status
ticket.failedThe network couldn't make the changeas above
order.updatedAn order's status changedorderId, status, trackingNumber, carrier
watchdog.sim.thresholdA SIM passed a usage threshold rulealertId, alertType, action, scope, simId, iccid, thresholdPercent, usageBytes, allowanceBytes, message
watchdog.sim.burn_rateA SIM is on course to use its whole allowance before the month endsas above, plus projectedBytes
watchdog.pool.thresholdA pool passed a usage threshold ruleas above, with poolId and poolName instead of the SIM
watchdog.pool.burn_rateA pool is on course to use its whole allowance earlyas 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.

{
"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"
}
}

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​

  1. Build an endpoint

    Any https URL on the public internet that accepts a POST with a JSON body. Axis only connects to public addresses, and doesn't follow redirects (a 3xx counts as a failed delivery), so give it the final URL.

  2. Give Axis the URL

    In the portal (Settings > Tenant > Developer API > Webhooks), or with the API:

    PUT/api/v1/webhookTry it →
    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 /webhook shows just its last characters. Changing the URL later keeps the same secret.

  3. Check the signature on every request

    See below. Reject anything that doesn't match.

  4. Send yourself a test
    POST/api/v1/webhook/testTry it →
    curl -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
  • t is when it was signed (Unix seconds).
  • v1 is an HMAC-SHA256 of {t}.{the raw request body}, using your whole secret (including whsec_) 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).

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
});

How delivery works​

  • Answer quickly. Reply with any 2xx within 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 type you don't recognise rather than failing.

Managing webhooks​

GET/api/v1/webhookTry it →
The URL, whether webhooks are on, the end of the secret, and the events sent
POST/api/v1/webhook/rotate-secretTry it →
A new secret, returned once. Webhooks signed with the old one stop verifying straight away, so update your endpoint at the same time
DELETE/api/v1/webhookTry it →
Turns webhooks off. The secret is kept, so turning them back on uses the same one