bugmark_

guide

How to copy a request as cURL in Chrome

Chrome can turn any request in the Network panel into a ready-to-run cURL command, with the same URL, method, headers, cookies and body the page sent. It is the fastest way to replay a failing API call outside the browser or hand it to a backend developer. Here is how to do it, which variant to pick, and how to remove secrets first.

Add to Chrome — freeUpdated October 13, 2026 · 7 min read
Network tab showing a failed POST /api/payments/intents with its JSON request payload and redacted card fields

Quick answer

Copy as cURL in Chrome

Open DevTools (F12, or Cmd+Option+I on Mac), select the Network panel and reload or repeat the action. Right-click the request in the Name column, hover over Copy and choose Copy as cURL. On Windows, choose Copy as cURL (bash) for Git Bash or WSL, or Copy as cURL (cmd) for Command Prompt. Paste into a terminal and press Enter.

How to copy as cURL, step by step

  1. Open DevTools on the page that makes the request: F12 or Ctrl+Shift+I on Windows and Linux, Cmd+Option+I on Mac.
  2. Select the Network panel. If it is hidden, click the >> overflow arrow in the tab bar, or press Ctrl+Shift+P (Cmd+Shift+P) and type "network".
  3. Trigger the request. The panel only records while DevTools is open, so reload the page or repeat the click or form submit. Check Preserve log if the action redirects.
  4. Find the request. Click Fetch/XHR in the filter bar to hide images and scripts, or type part of the URL in the filter box. Failed requests show their status in red.
  5. Right-click the request in the Name column and hover over Copy.
  6. Choose the format. Copy as cURL on Mac and Linux. On Windows, Copy as cURL (bash) or Copy as cURL (cmd). The command goes to your clipboard.
  7. Paste and run it in a terminal. You should get the same response the browser received.

The same Copy submenu has Copy all as cURL, which copies every request in the list as a chain of commands. With a filter active it becomes Copy all listed as cURL. Requests to blob: URLs cannot be copied because they only exist inside the browser.

What the copied command contains

A copied command for a JSON API call in current Chrome looks like this (shortened):

curl --url 'https://api.example.com/v1/orders?limit=20' \
  -H 'accept: application/json' \
  -H 'authorization: Bearer eyJhbGciOiJIUzI1NiIs...' \
  -b 'session_id=8f2c41d0; theme=dark' \
  -H 'content-type: application/json' \
  -H 'origin: https://app.example.com' \
  -H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) ...' \
  --data-raw '{"status":"open"}'
PartWhat it isWatch out for
--urlThe full request URL, including query stringTokens passed as query parameters. Older Chrome versions put the URL straight after curl; both forms work
-HEvery request header the browser sentauthorization, API keys and CSRF tokens are copied as-is
-bThe cookies sent with the requestSession cookies let anyone with the command act as you
--data-rawThe request body for POST, PUT and PATCHForm fields, passwords and personal data
-XThe method, added when it cannot be inferredRarely sensitive

Chrome leaves out Accept-Encoding so cURL does not print compressed bytes, and drops headers cURL sets itself, such as Host. Everything else is a faithful copy of what the page sent.

cURL (bash) vs cURL (cmd) vs PowerShell

Mac and Linux show a single Copy as cURL option. Windows shows two, because Command Prompt cannot read the single-quote and backslash syntax bash uses.

Menu optionPaste it intoQuoting style
Copy as cURLTerminal on macOS or Linux (bash, zsh)Single quotes, \ line breaks
Copy as cURL (bash)Git Bash, WSL, or sharing with Mac and Linux usersSingle quotes, \ line breaks
Copy as cURL (cmd)Windows Command Prompt^" quoting, ^ line breaks
Copy as PowerShellPowerShellInvoke-WebRequest with a web session for cookies
curl --url ^"https://api.example.com/v1/orders?limit=20^" ^
  -H ^"accept: application/json^" ^
  -H ^"authorization: Bearer eyJhbGciOiJIUzI1NiIs...^" ^
  -b ^"session_id=8f2c41d0; theme=dark^"

