Developers
Webhooks
A webhook sends an event to an https address of yours the moment it happens, so your systems do not have to ask. Your company administrator adds the address in the portal, on the Outgoing webhooks page, chooses its events, and a second administrator of your company approves it before anything is sent. This needs a plan that includes API access and outgoing webhooks.
The address's signing secret is shown once, when it is created. Store it safely. It can be replaced from the portal, and for a time both the previous and the new secret sign, so a change loses nothing.
What arrives
Each event is one POST with a JSON body: id is the delivery's own uuid, type names the event, api_version is v1, created_at is when it happened (ISO 8601 with an offset) and data carries the same record the API reference shows for that kind of record, so the code that reads the API reads it too. The portal offers an address only the events whose data its administrator may read.
{
"id": "8b2e6f40-1c93-4d57-a0e8-6f3b9c1d2a75",
"type": "trip.status_changed",
"api_version": "v1",
"created_at": "2026-06-01T10:40:00+03:00",
"data": { "uuid": "0b6f6d0e-6a3c-4a53-9d0a-3b0e8f6c1a11", "...": "..." }
}
Each request carries these headers: X-Twi-Event (the type), X-Twi-Delivery (the delivery id, the same as id in the body), X-Twi-Timestamp (Unix seconds) and X-Twi-Signature. A repeat you asked for also carries X-Twi-Replay-Of, the id of the delivery it repeats.
X-Twi-Event: trip.status_changed
X-Twi-Delivery: 8b2e6f40-1c93-4d57-a0e8-6f3b9c1d2a75
X-Twi-Timestamp: 1780299600
X-Twi-Signature: v1=<hex>
Events you can receive
The events below are the ones your company may subscribe to today; the administrator chooses them for each address on the Outgoing webhooks page. The permission column is the one your key or your administrator needs to read the same thing in the API; an event is sent only to an address whose company holds it.
| Event type | What it tells you | Permission | Payload versions | Fields of the data |
|---|---|---|---|---|
alert.closed | An alert closed | alerts:read | 1, 2 | ref, type, severity, status, vehicle_uuid, occurred_at, acknowledged_at, closed_at, close_cause, updated_at, branch_uuid |
alert.opened | An alert opened | alerts:read | 1, 2 | ref, type, severity, status, vehicle_uuid, occurred_at, acknowledged_at, closed_at, close_cause, updated_at, branch_uuid |
assistance.case.opened | A roadside case of the company was opened | assistance:cases:read | 2 | uuid, vehicle_uuid, status, symptom, urgency, can_move, need, outcome, expected_resume_at, opened_at, closed_at, created_at, updated_at |
assistance.case.progressed | A roadside case of the company moved to a new step | assistance:cases:read | 2 | uuid, vehicle_uuid, status, symptom, urgency, can_move, need, outcome, expected_resume_at, opened_at, closed_at, created_at, updated_at |
device.changed | A device was added or changed | devices:read | 2 | uuid, status, imei, device_brand, device_model, serial_number, telecom_company_name, sim_expires_on, warranty_expires_on, branch_uuid, vehicle_uuid, installed_on, installations, archived_at, created_at, updated_at |
device.offline | A device went offline | devices:read | 2 | uuid, kind, label, state, last_seen_at, changed_at, vehicle_uuid, branch_uuid |
device.online | A device came online | devices:read | 2 | uuid, kind, label, state, last_seen_at, changed_at, vehicle_uuid, branch_uuid |
driver.changed | A driver was added or changed | drivers:read | 2 | uuid, status, full_name, mobile_number, nationality_country_code, branch_uuid, employer_operator_uuid, individual_operator_uuid, readiness, archived_at, created_at, updated_at |
geofence.entered | A vehicle entered a geofence you switched on | geofences:read | 2 | ref, geofence_uuid, vehicle_uuid, driver_uuid, entered_at, exited_at, dwell_exceeded, branch_uuid |
geofence.exited | A vehicle left a geofence you switched on | geofences:read | 2 | ref, geofence_uuid, vehicle_uuid, driver_uuid, entered_at, exited_at, dwell_exceeded, branch_uuid |
invoice.changed | An invoice was issued or changed | billing:read | 2 | uuid, number, series, status, currency, subtotal_minor, tax_minor, total_minor, balance_minor, credited_minor, issue_date, due_date, created_at |
licence.expiring | A licence is about to expire | licences:read | 2 | uuid, licence_type, holder, vehicle_uuid, driver_uuid, operator_uuid, issuer, issue_date, expiry_date, validity, branch_uuid, created_at, updated_at |
maintenance.due | A maintenance plan is due soon or overdue | maintenance:read | 2 | uuid, vehicle_uuid, name, plan_type, category_code, every_km, every_days, baseline_km, baseline_at, status, created_at, updated_at, row_version |
market.booking.carrier_progress | A booking of the carrier moved to a new step | market:bookings:read | 2 | uuid, request_uuid, departure_uuid, state, arrived_pickup_at, left_pickup_at, arrived_dropoff_at, delivered_at, delivered_via, loading_evidence, transit_evidence, arrival_evidence |
market.booking.shipper_progress | A booking of the shipper moved to a new step | market:bookings:read | 2 | uuid, request_uuid, departure_uuid, state, arrived_pickup_at, left_pickup_at, arrived_dropoff_at, delivered_at, delivered_via, loading_evidence, transit_evidence, arrival_evidence |
order.status_changed | An order was made or changed state | orders:read | 2 | uuid, reference, status, status_correction, shipper_uuid, shipper_name, service_type, cargo_type, cargo_weight_kg, cargo_volume_m3, quantity, quantity_unit, pickup_city, pickup_address, pickup_latitude, pickup_longitude, dropoff_city, dropoff_address, dropoff_latitude, dropoff_longitude, pickup_from, pickup_until, due_by, agreed_price_minor, currency, cancel_reason, branch_uuid, created_at, updated_at |
registration.state_changed | A registration changed state | any key | 1, 2 | entity_kind, imei, plate, sequence_number, old_state, new_state, reason_code, occurred_at |
source.recovered | A tracking platform link recovered | devices:read | 2 | uuid, kind, label, state, last_seen_at, changed_at, vehicle_uuid, branch_uuid |
source.unhealthy | A tracking platform link became unhealthy | devices:read | 2 | uuid, kind, label, state, last_seen_at, changed_at, vehicle_uuid, branch_uuid |
trip.status_changed | A trip was made or changed state | trips:read | 2 | uuid, reference, status, vehicle_uuid, driver_uuid, order_uuids, planned_from, planned_until, dispatched_at, loading_at, started_at, delivered_at, closed_at, cancelled_at, cancel_reason, branch_uuid, created_at, updated_at |
vehicle.changed | A vehicle was added or changed | vehicles:read | 2 | uuid, status, sequence_number, plate_number, plate_right_letter, plate_middle_letter, plate_left_letter, plate_type, latin_plate, vin, make, make_code, model, model_code, model_version_code, variant_code, manufacture_year, type, class, category, body_type, colour, ownership_type, display_name, capacity_value, capacity_unit, fuel_consumption_l_per_100km, equipment_serial_number, hours_meter_reading, coupling_type, max_combination_weight_kg, thumbnail_url, branch_uuid, legal_operator_uuid, archived_at, created_at, updated_at |
wasl.report_result | A report to the regulator got a result | any key | 1, 2 | event_id, event_type, imei, plate, sequence_number, result, result_code, occurred_at |
webhook.test | Test message | any key | 1, 2 | message, sent_at |
Check the signature
Compute HMAC-SHA256, in hex, with your signing secret over the timestamp, a full stop and the raw body exactly as received, before any parsing. X-Twi-Signature holds one v1=<hex> value for each secret in force, separated by commas: accept the request when any of them equals yours, comparing in constant time.
import hashlib, hmac, time
def is_valid(secret: str, raw_body: bytes, timestamp: str, signature_header: str) -> bool:
if abs(time.time() - int(timestamp)) > 300:
return False
expected = hmac.new(secret.encode(), timestamp.encode() + b"." + raw_body, hashlib.sha256).hexdigest()
return any(
hmac.compare_digest(expected, part[3:])
for part in signature_header.split(",")
if part.startswith("v1=")
)
Reject a request whose timestamp is more than 5 minutes from your clock, so a captured request cannot be sent again later. Treat the delivery id as the event's identity and ignore an id you have already handled: an event can arrive more than once.
Answer and retries
Answer with any 2xx status within 10 seconds; the connection must open within 5 seconds. The body of your answer is not read or kept.
Anything else is a failure. A timeout, a connection error, 408, 425, 429 and any 5xx are tried again, 7 tries in all, after 1 min, 5 min, 30 min, 2 h, 6 h, 24 h; then the delivery is given up. Any other answer, such as 400 or 404, is not tried again.
Repeated failures in a row pause the address, and a 410 pauses it at once; the administrators of your company are told. Events that happen while it is paused wait and are sent when it is resumed, unless the person who resumes it chooses to give them up. An address that now points somewhere that is not allowed is paused too, for its administrators to look at.
What is kept
Each delivery is queued, sending, delivered or abandoned, with every try it took: when it started, how long it took, and the HTTP status or a failure code such as timeout, connect_failed or http_500. A delivery and its tries are kept for 30 days unless the platform sets another period, then removed. What an event carried is never shown in the log or by the API.
Events about money keep arriving at the registered address after the person who created it loses their permission, until a company administrator changes the address or removes it.
Look after your addresses with a key
A company key can carry one permission that is not a reading one: platform:webhooks:manage. With it a system of yours can see your addresses and their deliveries, pause and resume an address, send it a test, and send a finished delivery again. It cannot add an address, change one, approve one or replace a secret, and it never shows a secret: those stay in the portal, with a password and a second administrator.
Only a company-wide administrator can issue it, on the API keys page, with their password, on a plan with API access and outgoing webhooks. It lasts 30 or 90 days, and a company holds at most 2 of them live; every administrator of the company is told when one is issued. It stops working at once when its owner no longer qualifies, for example after a branch limit, a plan change or a role change.
GET /webhook-endpoints and /webhook-endpoints/{uuid} show the addresses your company added: name, where they point (the query string and any long token-like part of the path are hidden), their events, state, why one is paused and when it last succeeded or failed. An address the Tawasul team made for you is not listed. GET /webhook-deliveries and /webhook-deliveries/{uuid} show the events sent, which you can filter by endpoint, status, event_type and created_since, with each try.
curl -H "Authorization: Bearer <YOUR_COMPANY_KEY>" "https://tawasulone.com/api/v1/webhook-endpoints?status=paused"
POST /webhook-endpoints/{uuid}/pause and /resume (resume with abandon_queued true gives up what waited instead of sending it), POST /webhook-endpoints/{uuid}/test and POST /webhook-deliveries/{uuid}/replay. Every one needs an Idempotency-Key header, may carry a reason of 3 to 200 characters that is kept in your audit trail only, and answers 409 with a reason word when the state does not allow it: not_active, not_paused, not_finished, endpoint_not_active, not_replayable, replay_expired or replay_limit. A record of another company, one the Tawasul team made, or one that does not exist answers 404 alike.
curl -X POST -H "Authorization: Bearer <YOUR_COMPANY_KEY>" -H "Idempotency-Key: <A_NEW_UNIQUE_VALUE>" -H "Content-Type: application/json" -d '{"reason": "Partner maintenance window"}' "https://tawasulone.com/api/v1/webhook-endpoints/<ADDRESS_UUID>/pause"
A test message is sent at once, is limited to 10 an hour and 5 a minute for an address, and answers 429 with Retry-After beyond that.
A replay is a new delivery of the same event to the same address: it has its own id in X-Twi-Delivery, is marked with X-Twi-Replay-Of naming the delivery it repeats, and is signed with the address's current secret. Only a delivered or abandoned delivery of an active address, from the last 30 days, can be replayed, a test or a replay itself cannot, one delivery can be replayed 3 times, and one address takes 20 replays an hour (429 with Retry-After beyond that).
curl -X POST -H "Authorization: Bearer <YOUR_COMPANY_KEY>" -H "Idempotency-Key: <A_NEW_UNIQUE_VALUE>" "https://tawasulone.com/api/v1/webhook-deliveries/<DELIVERY_UUID>/replay"
Every change a key makes is recorded with the key that made it, and the administrators of your company are told when a key pauses or resumes an address.