# SingaNow Full API & Tool Specification > Complete Machine-Readable API Reference, JSON Schemas, Function Calling Definitions, and Integration Manual for AI Agents & Developers. This document serves as the comprehensive technical companion to `llms.txt`. It contains exhaustive endpoint specifications, full JSON response structures, field dictionaries, error definitions, code examples, and copy-paste ready OpenAI / Anthropic / Gemini / MCP Tool schemas. - Base URL: `https://singanow.com/api` - Short Overview: `https://singanow.com/llms.txt` - Interactive Playground: `https://singanow.com/docs` - Default Protocol: HTTPS GET - Authentication: None required for public endpoints - CORS: Enabled (`*`) - Encoding: UTF-8 JSON --- ## 1. Domain Constants & Conventions ### Geographic Boundary - Country: Singapore (SG) - Latitude Range: `1.1500°N` to `1.4800°N` - Longitude Range: `103.5800°E` to `104.0500°E` - Central Reference Coords (City Hall / Raffles Place): `Lat: 1.2968, Lng: 103.8525` - Timezone: `Asia/Singapore` (`SGT`, `UTC+8`, formatted in ISO-8601 with `+08:00`) ### Public Transport Identifiers - **Bus Stop Code**: 5-digit zero-padded string (e.g. `"01012"`, `"09048"`, `"67009"`). - **Bus Service Number**: Case-insensitive alphanumeric string (e.g. `"10"`, `"65"`, `"190"`, `"960e"`, `"NR1"`). - **Bus Operators**: - `SBST`: SBS Transit - `SMRT`: SMRT Buses - `TTS`: Tower Transit Singapore - `GAS`: Go-Ahead Singapore - **Passenger Load Codes**: - `SEA` (Seats Available): High availability / Low crowding. - `SDA` (Standing Available): Moderate crowding / Standing room only. - `LSD` (Limited Standing): Heavy crowding / Bus approaching maximum capacity. - **Bus Vehicle Types**: - `SD`: Single Deck Bus - `DD`: Double Deck Bus - `BD`: Bendy / Articulated Bus - **Wheelchair Accessibility**: - `is_wab: true` or `Feature: "WAB"` indicates wheelchair boarding ramp equipped. ### ACRA UEN (Unique Entity Number) Formats - **Standard Company UEN** (10 chars): e.g. `201812345A` (Format: `YYYYNNNNNX`) - **Business Registration** (9 chars): e.g. `53123456B` (Format: `NNNNNNNNX`) - **Other Entities / LLPs / Societies / Healthcare** (10 chars): e.g. `T08LL0001B` (Format: `TyyPQNNNNX`) --- ## 2. API Endpoints Reference ### 2.1 GET /api/bus/arrival Retrieves real-time arrival predictions, passenger capacity loads, wheelchair accessibility, and next 3 buses for a specified bus stop. #### Query Parameters: | Parameter | Type | Required | Default | Description | Example | |---|---|---|---|---|---| | `stop` or `bus_stop_code` | string | Yes | — | 5-digit Singapore Bus Stop Code | `01012` | | `service` | string | No | — | Filter by specific bus service number | `190` | | `refresh` | boolean | No | `false` | Force live cache invalidation | `1` | #### Response Schema (JSON): ```json { "ok": true, "bus_stop_code": "01012", "stop_info": { "description": "Hotel Grand Pacific", "road_name": "Victoria St", "latitude": 1.2968482025, "longitude": 103.8525359194 }, "timestamp": "2026-08-17T20:20:00+08:00", "services": [ { "service_no": "190", "operator": "SMRT", "origin_code": "44009", "origin_name": "Choa Chu Kang Int", "origin_road": "Choa Chu Kang Loop", "destination_code": "03239", "destination_name": "New Bridge Rd Ter", "destination_road": "Eu Tong Sen St", "loop_desc": "", "has_arrivals": true, "status": "Operating", "buses": [ { "slot": 1, "estimated_arrival": "2026-08-17T20:23:45+08:00", "diff_seconds": 225, "minutes": 3, "text": "3 min", "load": { "label": "Seats Available", "level": "good", "color": "var(--clr-cap-green)", "icon": "🟢" }, "is_wab": true, "wab_text": "♿ Wheelchair Accessible", "type": "DD", "type_label": "Double Deck", "monitored": 1, "estimate_type": "Live estimate", "origin_code": "44009", "destination_code": "03239", "latitude": 1.3021, "longitude": 103.8560 }, { "slot": 2, "estimated_arrival": "2026-08-17T20:31:10+08:00", "diff_seconds": 670, "minutes": 11, "text": "11 min", "load": { "label": "Standing Available", "level": "moderate", "color": "var(--clr-cap-orange)", "icon": "🟡" }, "is_wab": true, "wab_text": "♿ Wheelchair Accessible", "type": "SD", "type_label": "Single Deck", "monitored": 1, "estimate_type": "Live estimate", "origin_code": "44009", "destination_code": "03239", "latitude": 1.3210, "longitude": 103.8640 } ] } ], "total_services": 1 } ``` --- ### 2.2 GET /api/bus/services List all registered Singapore public bus routes or retrieve detailed route stops for a single service. #### Query Parameters: | Parameter | Type | Required | Default | Description | Example | |---|---|---|---|---|---| | `service` or `no` | string | No | — | Lookup specific service with full directions & route sequences | `190` | | `q` | string | No | — | Filter service number or origin/destination keywords | `Jurong` | | `operator` | string | No | — | Filter by operator: `SBST`, `SMRT`, `TTS`, `GAS` | `SBST` | | `category` | string | No | — | Category: `TRUNK`, `FEEDER`, `EXPRESS`, `INDUSTRIAL` | `EXPRESS` | #### Response Schema (Single Service Lookup): ```json { "ok": true, "service": { "service_no": "190", "operator": "SMRT", "category": "TRUNK", "directions": [ { "service_no": "190", "operator": "SMRT", "direction": 1, "category": "TRUNK", "origin_code": "44009", "destination_code": "03239", "origin_name": "Choa Chu Kang Int", "destination_name": "Kampong Bahru Ter", "routes": [ { "service_no": "190", "operator": "SMRT", "direction": 1, "stop_sequence": 1, "bus_stop_code": "44009", "distance": 0.0, "wd_first_bus": "0530", "wd_last_bus": "2330", "sat_first_bus": "0530", "sat_last_bus": "2330", "sun_first_bus": "0545", "sun_last_bus": "2330", "stop_name": "Choa Chu Kang Int", "road_name": "Choa Chu Kang Loop", "latitude": 1.38586, "longitude": 103.74578 } ] } ] } } ``` --- ### 2.3 GET /api/bus/stops Search and inspect Singapore bus stops by stop code, road name, or description. #### Query Parameters: | Parameter | Type | Required | Default | Description | Example | |---|---|---|---|---|---| | `code` or `stop` | string | No | — | Exact 5-digit bus stop code lookup (includes calling services) | `01012` | | `q` or `query` | string | No | — | Keyword query matching description or road name | `Orchard` | | `limit` | integer | No | `30` | Max results (1 to 100) | `20` | #### Response Schema: ```json { "ok": true, "query": "Orchard", "total": 5, "stops": [ { "bus_stop_code": "09048", "road_name": "Orchard Rd", "description": "Orchard Stn/Tang Plaza", "latitude": 1.3045, "longitude": 103.8331, "services": ["36", "77", "124", "143", "167", "174", "190", "518", "972"] } ] } ``` --- ### 2.4 GET /api/bus/routes Retrieve sequential route stops, cumulative kilometer distances, and scheduled frequencies for a bus service. #### Query Parameters: | Parameter | Type | Required | Default | Description | Example | |---|---|---|---|---|---| | `service` or `no` | string | Yes | — | Bus Service Number | `65` | | `dir` or `direction` | integer | No | `1` | Direction: `1` (Outbound) or `2` (Inbound) | `1` | #### Response Schema: ```json { "ok": true, "service_no": "65", "direction": 1, "total_stops": 45, "stops": [ { "stop_sequence": 1, "bus_stop_code": "75009", "road_name": "Tampines Ave 4", "description": "Tampines Int", "distance_km": 0.0, "wd_first_bus": "0530", "wd_last_bus": "2345", "sat_first_bus": "0530", "sat_last_bus": "2345", "sun_first_bus": "0545", "sun_last_bus": "2345" } ] } ``` --- ### 2.5 GET /api/bus/nearby Search nearest bus stops from any GPS coordinate within a given radius. #### Query Parameters: | Parameter | Type | Required | Default | Description | Example | |---|---|---|---|---|---| | `lat` | float | Yes | — | WGS84 Latitude (Singapore: `1.15` to `1.48`) | `1.2968` | | `lng` | float | Yes | — | WGS84 Longitude (Singapore: `103.58` to `104.05`) | `103.8525` | | `radius` | float | No | `1.2` | Search radius in kilometers (0.1 to 10.0) | `1.0` | | `limit` | integer | No | `20` | Maximum results to return (1 to 50) | `15` | #### Response Schema: ```json { "ok": true, "is_outside_singapore": false, "is_fallback": false, "user_coords": { "lat": 1.2968, "lng": 103.8525 }, "radius_km": 1.0, "total": 8, "stops": [ { "bus_stop_code": "01012", "road_name": "Victoria St", "description": "Hotel Grand Pacific", "latitude": 1.296848, "longitude": 103.852536, "distance_km": 0.02, "distance_m": 20, "services": ["2", "7", "12", "32", "33", "51", "61", "63", "80", "175", "197"] } ] } ``` --- ### 2.6 GET /api/bus/planned Scheduled upcoming bus route diversions, road closures, and network service adjustments. #### Response Schema: ```json { "ok": true, "total_changes": 2, "changes": [ { "service_no": "111", "operator": "SBST", "direction": 1, "effective_date": "2026-09-01", "total_stops": 3, "stops": [ { "bus_stop_code": "08057", "road_name": "Orchard Blvd", "description": "Opp Orchard Stn Exit 13" } ] } ] } ``` --- ### 2.7 GET /api/weather Live 2-hour regional area weather forecast across 47 Singapore towns, 24-hour national forecast, 4-day outlook, and real-time station metrics. #### Response Schema: ```json { "ok": true, "generated": "2026-08-17T20:20:00+08:00", "forecast_2h": { "validPeriod": { "start": "2026-08-17T20:00:00+08:00", "end": "2026-08-17T22:00:00+08:00" }, "regions": [ { "area": "Ang Mo Kio", "forecast": "Partly Cloudy (Night)", "icon": "partly-cloudy" }, { "area": "Changi", "forecast": "Passing Showers", "icon": "showers" } ] }, "forecast_24h": { "forecast": "Passing Showers", "icon": "showers", "temp_low": 25, "temp_high": 32, "rh_low": 65, "rh_high": 95, "wind_speed_low": 10, "wind_speed_high": 25, "wind_direction": "SSE", "periods": [ { "time": "Night (18:00 to 06:00)", "regions": { "west": "Passing Showers", "east": "Partly Cloudy", "central": "Passing Showers", "south": "Passing Showers", "north": "Partly Cloudy" } } ] }, "outlook_4d": [ { "date": "2026-08-18", "forecast": "Thundery Showers", "icon": "thunderstorm", "temp_low": 24, "temp_high": 31, "rh_low": 70, "rh_high": 95, "wind_speed": 20, "wind_dir": "SE" } ], "stations": [ { "info": { "id": "S109", "name": "Ang Mo Kio Ave 5", "lat": 1.3764, "lon": 103.8492 }, "temp": 28.4, "rh": 78, "wind": 4.2, "rain": 0.0 } ] } ``` --- ### 2.8 GET /api/environment 24-hour National & Regional Pollutant Standards Index (PSI), 1-hour PM2.5 concentrations, and hourly UV index readings. #### PSI Rating Scales: - `0 - 50`: **Good** (Normal outdoor activities) - `51 - 100`: **Moderate** (Normal outdoor activities) - `101 - 200`: **Unhealthy** (Reduce prolonged strenuous outdoor physical exertion) - `201 - 300`: **Very Unhealthy** (Avoid strenuous outdoor exertion) - `> 300`: **Hazardous** (Stay indoors) #### UV Index Categories: - `0 - 2`: **Low** (Minimal sun protection required) - `3 - 5`: **Moderate** (Cover up, wear sunglasses) - `6 - 7`: **High** (Sunscreen SPF 30+, hat, seek shade during midday) - `8 - 10`: **Very High** (Extra protection needed) - `11+`: **Extreme** (Take all precautions, avoid midday sun) #### Response Schema: ```json { "ok": true, "generated": "2026-08-17T20:20:00+08:00", "psi": { "timestamp": "2026-08-17T20:00:00+08:00", "regions": { "national": { "psi_24h": 42, "category": "Good", "color": "good" }, "north": { "psi_24h": 40, "category": "Good", "color": "good" }, "south": { "psi_24h": 45, "category": "Good", "color": "good" }, "east": { "psi_24h": 43, "category": "Good", "color": "good" }, "west": { "psi_24h": 39, "category": "Good", "color": "good" }, "central": { "psi_24h": 44, "category": "Good", "color": "good" } } }, "pm25": { "timestamp": "2026-08-17T20:00:00+08:00", "regions": { "north": 12, "south": 15, "east": 14, "west": 11, "central": 13 } }, "uv": { "timestamp": "2026-08-17T18:00:00+08:00", "index": 1, "category": "Low", "trend": [ { "time": "2026-08-17T12:00:00+08:00", "value": 9 }, { "time": "2026-08-17T13:00:00+08:00", "value": 10 }, { "time": "2026-08-17T14:00:00+08:00", "value": 8 }, { "time": "2026-08-17T15:00:00+08:00", "value": 5 } ] } } ``` --- ### 2.9 GET /api/traffic Live expressway and checkpoint traffic camera images updated continuously. #### Checkpoint Camera IDs: - **Woodlands Checkpoint / Causeway**: - `2701`: Woodlands Causeway (Towards Johor) - `2702`: Woodlands Checkpoint (Immigration Hall) - `2703`: Woodlands Ave 2 (CTE Slip Road) - `2704`: BKE — Woodlands Flyover - `2705`: Woodlands Ave 2 (Towards Causeway) - `2706`: Kranji Way (Woodlands Approach) - **Tuas Second Link / Checkpoint**: - `4703`: Second Link at Tuas (Towards Malaysia) - `4704`: Tuas Checkpoint (Arrival Lanes) - `4713`: Tuas Checkpoint (Departure Lanes) - `4709`: Second Link Toll Plaza #### Response Schema: ```json { "ok": true, "generated": "2026-08-17T20:20:00+08:00", "total": 87, "categories": { "Woodlands Checkpoint": [ { "id": "2701", "imageUrl": "https://images.data.gov.sg/api/traffic-images/2026/08/2701_123456.jpg", "timestamp": "2026-08-17T20:19:40+08:00", "lat": 1.4440, "lon": 103.7689, "label": "Woodlands Causeway (Towards Johor)", "description": "Woodlands Checkpoint — Causeway departure lanes towards Johor Bahru" } ], "PIE": [ { "id": "5798", "imageUrl": "https://images.data.gov.sg/api/traffic-images/2026/08/5798_123456.jpg", "timestamp": "2026-08-17T20:19:35+08:00", "lat": 1.3320, "lon": 103.8680, "label": "PIE — Woodsville Interchange", "description": "Pan-Island Expressway (PIE) — Woodsville Close, Potong Pasir area" } ] } } ``` --- ### 2.10 GET /api/carparks Real-time parking lot vacancy, GPS nearby distance calculation, and available lot breakdowns across 2,600+ HDB, LTA (shopping malls & commercial hubs), and URA carparks nationwide. #### Query Parameters: | Parameter | Type | Required | Default | Description | Example | |---|---|---|---|---|---| | `lat` | float | No | — | User latitude for nearby distance ranking | `1.2938` | | `lng` | float | No | — | User longitude for nearby distance ranking | `103.8532` | | `radius` | float | No | `1.5` | Search radius in km (0.1 to 15.0 km) | `1.5` | | `query` | string | No | — | Filter carpark ID, development/mall name, or area | `Orchard` | | `agency` | string | No | `ALL` | Filter agency (`ALL`, `HDB`, `LTA`, `URA`) | `LTA` | | `lot_type` | string | No | `ALL` | Filter lot type (`ALL`, `C`, `Y`, `H`) | `C` | | `sort` | string | No | `distance` | Sort field (`distance`, `available`, `pct`) | `distance` | | `page` | integer | No | `1` | Page number | `1` | #### Response Schema: ```json { "ok": true, "generated": "2026-08-20T11:00:00+08:00", "is_nearby": true, "is_outside_singapore": false, "user_coords": { "lat": 1.2938, "lng": 103.8532 }, "radius_km": 1.5, "query": "", "agency": "ALL", "lot_type": "ALL", "page": 1, "perPage": 40, "total": 48, "summary": { "totalCarparks": 48, "totalLots": 18450, "totalAvailable": 9210, "overallPct": 50 }, "carparks": [ { "id": "3", "name": "Raffles City", "area": "Marina", "agency": "LTA", "lat": 1.29382, "lng": 103.85319, "distance_km": 0.0, "distance_m": 2, "lots": null, "available": 462, "pct": null, "status": "Available", "color": "green", "lot_types": { "C": { "available": 462, "total": 0 } } } ] } ``` --- ### 2.11 GET /api/ev Real-time electric vehicle (EV) charging stations, live plug availability, fast DC & AC charging power, and tariffs across major Singapore operators. #### Query Parameters: | Parameter | Type | Required | Default | Description | Example | |---|---|---|---|---|---| | `lat` | float | No | — | User latitude for nearby distance ranking | `1.3045` | | `lng` | float | No | — | User longitude for nearby distance ranking | `103.8335` | | `radius` | float | No | `2.5` | Search radius in km (0.1 to 25.0 km) | `2.5` | | `query` | string | No | — | Filter station name, mall, estate, or postal code | `Orchard` | | `operator` | string | No | `ALL` | Filter operator (`ALL`, `SP_MOBILITY`, `CDG_ENGIE`, `CHARGE_PLUS`, `SHELL`, `TESLA`, `KEPPEL_VOLT`, `TOTALENERGIES`) | `SP_MOBILITY` | | `speed` | string | No | `ALL` | Filter power speed (`ALL`, `ULTRA_FAST`, `FAST_DC`, `AC_NORMAL`) | `ULTRA_FAST` | | `connector` | string | No | `ALL` | Filter connector type (`ALL`, `CCS2`, `TYPE2`, `TESLA`) | `CCS2` | | `page` | integer | No | `1` | Page number | `1` | #### Response Schema: ```json { "ok": true, "generated": "2026-08-20T13:30:00+08:00", "is_nearby": true, "is_outside_singapore": false, "radius_km": 2.5, "query": "Orchard", "total": 6, "summary": { "totalStations": 6, "totalPlugs": 34, "totalAvailable": 22, "overallPct": 65, "fastDcCount": 5, "ultraFastCount": 3 }, "stations": [ { "id": "EV-SP-001", "name": "SP Mobility — ION Orchard", "address": "2 Orchard Turn, Basement 4 Carpark, Singapore 238801", "area": "Orchard / CBD", "operator": "SP_MOBILITY", "operator_name": "SP Mobility", "lat": 1.3040, "lng": 103.8319, "total_plugs": 6, "available": 4, "status": "Available", "color": "green", "pct": 67, "max_speed_kw": 50, "has_ultra_fast": false, "has_fast_dc": true, "connector_types": ["CCS2", "TYPE2"], "pricing_ac": "$0.592/kWh", "pricing_dc": "$0.685/kWh", "parking_info": "Standard Mall Parking Rates apply", "distance_km": 0.25, "distance_m": 250 } ] } ``` --- ### 2.12 GET /api/acra Search corporate entities, companies, businesses, LLPs, societies, and healthcare institutions across Singapore regulatory registries. #### Query Parameters: | Parameter | Type | Required | Default | Description | Example | |---|---|---|---|---|---| | `q` or `query` | string | Yes | — | Search term: Company Name or UEN | `DBS Bank` | | `page` | integer | No | `1` | Page number (24 entities per page) | `1` | #### Response Schema: ```json { "ok": true, "query": "DBS Bank", "page": 1, "limit": 24, "total": 1, "entities": [ { "uen": "196800306E", "name": "DBS BANK LTD.", "type": "Public Company Limited By Shares", "status": "Live Company", "agency": "ACRA", "issue_date": "1968-07-16", "street": "MARINA BOULEVARD", "postal": "018982", "full_address": "Blk 12, MARINA BOULEVARD, #40-00, MARINA BAY FINANCIAL CENTRE, Singapore 018982", "constitution": { "business": null, "company": "Public Company Limited By Shares", "paf": null }, "filing": { "annual_return": "2026-04-30", "account_due": "2026-09-30" }, "ssic_primary": { "code": "64120", "description": "Full banks", "user_desc": "Commercial Banking Operations" }, "ssic_secondary": { "code": "64190", "description": "Other monetary intermediation", "user_desc": null }, "no_of_officers": "12", "former_names": ["THE DEVELOPMENT BANK OF SINGAPORE LIMITED"], "audit_firms": [ { "name": "PRICEWATERHOUSECOOPERS LLP", "uen": "T09LL0001D" } ] } ] } ``` --- ## 3. Tool Calling & Agent Schemas (OpenAI / Claude / Gemini / MCP) Below are ready-to-use function calling specifications. You can copy these directly into your LLM tool configurations. ```json [ { "type": "function", "function": { "name": "get_singapore_bus_arrivals", "description": "Fetch real-time bus arrivals, passenger crowding (SEA/SDA/LSD), and wheelchair accessibility for a specific 5-digit Singapore bus stop code.", "parameters": { "type": "object", "properties": { "bus_stop_code": { "type": "string", "description": "The 5-digit bus stop code in Singapore (e.g. '01012', '09048', '67009')." }, "service_no": { "type": "string", "description": "Optional service number to filter (e.g. '190', '10', '65')." } }, "required": ["bus_stop_code"] } } }, { "type": "function", "function": { "name": "find_nearby_singapore_bus_stops", "description": "Locate the nearest bus stops and walking distances in kilometers from GPS coordinates in Singapore.", "parameters": { "type": "object", "properties": { "latitude": { "type": "number", "description": "WGS84 Latitude between 1.15 and 1.48 (e.g. 1.2968)." }, "longitude": { "type": "number", "description": "WGS84 Longitude between 103.58 and 104.05 (e.g. 103.8525)." }, "radius_km": { "type": "number", "description": "Search radius in km (default 1.2, max 10.0)." } }, "required": ["latitude", "longitude"] } } }, { "type": "function", "function": { "name": "search_singapore_bus_stops", "description": "Search Singapore bus stops by road name, landmark name, or stop code.", "parameters": { "type": "object", "properties": { "query": { "type": "string", "description": "Search term (e.g. 'Orchard', 'Bedok Int', 'Victoria St', '01012')." } }, "required": ["query"] } } }, { "type": "function", "function": { "name": "get_singapore_weather", "description": "Retrieve live Singapore 2-hour regional nowcast, 24-hour national forecast, 4-day outlook, and live climate station readings (temperature, rainfall, humidity).", "parameters": { "type": "object", "properties": {} } } }, { "type": "function", "function": { "name": "get_singapore_environment_air_quality", "description": "Get real-time Singapore 24-hour PSI air quality, 1-hour PM2.5 readings, and UV index by region.", "parameters": { "type": "object", "properties": {} } } }, { "type": "function", "function": { "name": "get_singapore_traffic_cameras", "description": "Get live traffic camera image snapshot URLs for Singapore expressways (PIE, CTE, AYE, etc.) and Malaysia border checkpoints (Woodlands Causeway, Tuas).", "parameters": { "type": "object", "properties": {} } } }, { "type": "function", "function": { "name": "search_singapore_acra_entity", "description": "Search Singapore registered companies, businesses, LLPs, and societies by name or UEN.", "parameters": { "type": "object", "properties": { "query": { "type": "string", "description": "Corporate entity name or UEN (e.g. 'DBS Bank', 'Grab', '201812345A')." }, "page": { "type": "integer", "description": "Page number (default: 1)." } }, "required": ["query"] } } }, { "type": "function", "function": { "name": "get_singapore_carpark_availability", "description": "Check real-time parking lot availability, GPS distance, and vacancy rates across Singapore HDB, URA, and LTA commercial shopping mall carparks.", "parameters": { "type": "object", "properties": { "query": { "type": "string", "description": "Optional carpark code, development/mall name (e.g. 'Suntec', 'Orchard'), or estate." }, "lat": { "type": "number", "description": "Optional GPS latitude for nearby carpark search." }, "lng": { "type": "number", "description": "Optional GPS longitude for nearby carpark search." }, "radius": { "type": "number", "description": "Optional search radius in km (e.g. 1.5)." } } } } }, { "type": "function", "function": { "name": "get_singapore_ev_charging_points", "description": "Search real-time EV charging stations and live plug availability across SP Mobility, CDG ENGIE, Charge+, Shell Recharge, Tesla Superchargers, and HDB hubs in Singapore.", "parameters": { "type": "object", "properties": { "query": { "type": "string", "description": "Station name, shopping mall, operator, or 6-digit postal code (e.g. 'Orchard', 'Tesla', '529510')." }, "operator": { "type": "string", "description": "Filter operator ('ALL', 'SP_MOBILITY', 'CDG_ENGIE', 'CHARGE_PLUS', 'SHELL', 'TESLA', 'KEPPEL_VOLT', 'TOTALENERGIES')." }, "speed": { "type": "string", "description": "Filter speed ('ALL', 'ULTRA_FAST' >=120kW, 'FAST_DC' 50-100kW, 'AC_NORMAL' 7.4-22kW)." }, "lat": { "type": "number", "description": "Optional GPS latitude for distance ranking." }, "lng": { "type": "number", "description": "Optional GPS longitude for distance ranking." } } } } } ] ``` --- ## 4. Integration Code Snippets ### Python 3 (using `requests` or `httpx`) ```python import requests BASE_URL = "https://singanow.com/api" def get_bus_arrivals(stop_code: str, service_no: str = None): params = {"stop": stop_code} if service_no: params["service"] = service_no resp = requests.get(f"{BASE_URL}/bus/arrival", params=params, timeout=10) resp.raise_for_status() return resp.json() def search_companies(query: str): resp = requests.get(f"{BASE_URL}/acra", params={"q": query}, timeout=10) resp.raise_for_status() return resp.json() def get_live_weather(): resp = requests.get(f"{BASE_URL}/weather", timeout=10) resp.raise_for_status() return resp.json() # Example usage: if __name__ == "__main__": hotel_grand_pacific = get_bus_arrivals("01012") print(f"Stop: {hotel_grand_pacific['stop_info']['description']}") for s in hotel_grand_pacific["services"]: if s["has_arrivals"]: next_bus = s["buses"][0] print(f"Bus {s['service_no']}: arriving in {next_bus['text']} ({next_bus['load']['label']})") ``` ### TypeScript / JavaScript (using modern `fetch`) ```typescript interface BusArrivalResponse { ok: boolean; bus_stop_code: string; stop_info: { description: string; road_name: string; latitude: number; longitude: number; }; services: Array<{ service_no: string; operator: string; has_arrivals: boolean; buses: Array<{ slot: number; text: string; minutes: number; load: { label: string; level: string }; is_wab: boolean; type_label: string; }>; }>; } async function fetchBusArrivals(stopCode: string, serviceNo?: string): Promise { const url = new URL("https://singanow.com/api/bus/arrival"); url.searchParams.set("stop", stopCode); if (serviceNo) url.searchParams.set("service", serviceNo); const res = await fetch(url.toString(), { headers: { Accept: "application/json" } }); if (!res.ok) throw new Error(`HTTP Error ${res.status}`); return res.json(); } ``` ### cURL ```bash # 1. Bus Arrivals at Hotel Grand Pacific (01012) curl -s "https://singanow.com/api/bus/arrival?stop=01012" | jq . # 2. Search ACRA Registered Businesses curl -s "https://singanow.com/api/acra?q=Singtel" | jq . # 3. Live Weather Nowcasts & Stations curl -s "https://singanow.com/api/weather" | jq . # 4. Air Quality PSI & PM2.5 curl -s "https://singanow.com/api/environment" | jq . # 5. Nearby Bus Stops from GPS coordinates (City Hall) curl -s "https://singanow.com/api/bus/nearby?lat=1.2968&lng=103.8525&radius=0.8" | jq . ```