BYTETOOLS

Cloudflare Trace API

Free Cloudflare trace endpoint with no key: your IP, country, data centre, TLS version, HTTP protocol and user agent as plain text. Instant, no signup. Tested.

No API key requiredCORS enabledHTTPSFree tier

Endpoint tested and returned HTTP 200 on 2026-08-20

What is the Cloudflare Trace API?

The Cloudflare trace endpoint is a free, key-free diagnostic that returns your public IP address, country, the Cloudflare data centre serving you, TLS version, HTTP protocol and user agent as simple key=value plain text.

This endpoint exists on every Cloudflare-fronted site at `/cdn-cgi/trace`, which means it is available almost everywhere and backed by Cloudflare's global network — it is about as reliable as a diagnostic endpoint gets.

It tells you more than an IP lookup: the `colo` field reveals which Cloudflare data centre served you as an IATA airport code, and `tls` and `http` show the actual protocol versions negotiated. That combination is genuinely useful for debugging CDN and connectivity issues.

Quick facts

Base URL
https://www.cloudflare.com/cdn-cgi/trace
Authentication
No API key required.
Rate limit
No published limit — it is served at the edge.
Pricing
Free.
CORS
Enabled — callable directly from browser JavaScript
Official docs
Read the docs

How to use the Cloudflare Trace API

Every request below was executed against the live API on 2026-08-20, and the response shown is the real body it returned — not an illustration.

1. Get connection and location diagnostics

GET https://www.cloudflare.com/cdn-cgi/trace

curl
curl 'https://www.cloudflare.com/cdn-cgi/trace'
JavaScript (fetch)
const res = await fetch("https://www.cloudflare.com/cdn-cgi/trace");
if (!res.ok) throw new Error(`Request failed: ${res.status}`);
const data = await res.json();
console.log(data);
Python (requests)
import requests

res = requests.get("https://www.cloudflare.com/cdn-cgi/trace", timeout=20)
res.raise_for_status()
print(res.json())
Response — HTTP 200
fl=179f23
h=www.cloudflare.com
ip=182.185.143.210
ts=1787176672.000
visit_scheme=https
uag=ByteTools-APIDirectory/1.0 (+https://bytetools.bytevancer.com; contact@bytevancer.com)
colo=KHI
sliver=none
http=http/1.1
loc=PK
tls=TLSv1.3
sni=plaintext
warp=off
gateway=off
rbi=off
kex=X25519MLKEM768

Parameters

ParameterTypeRequiredDescription
(none)pathOptionalThe endpoint takes no parameters. Available on any Cloudflare-fronted domain.

Response fields

(plain text)text
Newline-separated key=value pairs, not JSON. Split on newlines then on '='.
ipstring
Your public IP address.
locstring
Two-letter country code, derived at the edge.
colostring
Cloudflare data centre IATA code, e.g. LHR — which POP served you.
tlsstring
Negotiated TLS version, e.g. TLSv1.3.
httpstring
HTTP protocol version, e.g. http/2 or http/3.
uagstring
Your user agent string as received.
tsstring
Server timestamp.

What you can build with the Cloudflare Trace API

  • Detect a visitor's country without an IP geolocation service
  • Debug which CDN edge location is serving a user
  • Check whether HTTP/3 and TLS 1.3 are actually negotiated
  • Build a lightweight connection diagnostics page

Common errors and how to fix them

JSON parse error

The response is plain text, not JSON.

Fix: Split on newlines, then on the first '=' in each line.

loc is missing

Country detection occasionally fails.

Fix: Fall back to a geolocation API rather than assuming the field is present.

CORS blocked in the browser

The endpoint does not send CORS headers.

Fix: Call it from your server, or use your own Cloudflare-fronted domain's /cdn-cgi/trace, which is same-origin.

Cloudflare Trace API — frequently asked questions

What is /cdn-cgi/trace?

A diagnostic endpoint Cloudflare exposes on every site behind its network, returning your IP, country, the serving data centre, TLS version and HTTP protocol as plain text.

Is it free?

Yes, free with no API key. It is served at Cloudflare's edge with no meaningful rate limit.

What is the colo field?

The IATA airport code of the Cloudflare data centre that served your request — LHR for London, for example. It is genuinely useful for diagnosing CDN routing.

Can I call it from my own site?

Yes, if your site is behind Cloudflare, your own domain's /cdn-cgi/trace is same-origin, which sidesteps the CORS restriction on the cloudflare.com endpoint.

Tools that pair with this API

Cloudflare Trace is an independent third-party service and is not affiliated with ByteTools or ByteVancer. Details on this page were verified on 2026-08-20; always check the official documentation before relying on this API in production, as terms and limits can change.