How do I get a cURL command from my browser?

Modern browsers can export any network request as a cURL command through their developer tools.

Step-by-step process:

  1. Open DevTools (F12 or right-click → Inspect)
  2. Navigate to the Network tab
  3. Perform the action that triggers the request you want to replicate (submit a form, click a button, etc.)
  4. Find the request in the network log
  5. Right-click it
  6. Select "Copy as cURL" (Chrome/Edge) or "Copy as cURL (POSIX)" (Firefox)

This copies a complete cURL command to your clipboard including:

  • All headers
  • Cookies
  • Authentication tokens
  • Request body

What gets captured:

The exported cURL command captures the exact request your browser sent, including headers that might not be visible in the browser UI:

  • CSRF tokens
  • Session cookies
  • Custom authentication headers
  • Content negotiation headers

Common use cases:

  • Reverse-engineering web APIs that lack documentation
  • Debugging authentication issues
  • Replicating complex multi-step workflows
  • Understanding how a web application communicates with its backend

Next steps:

Once you have the cURL command, use a converter to translate it into your programming language of choice, preserving all the critical details like cookies and headers that are often the difference between successful and failed API requests.

Related Questions