TCPLab TCPLab

Plain-text API

Last updated: 2026-10-15

Two endpoints return text/plain instead of JSON, for use from the command line. Both are tied to the requester and send Cache-Control: no-store.

These endpoints do not return JSON, so the code convention and the JSON rate limits in the API documentation do not apply to them.

GET /

The homepage. When the User-Agent starts with curl/, it returns the visitor's IP instead of the HTML page; any other client gets the normal page. The IPv6 mirror v6.tcp.lc returns the visitor's IPv6 address instead (it is IPv6-only, so it needs IPv6 connectivity).

# IPv4
curl tcp.lc

# IPv6
curl v6.tcp.lc
203.0.113.7

GET /text

Returns the visitor's own IP and geolocation on a single line, {ip},{location}. location merges country, province, city, district and ISP with ·, skipping empty values. Country names are in English; mainland region names come from the Chinese database and stay in Chinese. Private or reserved addresses return the IP only, without a trailing comma. The line ends with a newline.

# IPv4
curl tcp.lc/text

# IPv6
curl v6.tcp.lc/text
8.8.8.8,United States
114.114.114.114,China · 江苏 · 南京 · 114DNS
2001:4860:4860::8888,United States