Answer

What is the TWSE OpenAPI? A guide to the common endpoints

The TWSE OpenAPI is the Taiwan Stock Exchange's open-data interface — no registration, no API key, a plain HTTP GET returns a JSON array. OTC data comes from a separate set of TPEx endpoints. Two shared traits are worth knowing up front: dates are ROC-calendar strings, and most endpoints return a latest-period snapshot rather than a queryable history.

Getting started

Endpoints look like https://openapi.twse.com.tw/v1/opendata/{code} and need no authentication. The response is a JSON array, one element per row. The OTC equivalents live at https://www.tpex.org.tw/openapi/v1/{code}. A useful first step is to save one response to a file and read the fields, because the naming is not consistent between the two markets.

curl -s "https://openapi.twse.com.tw/v1/opendata/t187ap03_L" | head -c 300

Commonly used endpoints

  • t187ap03_L — listed company profiles (full name, industry code, business number, officers). The OTC counterpart is mopsfin_t187ap03_O.
  • t187ap05_L — listed companies' monthly operating revenue, with prior-month and year-ago figures and percentage changes.
  • tpex_mainboard_daily_close_quotes (TPEx) — OTC mainboard daily closing quotes, with OHLC and traded volume.

Three things every endpoint shares

  • ROC-calendar dates: a date field of 1150730 means the 115th ROC year, 30 July — add 1911 for the Gregorian year.
  • Snapshots, not history: most open-data endpoints return the whole market for the latest period, with no date parameter. History is accumulated by polling and storing.
  • Two separate APIs: listed and OTC data sit on different domains with different field-naming conventions, so cross-market analysis needs a mapping you maintain.

Terms of use and quotas

Request quotas, terms of use and any format changes are whatever TWSE and TPEx officially announce — that is the authoritative source. The responses carry no explicit rate-limit headers, so throttle your own calls and add retries and caching rather than polling aggressively.

Per-endpoint detail

Each page below carries runnable examples, the full field list, the limits observed when calling it directly, and what to do instead when you need history or both markets at once.

Related