Pasting into PowerShell?

In Windows PowerShell 5.1, curl is an alias for Invoke-WebRequest, so a bash-style command fails with confusing errors. Use Copy as PowerShell instead, or type curl.exe in place of curl. Windows 10 and 11 include curl.exe.

Replaying and editing the request

Once the command runs, add flags to see more and edit any part to test a theory. Keep the headers from the original command where the examples show ....

# Show response headers and status line, keep the body
curl -i --url 'https://api.example.com/v1/orders?limit=20' -H 'accept: application/json' ...

# Verbose: TLS, redirects and every header sent and received
curl -v --url 'https://api.example.com/v1/orders?limit=20' ...

# Pretty-print a JSON response (needs jq)
curl -s --url 'https://api.example.com/v1/orders?limit=20' ... | jq .

# Replay the same request against your local API
curl --url 'http://localhost:3000/v1/orders?limit=20' ...

# Windows PowerShell: call curl.exe, not the curl alias
curl.exe --url "https://api.example.com/v1/orders?limit=20" -H "accept: application/json"
  • Change one thing at a time. Edit a field in --data-raw or a query parameter to find the input that triggers a 400 or 500.
  • Point it at another environment. Swap the host for staging or localhost to check whether a fix works with the exact payload from production.
  • Got 401 or 403 on replay? The session or CSRF token has expired. Copy the request again right after reproducing.
  • Need to replay in the browser instead? Right-click a request and choose Resend (called Replay XHR in older Chrome), or Edit and resend as fetch, which puts an editable fetch call in the Console.

Copy as fetch and Copy as fetch (Node.js)

The Copy submenu also offers Copy as fetch, which produces a JavaScript fetch() call you can paste into the Console on the same site:

fetch("https://api.example.com/v1/orders?limit=20", {
  "headers": {
    "accept": "application/json",
    "authorization": "Bearer eyJhbGciOiJIUzI1NiIs...",
    "content-type": "application/json"
  },
  "referrer": "https://app.example.com/",
  "body": "{\"status\":\"open\"}",
  "method": "POST",
  "mode": "cors",
  "credentials": "include"
});
OptionCookiesBest for
Copy as fetchNot in the code; credentials: "include" makes the browser send its ownRe-running a call in the Console on the same origin, or in a test
Copy as fetch (Node.js)Included as a cookie headerScripts and reproductions that run outside the browser
Copy as cURLIncluded with -bTerminals, backend developers, API clients that import cURL

Browser fetch cannot set some headers, such as user-agent and cookie, so Chrome leaves them out of the browser version. An authorization header is still copied, so check it before sharing.

Strip secrets before you share a cURL command

A copied cURL command is a working login

Unlike the sanitized HAR export, Copy as cURL includes your cookies and authorization headers. Anyone who runs the command may be able to act as you until the session expires. Never paste an unedited command into a public issue, forum or shared channel.

  1. Replace the -b cookie value with [redacted], or delete the line if the request does not need a session.
  2. Replace authorization, x-api-key, x-csrf-token and similar header values.
  3. Check the URL for token=, key= or session= parameters.
  4. Read the --data-raw body for passwords, card numbers and personal data.
  5. If you already shared a live command, log out or revoke the token so the session stops working.

For bash-format commands, this masks the most common values automatically. Commands that use $'...' quoting still need a manual check:

# macOS: paste the copied command into a file (Linux: wl-paste or xclip -o)
pbpaste > request.sh

# Mask cookies and common auth headers, keep everything else
perl -pe 's/(-b|--cookie) \x27[^\x27]*\x27/$1 \x27[redacted]\x27/g;
          s/(-H \x27(?:authorization|cookie|x-api-key|x-csrf-token|x-xsrf-token): )[^\x27]*\x27/$1\[redacted]\x27/gi' \
  request.sh > request.redacted.sh

