403 with cf-mitigated challenge
A public API returned 403 to every request I made, with cf-mitigated: challenge in the headers and a 5 KB HTML body instead of JSON. Headers, proxies and HTTP clients did not help. The fix is to let a real Chrome solve the challenge, read cf_clearance out of that browser over the DevTools protocol, and replay it. Two details matter: the cookie is bound to the browser's User-Agent, and the API host has its own challenge separate from the site host.
The paid post has the three DevTools calls, the exact Network.getCookies payload, and the before/after measurement.
Comments