N Ninja Logistics
TMS Integration · Developer Guide
Outbound webhook

Delivery Webhook

We push a signed JSON payload to your endpoint every time a stop on one of your routes changes state — arrival, completion, or failure — with proof-of-delivery photos attached. This is everything your team needs to receive it correctly. An optional second event, route.priced, sends the finalised price of a completed route — see §5.

Direction
Ninja → You
Transport
HTTPS POST · JSON
Trigger
Per stop, on state change
Auth
HMAC-SHA256
Payload version
ninja_v1 · ninja_v2
01

How it fires

One POST per stop, each time that stop reaches a new state. Every POST carries the whole route, so you always have the complete picture.

A three-stop route therefore produces roughly six POSTs over the day — each stop moves PENDING → IN_PROGRESS → COMPLETED, and each of those transitions is one delivery to you. Every POST contains all three stops with their current status, so the later ones supersede the earlier.

Design consequence

Bodies look near-identical between POSTs — the difference is inside stops[].status. Do not diff whole bodies to detect change. Key on the X-Ninja-Delivery header and read each stop's status directly.

There is no route-level status field. A route is finished when every stop is COMPLETED or FAILED.

02

Your endpoint

Give us one HTTPS URL. These are hard requirements — a request that violates them never leaves our side, or is recorded as failed.

RequirementDetail
MUST Use HTTPSPlain http:// is rejected outright. Valid certificate required — we never disable verification.
MUST Be publicly routablePrivate, loopback and link-local addresses are blocked.
MUST NOT RedirectWe do not follow redirects. A 301/302 counts as a failure — give us the final URL.
MUST Answer within 10sAcknowledge fast and process asynchronously. A timeout is a failed delivery and will be retried.
MUST Return 2xx on successAny non-2xx triggers our retry cycle. 200 with an empty body is perfect.

Request headers

HeaderExampleUse
X-Ninja-Eventstop.updatedEvent type. stop.updated for the operational payload below; route.priced for the billing event — see §5. Always branch on this header.
X-Ninja-Delivery12345678#D1Your idempotency key. route_id + # + stop_code (or #price for a route.priced event).
X-Ninja-Timestamp1756800000Unix seconds when signed. Use it to reject stale replays.
X-Ninja-Signaturesha256=f8e879…HMAC of the body. Parse as a comma-separated list. See §3.
We ignore your response body

Only the HTTP status code is read. The body is capped, stored truncated for our own debugging, and never parsed or acted on. Nothing you return can change our data — so there is no callback or acknowledgement protocol to implement.

03

Verify the signature

Do this before parsing anything. It is the only thing proving the request came from us and was not altered in transit.

We compute HMAC-SHA256 over the string {timestamp}.{raw_body} using your signing secret, hex-encode it, and prefix it with sha256=.

Use the raw body

Sign the exact bytes you received — before any JSON parse. If you parse and re-serialize, key order and whitespace shift and the signature will never match. In Express use express.raw(); in Django use request.body; in Laravel use $request->getContent().

Accept a list — this one is easy to get wrong

Treat X-Ninja-Signature as a comma-separated list, and accept the request if any entry matches your computed value. Normally we send exactly one, so a list-aware check behaves identically. For 24 hours after a secret rotation we send two — one per valid secret — so your integration keeps working while you swap the secret over at your own pace, with no coordinated downtime.

This is not hypothetical: you can rotate your own secret whenever you like (§3.1), so a two-signature request is something your endpoint should expect to see. Hard-code the check to a single value and every rotation becomes a synchronised deployment on both sides.

// Normally — one signature
X-Ninja-Signature: sha256=b8ad7a73cacb0900…

