06 Jul 2026

LTA DataMall API: The Complete Integration Guide (Auth, Gotchas, Examples)

LTA DataMall API: The Complete Integration Guide (Auth, Gotchas, Examples)

For developers building transit applications, smart city dashboards, or AI routing agents in Singapore, the LTA DataMall API is the definitive source of real time and static land transport data. Maintained by the Land Transport Authority (LTA), this open data platform provides programmatic access to bus arrival timings, taxi availability, traffic incidents, and ERP pricing.

Integrating public transport data into your application requires a precise understanding of the LTA DataMall authentication flow, rate limits, and OData conventions. This guide provides a builder to builder breakdown of the architecture, hidden implementation gotchas, and copy paste runnable code examples to accelerate your integration. You can register for your primary access keys directly at the official LTA DataMall portal.

LTA DataMall · Integration Map

OData, header auth, and the gotchas that will trip you up

Every request needs exactly two headers, pagination caps at 500 records, and HTTPS works even when docs say HTTP. Here's the integration map.

AccountKey

Your primary or secondary key from the LTA DataMall portal. Treat as a secret.

accept

Response format. Typically application/json.

curl · BusArrivalv2
# Always use HTTPS, even though docs reference HTTPcurl -X GET "https://datamall2.mytransport.sg/ltaodataservice/BusArrivalv2?BusStopCode=83139" \
  -H "accept: application/json" \
  -H "AccountKey: YOUR_API_KEY_HERE"

Developer · default

5 / sec

10,000 calls per day

Prototyping, local testing, internal tools

Silver

10 / sec

100,000 calls per day

Small-scale production apps

Gold

20 / sec

500,000 calls per day

Enterprise and commercial transit apps

Platinum · partner

Custom SLA

Unlimited (fair use)

Government and infrastructure routing

  • 01

    Pagination caps at 500 records

    Most dynamic endpoints return ≤50 records; static datasets return ≤500. Loop with $skip to fetch the full set.

  • 02

    Throttling returns HTTP 429

    Exceeding per-second or per-day limits triggers temporary IP and key bans. Implement exponential backoff.

  • 03

    Use HTTPS even if docs say HTTP

    The documented base URL is HTTP, but HTTPS is supported. Always append the s to encrypt payloads.

  • 04

    Cache dynamic, store static

    Bus arrivals change every 10–15 seconds; cache with TTL. Sync bus stops and routes to a local DB once daily via cron.

Understanding the LTA DataMall Ecosystem

The LTA DataMall operates on an OData (Open Data Protocol) v4 standard. This means the API follows strict conventions regarding resource querying, filtering, and pagination. The base endpoint structure for the API is http://datamall2.mytransport.sg/ltaodataservice.

All datasets are categorized into dynamic and static resources. Static resources, such as bus stops and route definitions, rarely change and are perfect for local database caching. Dynamic resources, such as bus arrivals and traffic CCTV images, update every minute and require high availability querying.

LTA DataMall · Integration Map

OData, header auth, and the gotchas that will trip you up

Every request needs exactly two headers, pagination caps at 500 records, and HTTPS works even when docs say HTTP. Here's the integration map.

Authentication

AccountKey

Your primary or secondary key from the LTA DataMall portal. Treat as a secret.

accept

Response format. Typically application/json.

curl · BusArrivalv2

# Always use HTTPS, even though docs reference HTTPcurl -X GET "https://datamall2.mytransport.sg/ltaodataservice/BusArrivalv2?BusStopCode=83139" \
  -H "accept: application/json" \
  -H "AccountKey: YOUR_API_KEY_HERE"

Access Tiers

Developer · default

5 / sec

10,000 calls per day

Prototyping, local testing, internal tools

Silver

10 / sec

100,000 calls per day

Small-scale production apps

Gold

20 / sec

500,000 calls per day

Enterprise and commercial transit apps

Platinum · partner

Custom SLA

Unlimited (fair use)

Government and infrastructure routing

