SHANGHAI METRO API
Shanghai Metro API Data Retrieval Script Documentation (上海地铁线API)
Usage
Making a HTTP request via a web browser or API Platform etc. Postman.
The following parameters are accepted:
departure_id
To specific desired departure station id
• Station ID. Etc. 0926
destination_id
To specific desired destination station id
• Station ID. Etc. 0737
ticket
To specific desired ticket type
• ‘0’ for metro-card
• ‘1’ for one-way ticket
day
To specific desired day
•‘MONTOTHUR_0’ for Monday to Thursday
•‘FRIDAY_0’ for Friday
•‘SATURDAY_0’ for Saturday
•‘WEEKEND_0’ for Sunday
time
To specific desired time to enter or leave metro in second
• Time to enter or leave metro in second. Etc. 22:44 = ((22*60) +44) *60)
= 82740
line
To specific desired line number
• Line number. Etc. 1
stat_id
To specific desired station id
• Station ID. Etc. 0926
stat_name
To specific desired station name
• Station Name. Etc. JiuTing
download
To download the JSON output
• This parameter does not require the content, Leave empty or Type anything is acceptable
Depending on the parameters provided, the script will construct a URL to fetch information from Shanghai-Metro API
Parameter Guidelines
departure_idParameter:If you provide a valid
departure_idparameter of departure station etc. '0926', the script will retrieve information of selected departure station id.
destination_idParameter:If you provide a valid
destination_idparameter of destination station etc. '0737', the script will retrieve information of selected destination station id.
ticketParameter:If you provide a valid
ticketparameter as '0' or '1', the script will retrieve information of selected ticket.
dayParameter:If you provide a valid
dayparameter as 'MONTOTHUR_0', 'FRIDAY_0', 'SATURDAY_0' or 'WEEKEND_0’, the script will retrieve information of selected day.
timeParameter:If you provide a valid
timeparameter of entering or arriving metro etc. '82740', the script will retrieve information of selected time.
lineParameter:If you provide a
lineparameter of metro line etc. '1', the script will retrieve information of selected line.
stat_idParameter:If you provide a
stat_idparameter of station etc. '0926', the script will retrieve information of selected station id.
stat_nameParameter:If you provide a valid
stat_nameparameter of station etc. 'JiuTing', the script will retrieve information of selected station name.
downloadParameter:If you want to download the JSON output of these parameters, define the download parameter with empty or any input will able you to auto download it.
Station ID
Refer this https://api.kosontechnology.com/json/station-ID.json to find your station ID.
Below is a sample how you will see station ID at 'key' value:
Find station name and you will see station ID at top column.

API
Retrieve all metro line number information: All Line Number
Retrieve all metro line timetable: All Line Timetable
Retrieve last line timetable: Last Line Timetable
Retrieve history based on metro line: Line History
Retrieve metro line colour: Line Colour
Retrieve all metro station information: All Station Information
Retrieve metro station based on metro line: Search Station With Line
Retrieve metro station based on station id: Search Station With Station ID
Retrieve metro station information based on station name: Search Station With Station Name
Retrieve last station timetable: Last Station Timetable
Estimate arrival time: Estimate Arrival Time
Check ticket price: Check Price
Check route: Check Route
Last updated