// For 24h after a rotation — two, either may match
X-Ninja-Signature: sha256=b8ad7a73cacb0900…, sha256=5910c367833351f2…
Node.js · Express
// Mount raw body for this route only
app.post('/ninja/webhook',
  express.raw({ type: 'application/json' }),
  (req, res) => {
    const secret = process.env.NINJA_WEBHOOK_SECRET;
    const ts  = req.headers['x-ninja-timestamp'];
    const raw = req.body.toString('utf8');

    const expected = 'sha256=' + crypto
      .createHmac('sha256', secret)
      .update(`${ts}.${raw}`)
      .digest('hex');

    // Comma-separated list: accept if ANY entry matches.
    // Constant-time compare avoids a timing side-channel.
    const sigs = String(req.headers['x-ninja-signature'] || '')
      .split(',').map(s => s.trim());
    const valid = sigs.some(s => {
      const a = Buffer.from(s), b = Buffer.from(expected);
      return a.length === b.length && crypto.timingSafeEqual(a, b);
    });
    if (!valid) return res.sendStatus(401);

    // Reject anything older than 5 minutes
    if (Math.abs(Date.now()/1000 - Number(ts)) > 300) {
      return res.sendStatus(401);
    }

    res.sendStatus(200);          // ack FIRST
    process(JSON.parse(raw));    // then work asynchronously
  });
Python · Flask
import hmac, hashlib, time

def verify(request, secret):
    ts  = request.headers.get('X-Ninja-Timestamp', '')
    sig_header = request.headers.get('X-Ninja-Signature', '')
    raw = request.get_data(as_text=True)   # raw, not request.json

    expected = 'sha256=' + hmac.new(
        secret.encode(), (ts + '.' + raw).encode(), hashlib.sha256
    ).hexdigest()

    # Comma-separated list: accept if ANY entry matches
    sigs = [s.strip() for s in sig_header.split(',')]
    if not any(hmac.compare_digest(s, expected) for s in sigs):
        return False
    return abs(time.time() - int(ts)) <= 300
PHP
$raw = file_get_contents('php://input');
$ts  = $_SERVER['HTTP_X_NINJA_TIMESTAMP'] ?? '';
$sig = $_SERVER['HTTP_X_NINJA_SIGNATURE'] ?? '';

$expected = 'sha256=' . hash_hmac('sha256', $ts . '.' . $raw, $secret);

// Comma-separated list: accept if ANY entry matches
$valid = false;
foreach (array_map('trim', explode(',', $sig)) as $s) {
    if (hash_equals($expected, $s)) { $valid = true; break; }
}
if (!$valid) { http_response_code(401); exit; }
Handling the secret

The secret is shown once, at the moment it is generated, and is masked from then on — we keep no way to show it to you again. Store it as an environment variable or in a secret manager, never in source control. Lost it? Generate a new one; you do not need us.

3.1 · Rotating your secret

You generate and rotate your own secret in the API & Webhooks page of your Ninja shipper portal. Nobody at Ninja handles the value, and there is nothing to request or wait for.

A rotation is deliberately not a cutover:

  1. You press Rotate. The new secret is displayed once — copy it.
  2. For the next 24 hours both secrets are valid, and every POST carries two signatures: one per secret. A list-aware verifier (§3) accepts either, so nothing breaks at the moment you rotate.
  3. Deploy the new secret whenever suits you inside that window.
  4. After 24 hours the old secret stops verifying, and requests go back to one signature.

The same overlap applies to the re-fetch API in §7 — during the window either secret authenticates.

If your secret leaks, rotating is not enough on its own

That 24-hour overlap is a convenience for deployment, not a containment measure: the exposed secret keeps working for the whole window, and it also authenticates the re-fetch API, which can read your route data. To cut a leaked secret off immediately, rotate twice — the second rotation pushes the exposed one out of the grace slot at once. Then tell us, so we can check whether it was used.

Two credentials, two lifetimes

These are frequently confused. There is no token refresh flow to implement — nothing in this integration expires on a timer that you must renew.

