RideKit
Docs/Reference/Compliance: reporting to TGA, the operator's licences, and who is driving

Compliance: reporting to TGA, the operator's licences, and who is driving

Built: 2026-11-02. For the operator, and for whoever maintains the code.

Saudi Arabia's 2025 executive regulation for passenger-transport apps (decision 6/18 of 2025) asks three things of an operator. This page covers all three:

  1. A technical link to the Transport General Authority (TGA). Drivers, vehicles and trips are reported to the TGA platform.
  2. Papers in date. The operator holds:
    • a commercial registration covering the activity;
    • valid GOSI and Zakat certificates;
    • a trademark certificate for the app;
    • the TGA licence itself.
  3. Saudi drivers. App-based passenger transport is for Saudi nationals. See docs/driver-eligibility.md.

Everything is under Admin → Compliance, in the Operations menu.

Reporting to TGA

TGA gives its interface specification to a licensed operator at onboarding. It is not public. RideKit sends a stable, documented record (shapes below) to the endpoint you enter under Admin → Providers → TGA:

Field What to put
Endpoint base URL From TGA onboarding (https)
API key / bearer token From TGA
Operator licence or ID The ID TGA issued you; sent as X-Operator-Id
Send records true to turn sending on

How it works:

  • Every 5 minutes RideKit looks at the drivers, vehicles and finished trips that changed since the last look. Each record is queued only if it differs from what was last sent. On the first run, trips from the past 7 days are sent.
  • Every minute queued records are sent, up to 500 a run, drivers first, then vehicles, then trips.
  • When TGA refuses a record (a 4xx answer), it is kept as Refused together with TGA's answer. Fix the data, then press Send again.
  • When TGA is down (a 5xx answer or the network), the record is retried after 1, 2, 4… minutes, up to 6 hours apart. After 8 tries it is marked Refused.
  • Check and send now runs both steps at once.

Each request is POST {base}/drivers|vehicles|trips with:

  • headers: Authorization: Bearer <key>, X-Operator-Id, and an Idempotency-Key built from the record and its content;
  • body: { operatorId, record }.
Record Fields
Driver externalId, name, phone, gender, nationalId, idHolder, licenceExpiresOn, status (active / pending / suspended)
Vehicle externalId, driverExternalId, plate, make, model, year, color, category, insuranceExpiresOn, inspectionExpiresOn, status
Trip externalId, driverExternalId, vehicleExternalId, status, requestedAt, startedAt, endedAt, cancelledAt, cancelledBy, pickup, dropoff, distanceKm, fare {amountMinor, currency}, paymentMethod

A trip carries nothing about the rider. Map these fields to TGA's own names on your side, or in a thin adapter in compliance/regulator-records.ts.

Not built: WASL live vehicle telemetry (position and speed streamed to Elm). It needs an Elm contract and its own feed. The TGA operating card per vehicle is not built either.

Licences and certificates

The licences table lists the five papers a Saudi operator must hold. One that is not on file shows Required, not on file with an Add button.

Each licence keeps:

  • number, issuer, issue date and expiry date;
  • a copy (PDF or image, stored privately).

Each licence shows one of these states:

State Meaning
Valid Expires more than 30 days from today
Expiring soon Expires within 30 days
Expired Past its expiry date
No expiry date No expiry date recorded

Dates are compared in the market's own day.

Who is driving

Active drivers who are citizens shows how many verified, active drivers have a Saudi National ID on file, how many have an Iqama, and how many have no ID recorded.

Legal check needed. Confirm with TGA at onboarding and with local counsel:

  • TGA's actual interface, the fields it wants, and how often;
  • whether WASL telemetry applies to your fleet;
  • the exact papers your licence requires.

For developers

Piece Where
Record shapes, hash, retry rules backend/src/compliance/regulator-records.ts
Collect + send (crons), admin reads compliance/regulator.service.ts
Licence rules compliance/licences.ts
Licence storage compliance/licences.service.ts
API /admin/compliance/summary, /regulator/records, /regulator/records/:id/retry, /regulator/run, /licences (+ /:id, /:id/file)
Data regulator_records, regulator_state, operator_licences (migration 123)
Admin app/(dashboard)/compliance/page.tsx; Providers → TGA
Tests compliance/compliance.spec.ts

Tested end to end in Chrome, with the install switched to Saudi Arabia and a stand-in TGA endpoint (scratchpad/tga-mock.mjs). The stand-in requires the bearer key, refuses drivers with no national ID, and fails the first trip once.

  • Before set-up: "Not set up", Check and send now disabled, and 5 licences missing.
  • Set-up: the keys were entered through Providers → TGA.
  • First run:
    • 5 vehicles and 61 trips were sent;
    • the trip that hit the 503 waited for its retry;
    • 4 drivers were refused with TGA's message;
    • every request carried the key and operator ID;
    • no trip carried any rider field.
  • Send again: re-queued the record, and it was sent again.
  • Licences:
    • adding the TGA licence (20 days left) showed Expiring soon;
    • reversed dates were refused;
    • a lapsed CR showed Expired;
    • the PDF copy was uploaded and opened;
    • the KPI counted 3 missing + 1 expired = 4.

This feature has no mobile screens, so the emulator and simulator were not used.

Dev note: this install is not onboarded, so every backend restart re-detects the country as IN. Set it back to SA after a restart when testing.

source: docs/regulator-sync.md (ships identically in the product zip)