# Double-check nothing obvious is left
grep -Eio '(token|secret|password|session|bearer)[^ ]{0,30}' request.redacted.sh

Sharing a whole session rather than one request? A sanitized HAR file is safer: see how to capture a HAR file in Chrome. Pair the request with the matching error from the console log and it usually explains the failure on its own.

The faster way: Bugmark

Copy as cURL needs DevTools open before the request happens, and every command needs a manual secrets check. Bugmark is a Chrome extension that keeps a rolling network log for the tab, so the failing request is already captured when you report the bug.

  • Records the last 150 requests (fetch, XHR and resources) with method, URL, status and timing.
  • For the 60 most recent fetch/XHR calls, keeps query params, request headers and payload, response headers and response body.
  • Masks secrets before saving: passwords, tokens, API keys, session IDs, card numbers and Authorization/Cookie headers become [redacted].
  • Filter to failures, Copy as cURL, or Download HAR and open it in Chrome DevTools.
  • Attaches the screenshot, console errors and steps to reproduce to the same report.
Network tab showing the 402 JSON response body for a declined payment
The captured response body next to the request, ready to copy as cURL with secrets masked.

Because commands are built from the already-masked log, you add your own test credentials when replaying. Bugmark is free to try with every feature unlocked, up to 2 saved reports at a time; a one-time $15 payment removes the limit, with no subscription or account. Add Bugmark to Chrome

How to copy a request as cURL in Chrome

  1. 1

    Open DevTools

    Press F12, Ctrl+Shift+I or Cmd+Option+I on the page that makes the request.

  2. 2

    Select the Network panel

    Click the Network tab, using the overflow arrow if it is hidden.

  3. 3

    Trigger the request

    Reload the page or repeat the action so the request appears in the list.

  4. 4

    Find the request

    Filter by Fetch/XHR or type part of the URL to locate the request.

  5. 5

    Copy as cURL

    Right-click the request, hover over Copy and choose Copy as cURL, or Copy as cURL (bash) or (cmd) on Windows.

  6. 6

    Run it in a terminal

    Paste the command into a terminal and press Enter to replay the request.

  7. 7

    Remove secrets before sharing

    Replace cookie, authorization and token values with placeholders before sending the command to anyone.

Frequently asked questions

Where is Copy as cURL in Chrome?

Open DevTools and select the Network panel, then reproduce the request. Right-click the request in the Name column, hover over Copy, and choose Copy as cURL. On Windows the menu shows Copy as cURL (bash) and Copy as cURL (cmd) instead of a single option.

What is the difference between Copy as cURL (bash) and Copy as cURL (cmd)?

They produce the same request with different quoting. The bash version uses single quotes and backslash line breaks for bash, zsh, Git Bash and WSL. The cmd version uses caret escaping for Windows Command Prompt. For PowerShell, use Copy as PowerShell or run curl.exe explicitly.

Does Copy as cURL include cookies?

Yes. Chrome adds the cookies sent with the request using the -b option, and copies headers such as Authorization unchanged. That is why the command replays as your logged-in session, and also why you should remove cookies and tokens before sharing it with anyone.

Why does my copied cURL command return 401 or 403?

The session cookie, bearer token or CSRF token in the command has usually expired or been rotated. Reproduce the action in the browser again and copy a fresh command. Some APIs also bind tokens to the browser or check the Origin header, so keep the copied headers intact.

Can I copy all network requests as cURL at once?

Yes. Right-click any request, hover over Copy and choose Copy all as cURL. Chrome copies every request in the list as a chain of commands. If you have a filter active, the option becomes Copy all listed as cURL and only includes the filtered requests.

Try Bugmark free — no account needed

  • Screenshots & screen recording
  • Console & network logs
  • Steps to reproduce
  • GitHub issues & reports
Add to Chrome — free