ItemLifetimeYour responsibility
Webhook secret
Signature + re-fetch auth
Long-lived. Does not expire. No rotation schedule, no refresh endpoint. It changes only when someone deliberately rotates it — normally you, in your portal. Store it once. When you do rotate, the old one stays valid for 24h (§3.1), so you deploy on your own schedule.
Photo URLs
Inside each payload
24 hours. Minted fresh for every POST. Download the files within 24h. These are links, not credentials — there is nothing to refresh.
In short

The credential you hold is permanent; the photo links inside the payload are temporary. A new set of freshly-signed links arrives with every POST, and §7 covers how to pull new ones on demand.

04

Payload & fields

A real example produced by the same code that will call you, followed by every field we send.

The route below has a completed pickup, a stop cancelled by the customer, and a stop not yet attempted.

{
  "route_id": "12345678",
  "date": "2026-09-02",
  "driver":    { "name": "SOMCHAI D.", "phone": "******1234" },
  "assistant": { "name": "ASSISTANT A.",  "phone": "******5678" },
  "vehicle":   { "type": "4W1.5T", "plate": "1กก-1234" },
  "stops": [
    {
      "stop_code": "PU",
      "stop_type": "PICKUP",
      "location_name": "Central Warehouse (Bangna)",
      "address": "Central Warehouse (Bangna)",
      "window": null,
      "planned": null,
      "arrived_at": "2026-09-02T08:59:00",
      "completed_at": "2026-09-02T08:59:00",
      "status": "COMPLETED",
      "photos": {
        "arrival":     ["https://storage.googleapis.com/…signed…"],
        "destination": ["https://storage.googleapis.com/…signed…"],
        "goods":       ["https://storage.googleapis.com/…signed…"],
        "document":    ["https://storage.googleapis.com/…signed…"]
      }
    },
    {
      "stop_code": "D1",
      "stop_type": "DROP",
      "location_name": "Retail Store 1 (Nonthaburi)",
      "address": "Retail Store 1 (Nonthaburi)",
      "window": { "start": "09:00", "end": "12:00" },
      "planned": null,
      "arrived_at": "2026-09-02T11:19:00",
      "completed_at": null,          // ← terminal, but never completed
      "status": "FAILED",
      "failure_reason": "customer_cancel",
      "photos": { "arrival": [], "destination": [], "goods": [], "document": [] }
    },
    {
      "stop_code": "D2",
      "stop_type": "DROP",
      "location_name": "Retail Store 2 (Nonthaburi)",
      "address": "Retail Store 2 (Nonthaburi)",
      "window": null,
      "planned": null,
      "arrived_at": null,
      "completed_at": null,
      "status": "PENDING",
      "photos": { "arrival": [], "destination": [], "goods": [], "document": [] }
    }
  ]
}

The // comment above is annotation for this document only — real payloads are strict JSON.

Field reference

Every field we send. Anything not listed here is not sent — and we may add fields in future, so ignore unknown keys rather than rejecting the payload.

The sample above and the tables below are ninja_v1. One field, completed_location, is sent only on ninja_v2 — see below. Your format is shown in your portal; you are on ninja_v1 unless you chose otherwise.

Route level

FieldTypeNotes
route_idstringStable identifier for the route. Your primary join key.
datestringRoute date, YYYY-MM-DD.
driver.namestringDriver's name. The stable identifier for a driver — see trap 04.
driver.phonestringMasked to last 4 digits, e.g. ******1234.
assistantobject | nullnull when no assistant is recorded. Same masking.
vehicle.typestringe.g. 4W1.5T.
vehicle.platestringLicence plate, usually Thai script.
stopsarrayOrdered by route sequence.

Stop level

