Malaysia Transit Logo

Malaysia Transit API

Developer Portal

Real-time Transit Data for Malaysia

Access live bus locations, schedules, and route information across multiple transit providers in Malaysia. One API, complete coverage.

Real-time Vehicle Tracking

Live GPS positions updated every 30 seconds

Complete Schedule Data

Timetables for all routes and stops

Multi-Provider Coverage

Rapid KL, BAS.MY, Rapid Penang, and more

Free API access

No payment, credit card or subscription required. Sign in to generate your API keys.

Access public endpoints with operational rate limits and upstream provider limits to keep the service available.

Get your free API keys

Sign in with Google or GitHub to generate and manage free API keys

By signing in, you agree to the Terms of Service

Or explore the API first, no sign-in needed:

Frequently Asked Questions

Is the Malaysia Transit API free?

Yes. API access is free, with no payment, credit card or subscription required. The API processes transit feeds into a convenient interface for your applications.

I handle all the complexity so you don't have to:

  • Process real-time feeds
  • Calculate arrival predictions
  • Aggregate multiple providers
  • Maintain reliable servers

Plus, features the raw GTFS feeds don't include:

  • Shape-based ETA predictions (40-60% more accurate) with time-of-day adjustments and confidence scoring
  • Fare calculator for BAS.MY (distance-based), Rapid Penang (staged), KTM Komuter Utara (matrix), and Penang Ferry, plus multi-leg journey fares
  • Multi-modal journey planner combining bus, rail, ferry, and walking with route polylines and shareable plans
  • Non-GTFS providers integrated: Bas Muafakat Johor (41 PAJ-tracked routes) and Penang Ferry schedules
  • Clean REST/JSON instead of protobuf zips. CORS-friendly, works from any language or browser
  • Smart geocoding and nearby-stop search (e.g. "Penang Airport" resolves to live arrivals at the nearest stop)
  • GitHub backup fallback when upstream data.gov.my has hiccups

Public data remains attributed to its original sources. Operational rate limits and acceptable-use rules help keep the shared service available.

What transit providers are covered?

I cover 13 service areas across Malaysia: Klang Valley, Penang, Ipoh, Seremban, Melaka, Johor Bahru, Kuching, Kota Bharu, Kuala Terengganu, Alor Setar, and Kangar (11 live), plus Kuantan (maintenance) and Kota Kinabalu (coming soon).

Providers include:

  • Rapid KL (LRT, MRT, Monorail, bus, MRT feeder bus)
  • Rapid Penang
  • All BAS.MY operators (state-funded bus services)
  • KTM Komuter Utara and KTM Intercity
  • Bas Muafakat Johor (BMJ)
  • Penang Ferry (Butterworth ↔ Georgetown)

Will my existing API keys keep working?

Existing active keys continue working without payment or renewal. Previously replaced or deactivated keys remain invalid. You can generate or rotate keys for free from your dashboard.

Is there a rate limit?

Yes. Operational rate limits and abuse controls apply, including endpoint-specific limits for journey planning and place searches. Handle HTTP 429 responses with backoff and follow Retry-After when provided. Upstream data providers also impose limits. .

How do I use the API key?

Include your API key in the X-API-Key header with every request. Example: X-API-Key: mtk_pub_your_key. After signing in you can generate two free keys from the dashboard: a public one (mtk_pub_*) for browsers and a secret one (mtk_sec_*) for server-side use.

Can I safely use the API key in a browser or SPA?

Yes. Every account can generate a public and secret key pair from the dashboard:

  • Public key (mtk_pub_*) for browser/SPA use. Pair it with an Allowed Origins allowlist so a key scraped from your bundle is useless on any other site.
  • Secret key (mtk_sec_*) for server-side integrations: ChatGPT custom GPTs, Zapier, n8n, your backend. Keep it off the wire to browsers.
  • Legacy mtk_live_* keys still work and auto-classify based on whether allowed origins are set.

Origin patterns support exact hosts (https://app.com), single-label wildcards (https://*.app.com), and Netlify preview wildcards (https://*--myapp.netlify.app). The dashboard surfaces a lifetime + last-7-days reject counter so you can spot key leaks.

Honest framing: origin restriction stops browser-scraped key reuse, not header-forging scripted clients. For full theft protection, keep keys out of public bundles and proxy through a backend.

Who manages this developer dashboard?

I'm Aliff, and I develop and maintain this Malaysia Transit Middleware and its API under TechMavie Digital. Learn more about what I do on TechMavie Digital by .

API at a Glance

A quick reference of the public REST endpoints. Sign in to your dashboard for worked curl examples and live usage stats.

Base URL

https://malaysiatransit.techmavie.digital/api

Most endpoints accept an ?area= query parameter to scope the request to a service area.

Authentication

X-API-Key: mtk_live_your_key

Send your key in the X-API-Key header on every request. Keys are generated for free on the dashboard after signing in.

Areas & Status

  • GET /areas — list all service areas
  • GET /areas/:areaId — service area details
  • GET /areas/:areaId/providers/status — per-provider health

Real-time Tracking

  • GET /realtime?area= — live vehicle positions
  • GET /stops/:stopId/arrivals?area= — arrivals at a stop
  • GET /stops/nearby/arrivals?lat=&lng=&area= — nearby stops with arrivals
  • GET /stops/nearby/routes?lat=&lng=&area= — nearby stops with routes

Routes & Stops

  • GET /routes?area= — list routes
  • GET /routes/:routeId?area= — route details
  • GET /routes/:routeId/geometry?area= — route shape
  • GET /stops/search?area=&q= — search for stops
  • GET /stops/:stopId?area= — stop details

Schedules

  • GET /schedules/routes/:routeId/departures?area= — departures from origin
  • GET /schedules/routes/:routeId/next?area= — next departure
  • GET /schedules/stops/:stopId/routes?area= — routes serving a stop
  • GET /schedules/routes/:routeId/full?area= — full weekly timetable

KTM (Komuter & Intercity)

  • GET /ktm/stations — list KTM stations
  • GET /ktm/stations/:name/departures — station departures
  • GET /ktm/schedules — full KTM timetable
  • GET /ktm/komuter/fare?from=&to= — Komuter fare lookup
  • GET /ktm/komuter/fare-matrix — full Komuter fare matrix
  • GET /ktm/intercity/fare?from=&to= — Intercity fare lookup

Penang Ferry

  • GET /ferry/penang — service overview
  • GET /ferry/penang/schedule — daily schedule
  • GET /ferry/penang/next?from= — next departure
  • GET /ferry/penang/terminals — terminal info
  • GET /ferry/penang/fare — fare table

Fares & Journey Planning

  • GET /fare/structures — fare model per area (staged vs. distance)
  • GET /fare/:area/routes — fare-eligible routes
  • GET /fare/:area/calculate — single-leg fare
  • GET /fare/:area/calculate-journey — multi-leg fare
  • GET /journey/areas — areas supported by the planner
  • POST /journey/plan — plan a multi-modal journey

Service Area IDs

Use these IDs in the ?area= query parameter.

klang-valleypenangipohserembanmelakajohorkuchingkota-bharukuala-terengganualor-setarkangarkuantan*kota-kinabalu**

* Under maintenance (pending Rapid Kuantan → BAS.MY transition).  ** Coming soon.

Looking for live transit information?

Use the live transit site to plan your journey, or connect an AI assistant through the MCP server. These tools and developer API access are free.

Scroll up to sign in and get your API key

Note: The Malaysia Transit Live Middleware and other whitelisted TechMavie Digital-associated applications have built-in access to the API. If you're building your own application, sign in to generate your own free API keys.