12go Public Travel Read API
Live, read-only access to 12go's public location typeahead and date-specific train results. Start with location discovery using familiar text, pass returned canonical slugs to train search, and use returned booking links only as source references. No login, booking, cart, seat hold, or other website mutation is performed. The source feed is a complete date-specific response without a verified cursor.
Endpoint health
Loading verification…
Connect your agent
Connect through MCP so your agent can find this API, read its docs, and call its endpoints.
Add the server from your terminal.
claude mcp add --transport http agent-data https://agent-data.motie.dev/mcpIn Claude Code, run /mcp, select agent-data, then Authenticate. Sign in to your agent-data account in the browser.
Then ask your agent to use the 12go Public Travel Read API for your task.
Call it over HTTP
Get an API keySign up free, generate an API key, and set it as AGENT_DATA_API_KEY in your environment. Your first 100 calls each month are free.
curl --request GET --get 'https://3kpkg0jfvk.execute-api.us-east-2.amazonaws.com/prod/f7650ef8-8f81-48e6-9f40-6bbf9b7f3d47/v1/locations/search' \
--header "Authorization: Bearer $AGENT_DATA_API_KEY" \
--data-urlencode 'query=Bangkok'Endpoints
Inputs and response fields for every endpoint in this API.
GETSearch locations/v1/locations/search
Resolve familiar free text through 12go's live typeahead. Results retain source ordering and candidate distinctions such as city, airport, and station. Select a returned `slug` and pass it unchanged as `origin` or `destination` to `search-trains`; do not infer a slug from the display name. An empty list means the source returned no candidates for this query.
Input
queryRequiredQuery · stringPartial or natural-language location text accepted by 12go typeahead.
Example: Bangkok
Response
querystringtotalintegerlocationsobject[]locations[].idstringlocations[].code?string | nulllocations[].name?string | nulllocations[].slugstringlocations[].aliases?string | nulllocations[].country?string | nulllocations[].name_en?string | nulllocations[].type_id?string | nulllocations[].local_name?string | nulllocations[].type_value?string | nulllocations[].source_kind?string | nulllocations[].country_code?string | nulllocations[].country_slug?string | nullFields marked ? are optional.
GETSearch trains/v1/trains/search
Search the date-specific public 12go feed for two canonical location slugs. Obtain those slugs from `search-locations` so cities, airports, and stations are not conflated. Every source trip whose structured vehicle-class list contains `train` is retained, including non-bookable rows; class options already present in the response remain nested. There is no local pagination or hidden per-result detail fetch.
Input
dateRequiredQuery · string (date)Travel date in ISO format YYYY-MM-DD as interpreted by 12go's date-specific feed.
Example: 2026-11-13
originRequiredQuery · stringCanonical 12go origin slug returned by search-locations, for example `bangkok`.
Example: bangkok
destinationRequiredQuery · stringCanonical 12go destination slug returned by search-locations, for example `chiang-mai`.
Example: chiang-mai
Response
totalintegertrainsobject[]trains[].idstringtrains[].originstringtrains[].classesobject[]trains[].classes[].pricenumber | nulltrains[].classes[].photos?unknown[]trains[].classes[].rating?number | nulltrains[].classes[].baggage?objecttrains[].classes[].baggage.icon?string | nulltrains[].classes[].baggage.value?integer | number | nulltrains[].classes[].baggage.message?string | nulltrains[].classes[].bookablebooleantrains[].classes[].class_idinteger | nulltrains[].classes[].currencystring | nulltrains[].classes[].features?unknown[]trains[].classes[].amenities?unknown[]trains[].classes[].class_namestring | nulltrains[].classes[].buy_options?object[]trains[].classes[].buy_options[].date?string | nulltrains[].classes[].buy_options[].date2?string | nulltrains[].classes[].buy_options[].date3?string | nulltrains[].classes[].buy_options[].to_id?integer | nulltrains[].classes[].buy_options[].from_id?integer | nulltrains[].classes[].buy_options[].trip_id?string | nulltrains[].classes[].ticket_type?string | nulltrains[].classes[].booking_linkstring | nulltrains[].classes[].cancellation?integer | nulltrains[].classes[].rating_count?integer | nulltrains[].classes[].sales_sorting?integer | nulltrains[].classes[].available_seatsinteger | nulltrains[].classes[].confirmation_time?integer | nulltrains[].classes[].full_refund_untilstring | nulltrains[].classes[].bookings_last_month?integer | nulltrains[].classes[].cancellation_message?string | nulltrains[].classes[].confirmation_message?string | nulltrains[].classes[].confirmation_minutes?integer | nulltrains[].classes[].is_generally_refundable?boolean | nulltrains[].classes[].is_api_cancellation_policy_applied?boolean | nulltrains[].bookablebooleantrains[].operatorstring | nulltrains[].destinationstringtrains[].operator_idinteger | nulltrains[].arrival_timestringtrains[].booking_linkstring | nulltrains[].train_numberstring | nulltrains[].departure_timestringtrains[].available_seatsinteger | nulltrains[].duration_minutesinteger | nulltrains[].availability_reasonstring | nullFields marked ? are optional.
Don’t see the endpoint you need?
Ask agent-data to add an endpoint or return more fields. Extensions are free and keep existing endpoints working.
An account is required to submit an extension. Prepare your request, then sign in to build.