FieldTypeNotes
stop_codestringPU for pickup, else D+index. Stable for a route's life; may skip numbers — see trap 05.
stop_typeenumPICKUP or DROP.
location_namestringSite name as recorded on the route.
addressstringFrequently identical to location_name — one field feeds both upstream.
windowobject | null{start,end} as HH:MM. null means no booked window.
plannedstring | nullPlanned arrival. Often null.
arrived_atstring | nullWhen the driver arrived. ICT, no offset.
completed_atstring | nullWhen the stop completed. May be null even when terminal — trap 02.
statusenumSee §5.
failure_reasonenumPresent only when status is FAILED. Absent otherwise.
completed_locationobject | nullninja_v2 only — absent entirely on ninja_v1. {lat,lng} as decimal degrees, recorded at the delivery event. Frequently null — see below.
photosobjectFour arrays, always present, possibly empty. See §7.

ninja_v2 — completed_location

ninja_v2 is ninja_v1 with one extra key on every stop: the driver's GPS position at the moment the delivery was recorded. Nothing else differs — same route fields, same stop fields, same headers, same signature. If you are on ninja_v1 the key is not merely null, it is absent.

{
  "stop_code": "D1",
  // … every ninja_v1 stop field, unchanged …
  "status": "COMPLETED",
  "completed_location": { "lat": 13.7563, "lng": 100.5018 },
  "photos": { … … }
}
Expect null, and do not infer from it

This is the position recorded on the driver's device, not the geocoded address — it is where the driver was, not where the site is. The two can differ by a building, a loading bay or a street.

It is written only when the delivery event concludes. This is not a tracking feed and cannot be used as one — a stop the driver has arrived at but not yet finished reads null, however often you poll:

Stop statuscompleted_location
PENDINGnull
IN_PROGRESS (arrived, still working)null
COMPLETEDthe fix
FAILED, delivery attemptedthe fix
FAILED, cancelled on arrivalnull — no delivery event occurred

The key is always present on ninja_v2, so you never have to test for its existence. A COMPLETED status with completed_location: null is normal — a fix is not always usable — and is not a failed delivery. Never gate a delivery's validity on it.

We send a coordinate only when both halves are real: you will never receive a half-populated object, a number as a string, an out-of-range value, or 0,0.

05

Billing event route.priced

An optional, opt-in second event carrying the finalised price of a route. Enabled per shipper on request — if you have not asked for it, you will never receive it, and it changes nothing about the stop.updated stream above.

Direction
Ninja → You
Header
X-Ninja-Event: route.priced
Trigger
Per route, once priced & on price change
Auth
HMAC-SHA256 — identical to §3
Currency
THB

When it fires

Once a route is complete (every stop COMPLETED or FAILED) and our billing engine has priced it, we send one route.priced event. If the finalised price or distance later changes — a re-pricing, a correction — we send it again. We do not send it while the route is still running, and a completed route that has not been priced yet produces nothing until it is.

Key on route_id, take the latest

Every route.priced for a route supersedes the previous one. Join to the operational stream by route_id, and when you receive more than one, the one with the newest priced_at is current. The idempotency header is <route_id>#price.

Verify the signature exactly as in §3 — same X-Ninja-Signature / X-Ninja-Timestamp scheme over the raw body. This payload carries no personal data and does not repeat the vehicle block; take the vehicle from the stop.updated payload for the same route_id.

{
  "route_id": "12345678",
  "date": "2026-09-02",
  "currency": "THB",
  "finalized": {
    "distance_km": 120,
    "transportation_fee": 1000,     // delivery-side, excl VAT
    "drop_fee": 200,
    "additional_fee": 0,             // other delivery-side charges, excl VAT
    "vas": {                          // value-added services — each 7% VAT-able
      "helper_fee":    { "amount": 300, "vatable": true },
      "lifting_fee":   { "amount": 100, "vatable": true },
      "cod_fee":       { "amount": 50,  "vatable": true },
      "insurance_fee": { "amount": 70,  "vatable": true }
    },
    "total_excl_vat": 1720,        // all fees above, before VAT
    "vat_amount": 36.4,           // 7% on the VAT-able VAS fees only
    "total_incl_vat": 1756.4       // grand total you are billed
  },
  "priced_at": "2026-09-02T18:00:00"
}

