PASAR API

🇲🇾 Live train positions ~ KTMB (GTFS-R)

← directory
KTMB via data.gov.myRealtimetier: openauth: no authpricing: freefreq: REALTIME

Response is GTFS-realtime Protobuf, not JSON ~ decode with a GTFS-RT library. Feed is empty outside operating hours.

More Realtime APIs

Call it

curl 'https://api.data.gov.my/gtfs-realtime/vehicle-position/ktmb'

AI prompt

I'm building an app using a free Malaysia API (no auth needed).

API: Live train positions ~ KTMB (GTFS-R)
Provider: KTMB via data.gov.my
Endpoint: GET https://api.data.gov.my/gtfs-realtime/vehicle-position/ktmb
It returns JSON (live data).

Source: KTMB via data.gov.my (https://api.data.gov.my/gtfs-realtime/vehicle-position/ktmb)
Source type: Official public feed
Endpoint type: Public feed, non-JSON
Integration difficulty: Copy-paste ready
Production caveat: Still handle downtime, changing fields, empty responses, and rate limits before shipping user-facing alerts.

Help me fetch this and build a simple page that displays it nicely. Include basic production safeguards for errors, empty responses, schema changes, caching, and rate limits.

Related Realtime APIs

7-day weather forecast (live)Weather warnings (live)Earthquake warnings (live)River water levels & flood warnings (live)Transit schedules ~ Rapid KL LRT/MRT/monorail/bus (Prasarana GTFS)Train schedules ~ KTMB (GTFS)Live bus positions ~ Rapid KL & Rapid Penang (Prasarana GTFS-R)Bus schedules ~ myBAS Johor Bahru (GTFS)Live bus positions ~ myBAS Johor (GTFS-R)BMKG Earthquake & Tsunami Feed ~ real-time Indonesia seismic data