The basic workflow
Open DevTools, switch to the Network tab, filter to Fetch/XHR. Perform the user action you want to scrape (load a page, scroll, search). Look through the requests for ones returning structured JSON containing the data you want. Right-click the request and "Copy as cURL" — you now have a known-good baseline. Paste into a script, confirm it works, then start removing headers one by one to find the minimum required set.
Handling auth and CSRF
Most internal APIs require either a session cookie, a CSRF token from the initial page, or an auth header. Session cookies: hit the public page first, capture the cookie, reuse it. CSRF tokens: parse the token out of the initial HTML (usually a meta tag or a hidden form input), include it in subsequent API calls. Bearer tokens: log in once via the public flow, capture the token, refresh as needed.
When reverse-engineering fails
Some endpoints sign requests with HMAC computed in obfuscated JS, attach device-attestation tokens that require running the page's JS VM, or are only available to the mobile app via TLS pinning. In those cases the cost of reverse-engineering exceeds the cost of rendering the page in a real browser — fall back to that. Mobile API endpoints are a separate category and usually need MITM proxy work (Mitmproxy, Charles) on a real device.