The // comments are annotation for this document only — real payloads are strict JSON.

Field reference

FieldTypeNotes
route_idstringSame identifier as the operational stream. Your join key.
datestringRoute date, YYYY-MM-DD.
currencystringAlways THB.
finalized.distance_kmnumberThe finalised distance the route was billed on, in kilometres.
finalized.transportation_feenumberBase transport fee. Delivery-side, excl VAT.
finalized.drop_feenumberAdditional-drop fee. Delivery-side, excl VAT.
finalized.additional_feenumberAny other delivery-side charge (waiting, adjustments). Excl VAT, no VAT applied.
finalized.vasobjectThe value-added-service fees, each an {amount, vatable} pair: helper_fee, lifting_fee, cod_fee, insurance_fee. All are 7% VAT-able. A fee not applicable to a route is 0.
finalized.total_excl_vatnumberSum of every fee above, before VAT = transport + drop + additional + all VAS amounts.
finalized.vat_amountnumber7% VAT, charged on the VAT-able VAS fees only (helper + lifting + cod + insurance).
finalized.total_incl_vatnumberThe grand total you are billed = total_excl_vat + vat_amount.
priced_atstringWhen we computed this price. ICT, no offset. Use it to pick the newest of several events for one route.
It foots exactly

total_excl_vat = transportation_fee + drop_fee + additional_fee + (sum of the four vas amounts); vat_amount = 7% of the VAT-able VAS amounts; total_incl_vat = total_excl_vat + vat_amount. These tie out to the tax invoice you receive, to the satang.

06

Status & failure codes

Handle all four statuses and all seven failure reasons. Treat an unrecognised value as “unknown” rather than erroring — we may extend these lists.

StatusMeaningTerminal?
PENDINGNot yet attempted. The driver has not arrived.No
IN_PROGRESSDriver has arrived and is working the stop.No
COMPLETEDDelivered or picked up successfully.Yes
FAILEDNot completed. failure_reason explains why.Yes

failure_reason

ValueMeaning
location_closedPremises shut on arrival.
damaged_goodsGoods damaged; recipient refused.
wrong_quantityQuantity did not match the order.
invalid_documentsPaperwork missing or incorrect.
invalid_skuWrong item for this location.
wrong_locationAddress wrong or unreachable.
customer_cancelCancelled before the driver arrived. This one has no completed_at.
07

Retries & duplicates

We retry automatically. You must therefore expect to see the same delivery more than once, and must make your handler idempotent.

BehaviourDetail
What counts as failureAny non-2xx status, a timeout past 10s, a redirect, or a connection error.
Retry intervalRoughly every 15 minutes.
Maximum attempts8. After that the delivery is marked failed and stops automatically.
Total retry spanAbout 2 hours from first attempt.
After 8 failuresOur team can re-queue it manually. Contact us if you had an outage longer than 2 hours.
Deduplicate on X-Ninja-Delivery