Gotchas to wire around

  • 01

    Pagination caps at 500 records

    Most dynamic endpoints return ≤50 records; static datasets return ≤500. Loop with $skip to fetch the full set.

  • 02

    Throttling returns HTTP 429

    Exceeding per-second or per-day limits triggers temporary IP and key bans. Implement exponential backoff.

  • 03

    Use HTTPS even if docs say HTTP

    The documented base URL is HTTP, but HTTPS is supported. Always append the s to encrypt payloads.

  • 04

    Cache dynamic, store static

    Bus arrivals change every 10–15 seconds; cache with TTL. Sync bus stops and routes to a local DB once daily via cron.

datamall.lta.gov.sg →SingaporeAPI

API Authentication and Header Requirements

Unlike standard REST APIs that use Bearer tokens or OAuth2, the LTA DataMall API requires a simple but strict custom header authentication. You must pass your primary or secondary API key via the AccountKey HTTP header.

Every request requires exactly two headers:

  • AccountKey: Your unique API token generated from the LTA DataMall portal.

  • accept: The desired response format, typically application/json.

Developers must treat the AccountKey as a sensitive secret. LTA enforces strict rate limits per key. If your key is leaked and abused, your application will be throttled. If you suspect a compromise, you can instantly regenerate your Secondary Key in the developer portal while keeping your Primary Key active to prevent application downtime.

Common Integration Gotchas and Limitations

When consuming LTA transport datasets, developers frequently encounter edge cases that are not immediately obvious from the standard documentation. Ignoring these constraints will result in HTTP 429 errors or incomplete data sets.

1. The Pagination Limit of 500 Records

The LTA DataMall API truncates responses to a maximum of 50 records per request for most dynamic endpoints, and up to 500 records for static datasets. To retrieve the full dataset, you must implement loops utilizing the $skip OData parameter.

2. Strict Throttling Tiers

LTA enforces rate limiting based on the number of API calls per minute (or per day) depending on your subscription tier. Surpassing this limit triggers IP and key level temporary bans.

3. Hardcoded HTTP Endpoints

While many modern APIs enforce HTTPS, the LTA DataMall documentation often references HTTP endpoints. However, the API supports HTTPS. Developers should always append an 's' to https://datamall2.mytransport.sg to ensure payload encryption and prevent man in the middle attacks, especially when handling traffic data over public Wi-Fi networks.

Understanding the LTA DataMall Ecosystem

Data Tier Comparison and Rate Limits

Your LTA DataMall account is assigned a specific tier that dictates how much data you can poll. If you require higher limits, you must apply for a premium tier via the LTA developer portal. Below is a breakdown of the standard access tiers.

Tier Level

Calls Per Minute

Calls Per Day

Best Use Case

Developer (Default)

5 calls per second

10,000 calls

Prototyping, local testing, and internal tools

Silver

10 calls per second

100,000 calls

Small scale production applications with limited users

Gold

20 calls per second

500,000 calls

Enterprise applications and commercial public transit apps

Platinum (Partner)

Custom SLA

Unlimited (Fair Use)

Government integrations and massive scale infrastructure routing

Running API Requests: Practical Examples

Below are runnable curl examples for the most commonly requested LTA DataMall API endpoints. Replace YOUR_API_KEY_HERE with your actual AccountKey.

1. Fetching Bus Arrival Timings

The Bus Arrival API endpoint provides real time arrival predictions for a specific bus stop. The data refreshes approximately every 15 to 45 seconds.

curl -X GET "https://datamall2.mytransport.sg/ltaodataservice/BusArrivalv2?BusStopCode=83139" \
     -H "accept: application/json" \
     -H "AccountKey: YOUR_API_KEY_HERE"

Architecture Tip: If you are building an AI agent to monitor arrivals across multiple stops, consider using a managed proxy like the LTA DataMall Bus Arrival API to automatically handle rate limit backoffs and caching without exhausting your core LTA quota.

2. Retrieving Taxi Availability

This endpoint returns a list of coordinates (longitude and latitude) representing currently available taxis islandwide. The payload is massive and updates every minute.

curl -X GET "https://datamall2.mytransport.sg/ltaodataservice/TaxiAvailability" \
     -H "accept: application/json" \
     -H "AccountKey: YOUR_API_KEY_HERE"

