AI Agent Hub
Back to skills
Juhe Data Train Ticket Query icon

Juhe Data Train Ticket Query

Life Service Updated 2026.08.30

Paste the following prompt into your AI chat to install this skill:

Please follow https://skillhub.cn/install/skillhub.md to install @user_c3477421/juhe-train-ticket

About this skill

Problem Addressed

Frontend and automation flows often need stable train data for a route, while scraping passenger-facing sites is brittle. This skill wraps the Juhe Data train query API so you can request schedules between two stations and receive structured fields such as trains, departure and arrival times, duration, fares, remaining seats, and booking status.

How It Works

  • Calls https://apis.juhe.cn/fapigw/train/query using GET / POST with JSON responses.
  • Uses search_type=1 for Chinese station names or search_type=2 for three-letter station codes from the bundled station mapping.
  • Supports filter codes such as G, D, Z, T, K, F, S, and O, plus departure_time_range by early morning, morning, afternoon, or night.
  • Returns train_no, departure_time, arrival_time, duration, prices, num, enable_booking, and train_flags for comparison or pre-booking UIs.

Boundaries

  • Queries are limited to 15 days from the current date; historical dates are not supported.
  • Requires a Juhe Data API Key and remains subject to plan-based QPS and daily call limits.
  • Remaining-seat num can be “有”, a number, or “无”; it is not a final payment confirmation.
  • For error 281701, check station name format first or retry with the station code.

Use Cases

  • When building a trip reminder, query train times for a 15-day window and filter afternoon departures.
  • When building a travel comparison page, query G/D trains, duration, second-class fares, and remaining seats.
  • When building a customer support tool, convert user route and date inputs into API parameters and return bookable trains.
  • When a station name fails, look up the bundled station code, retry with station_code, and log error_code and reason.

Best For

  • Backend engineers building trip or support bots who need stable train schedules and fares within 15 days.
  • Full-stack developers building travel pages who need to filter G, D, Z, T, and K trains by time range.
  • Data engineers building dashboards who need train, remaining-seat num, and train_flags as structured inputs.
  • Operations engineers maintaining API gateways who need to handle key permissions, QPS limits, and 281701 retries.