Retries reuse the same X-Ninja-Delivery value (route_id#stop_code). Record which ones you have processed and ignore repeats. Note this key is not unique per POST — a stop that legitimately changes state again reuses it — so treat it as "latest state for this stop wins" rather than "process once, ever."

Ordering

Deliveries are not strictly ordered, and a retry can arrive after a newer POST. Because every payload carries the complete route, the safe rule is: apply the newest payload you have received for a route and let it overwrite, rather than applying deltas in sequence. X-Ninja-Timestamp tells you which is newer.

08

Photos & re-fetch

Proof-of-delivery photos arrive as time-limited signed links, in four categories.

CategoryWhat it shows
arrivalEvidence the driver reached the location.
destinationThe delivery point itself.
goodsThe goods delivered.
documentSigned paperwork and receipts.
Links expire after 24 hours

Download and store the images on your side promptly. After 24 hours the URLs stop working and will return an error. Do not store the URL as your permanent reference — store the file.

Re-fetch API

If your ingestion was down, or you need fresh links for an older route, pull the same payload on demand with newly signed photo URLs. This is a read-only endpoint — it changes nothing.

GET https://asia-southeast1-th-ops-1b7c4.cloudfunctions.net/getShipperRoutePayload?route_id=12345678
Authorization: Bearer <your webhook secret>

It returns exactly the same JSON structure as the webhook. It is scoped to your own routes — a request for a route belonging to another shipper returns 403. Rate limited to 120 requests per hour; please cache rather than poll.

The Bearer token is your signing secret, so it follows the same rotation rules: for 24 hours after a rotation either secret authenticates here (§3.1). Note the consequence — this secret is not only a signature key, it reads your route data. Treat it as a live credential.

Empty photo arrays are normal

Photos captured where the driver had no signal upload later. An early POST may show empty arrays that fill in on a subsequent one, or via this endpoint.

09

Traps to avoid

These are the specific behaviours that most often break an integration. Each one is deliberate on our side.

  1. Timestamps are Bangkok local time with no offset

    "2026-09-02T08:59:00" means 08:59 in Thailand (ICT, UTC+7). There is no Z and no offset. If you parse it as UTC your times will be 7 hours out — attach the Asia/Bangkok zone explicitly.

  2. A terminal stop may have no completed_at

    Stops cancelled before the driver arrived are FAILED with an arrived_at but completed_at: null. Do not assume a terminal stop always has a completion time — a non-null check on completed_at is not a validity test.

  3. Bodies repeat; only the status differs

    Every POST carries the whole route, so consecutive bodies look nearly identical. Detect change by reading stops[].status, not by comparing payloads.

  4. Phone numbers are masked — never key on them

    Both driver and assistant phones are masked to the last 4 digits for privacy, so two people can produce the same value. Use driver.name as the identifier.

  5. Stop codes are stable but can skip numbers

    Internal administrative stops are removed from stops[] without renumbering the rest — so a route may legitimately arrive as PU, D2, D3 with no D1. This is intentional: it guarantees a stop never changes code between POSTs. Never infer count or order from the number.

  6. Statuses can move backwards

    Operational corrections can revise a stop after it looked final. Store the latest state rather than treating the first terminal status as immutable.

  7. Acknowledge before you process

    Return 200 as soon as the signature checks out, then do your work asynchronously. Processing inline risks the 10-second timeout, which we count as a failure and retry — turning one slow write into eight.

10

Test it yourself

Two ways to prove your receiver works before we send anything real — neither needs us to be involved.

A. Verify your signature code offline

This is a fixed test vector. Feed these exact values into your verification function; it must produce the signature below. Because it is deterministic, it makes a good unit test — no network, no waiting on us.

# secret
whsec_test_1234567890abcdef

# timestamp
1767225600

# raw body (exactly these bytes, no trailing newline)
{"route_id":"12345678","date":"2026-09-02","stops":[{"stop_code":"D1","status":"COMPLETED"}]}

# signed string = "<timestamp>.<raw body>", so:
1767225600.{"route_id":"12345678","date":"2026-09-02","stops":[{"stop_code":"D1","status":"COMPLETED"}]}

# EXPECTED — your code must produce exactly this
sha256=d928691debe063e90facecef72c2f6ce564f01c6f7127bad7cd7ff579dc8da45
If it does not match

Almost always one of three things: you signed the parsed-and-re-serialized JSON instead of the raw bytes; you forgot the . between timestamp and body; or you compared against the hex without the sha256= prefix.

B. Send a signed request to your own endpoint

Run this against your receiver — it builds a correctly-signed request exactly the way we do. Set SECRET to your signing secret and URL to your endpoint. A passing run means a real delivery will pass too.

Node.js — save as selftest.js, run with: node selftest.js
const crypto = require('crypto');

const URL_   = 'https://your-endpoint.example.com/ninja';
const SECRET = '<your signing secret>';

const payload = {
  route_id: 'SELFTEST-1', date: '2026-09-02',
  driver:    { name: 'SELFTEST DRIVER', phone: '******1234' },
  assistant: null,
  vehicle:   { type: '4W1.5T', plate: '1กก-1234' },
  stops: [{
    stop_code: 'D1', stop_type: 'DROP',
    location_name: 'Self test', address: 'Self test',
    window: null, planned: null,
    arrived_at: '2026-09-02T11:19:00', completed_at: '2026-09-02T11:22:00',
    status: 'COMPLETED',
    photos: { arrival: [], destination: [], goods: [], document: [] }
  }]
};

const raw = JSON.stringify(payload);
const ts  = Math.floor(Date.now() / 1000).toString();
const sig = 'sha256=' + crypto.createHmac('sha256', SECRET)
  .update(`${ts}.${raw}`).digest('hex');

fetch(URL_, {
  method: 'POST',
  headers: {
    'Content-Type':      'application/json',
    'X-Ninja-Event':     'stop.updated',
    'X-Ninja-Delivery':  'SELFTEST-1#D1',
    'X-Ninja-Timestamp': ts,
    'X-Ninja-Signature': sig,
  },
  body: raw,
}).then(async r => {
  const body = await r.text();
  console.log(`HTTP ${r.status}`, body.slice(0, 200));
  console.log(r.ok ? 'PASS — we would treat this as delivered'
                   : 'FAIL — this would be retried, 8 times, then given up');
});
What a passing run proves

Your endpoint is reachable over HTTPS, your signature check accepts a genuine request, and you answer 2xx in time. It does not prove you reject a forged one — flip a character in SECRET and re-run; you should get a 401.

C. Send one from the live system yourself

Your shipper portal, under API & Webhooks, has a Send test button. It fires a synthetic payload at your endpoint from the live system, signed with your real secret, and shows you the exact status, timing and response body we saw. That is the quickest way to settle a disagreement between your logs and ours — no need to ask us.

The payload is synthetic: a fabricated route, never one of your real ones. A test is also the thing that unlocks going live — see §11.

11

Go-live checklist

Work through this yourself in the portal. Nothing here needs a call with us — send a test whenever you are ready, and turn delivery on when it passes.

  • Endpoint is HTTPS, publicly reachable, and does not redirect.
  • Signature is verified against the raw request body, with a constant-time compare — checked against the test vector in §9.
  • The X-Ninja-Signature header is read as a comma-separated list, accepting the request if any entry matches.
  • Requests older than your chosen window (we suggest 5 minutes) are rejected.
  • Handler returns 200 within 10 seconds and processes asynchronously.
  • Deliveries are deduplicated on X-Ninja-Delivery, newest state winning.
  • All four statuses and all seven failure_reason values are handled.
  • Unknown fields and unknown enum values are ignored, not rejected.
  • Timestamps are parsed as Asia/Bangkok.
  • Photos are downloaded and stored within 24 hours of receipt.
  • Secret is in a secret store, not in source control.
  • Your verifier accepts either signature during a rotation, so you can rotate without a coordinated deploy (§3.1).
  • Send test in the portal returns 2xx — this is required before delivery can be turned on.
  • We have a contact for delivery failures.
Turning it on

Everything above is self-service in the API & Webhooks page of your shipper portal: set your endpoint, choose your events, generate your secret, send a test, and switch delivery on. Nothing is sent to you until you switch it on, and no history is backfilled — delivery starts from that moment forward.

One deliberate restriction: you cannot enable an endpoint that has never answered a test with a 2xx. Change the URL and that check resets, because the new address has not proved anything yet. It is the one guard standing between a typo and your customers' delivery data going somewhere unintended.

The portal also lists your recent deliveries with their status and error, and lets you re-queue a failed one. If you would rather we set this up for you, we still can — just ask. And we can render the exact JSON for any real route on request, so you can build against actual data.