3. Querying Traffic Incidents

Use the traffic incidents endpoint to feed your routing algorithm with roadworks, accidents, and heavy traffic warnings.

curl -X GET "https://datamall2.mytransport.sg/ltaodataservice/TrafficIncidents" \
     -H "accept: application/json" \
     -H "AccountKey: YOUR_API_KEY_HERE"

Advanced Querying: Pagination Implementation

To extract an entire static dataset (like all 5,000+ bus stops in Singapore), you must iterate through the data using the $skip parameter. Here is a working Python example demonstrating how to paginate through the BusStops endpoint reliably.

import requests

url = "https://datamall2.mytransport.sg/ltaodataservice/BusStops"
headers = {
    "accept": "application/json",
    "AccountKey": "YOUR_API_KEY_HERE"
}
all_bus_stops = []
skip_value = 0

while True:
    # Append the skip query parameter
    paginated_url = f"{url}?$skip={skip_value}"
    response = requests.get(paginated_url, headers=headers)
    
    if response.status_code != 200:
        print(f"Error: {response.status_code}")
        break
        
    data = response.json()
    bus_stops = data.get("value", [])
    
    if not bus_stops:
        # Break the loop if no more data is returned
        break
        
    all_bus_stops.extend(bus_stops)
    skip_value += len(bus_stops)
    
    print(f"Fetched {len(all_bus_stops)} bus stops...")

print(f"Total bus stops retrieved: {len(all_bus_stops)}")
API Authentication and Header Requirements

Architecting for AI Agents and High Availability

If you are building an autonomous AI agent or a high traffic mapping application, directly polling LTA DataMall endpoints on every user request is an anti pattern. You will exhaust your quota and introduce unnecessary latency to your application layer.

Implement a Caching Layer

Bus arrival times do not change significantly within 10 to 15 seconds. Implement an in memory cache like Redis or Memcached. When a request for a bus stop comes in, check the cache first. If the cache is empty or expired, hit the LTA DataMall API, store the result with a strict Time To Live (TTL) of 10 to 15 seconds, and serve the user.

Store Static Data Locally

Do not query static endpoints (Bus Routes, Bus Stops, Taxi Stands, Road Networks) during runtime. Write a background cron job to sync these endpoints to a local PostgreSQL or MongoDB database once a day. Query your internal database for routing logic to save thousands of unnecessary API calls.

Frequently Asked Questions (FAQ)

What happens if I exceed my LTA DataMall API rate limit?

If you exceed your allocated calls per second or calls per day, the LTA API gateway will return an HTTP 429 Too Many Requests status code. Your subsequent requests will be temporarily blocked until the rate limit window resets. You must implement exponential backoff logic in your code to handle HTTP 429 responses gracefully without crashing your application.

Does the LTA DataMall API support Webhooks or Server Sent Events (SSE)?

No. The LTA DataMall operates strictly on a request and response (polling) model. Developers must build polling infrastructure to check for updates. For dynamic data like bus arrivals and traffic camera feeds, you should adhere to the data's native refresh rate rather than spamming the endpoint.

How do I get my AccountKey for LTA DataMall?

You must register for an account at the official LTA DataMall portal. After verifying your email, log in and navigate to your profile dashboard. You will be provided with a Primary Key and a Secondary Key. Both keys map to the same account and quota limits. Use the Secondary Key for seamless key rotation if your Primary Key becomes compromised.

Is there a way to get historical transit data via the API?

The standard LTA DataMall API endpoints provide real time and near real time data. They do not store historical logs in the public access tier. For historical data analytics, researchers and enterprise users must refer to the LTA static datasets published on Data.gov.sg or contact LTA directly for custom data sharing agreements.

Conclusion

The LTA DataMall API provides a robust foundation for Singapore transit applications, mapping interfaces, and autonomous AI routing systems. By leveraging OData standards, managing your pagination properly, and strictly adhering to rate limit architectures, you can build resilient integrations. Always ensure you are caching dynamic data and storing static routing data locally to optimize your developer experience and application performance.

Sources