Skip to main content
Guide 5 min read

How to Convert a cURL Command to a Postman Collection

A teammate pastes a cURL command into Slack. Or the docs hand you one. Or you copied one from your browser’s network tab. It works, but you can’t save it, share it or tweak one value without retyping the whole line. That’s when you want to convert a cURL command to a Postman collection.

The good news: Postman reads cURL directly, so the conversion takes about a minute. This guide covers the import, how to turn single requests into a real collection and which cleanup steps save you pain later. I’ll also flag the quirks that make an import fail.

Why bother converting a cURL command?

cURL is great for one off calls. It’s fast, and it lives in the terminal. But a long command is hard to read, hard to edit and impossible to organize. Postman fixes all three.

  • Readable layout. Headers, body and auth sit in separate tabs instead of one long line.
  • Reuse. Save the request, then swap the environment to hit staging or production.
  • Teamwork. Share a collection with your team instead of pasting commands in chat.
  • Testing. Add checks to a request and run the whole collection at once.

What a cURL command contains

Before you import, it helps to see what Postman has to read. Every cURL command boils down to a few parts:

  • The URL, including any query parameters. Postman splits these into the Params tab.
  • The method. A flag sets it, and without one cURL sends GET, or POST when you add a body.
  • Headers. Each header flag adds one line. Postman lists them on the Headers tab.
  • The body. A data flag carries JSON, form fields or raw text. Postman puts it on the Body tab.
  • Auth. A user flag means basic auth, and a header can carry a bearer token.
  • Options. Flags for redirects, certificates and compression change how cURL behaves, not what it sends.

Our guide on REST API requests explains how these pieces fit together.

How to import a cURL command into Postman

Here’s the routine:

  1. Copy the full cURL command. Take it from the docs, your terminal history or your browser’s developer tools. In the browser, right click a request in the Network tab and copy it as cURL in the bash format.
  2. Open Postman and click Import near the top left.
  3. Pick the Raw text tab, paste the command and click Continue.
  4. Check the preview, then click Import. Postman builds a request from the command.
  5. Review the method, URL, headers, body and auth. Make sure each one landed in the right tab.
  6. Click Send and compare the response with what cURL returned.

There’s a shortcut too. Open a new request tab and paste the cURL command straight into the URL bar. Postman notices and offers to import it. Menu names shift between Postman versions, so if a button has moved, look for Import first.

Turn requests into a collection

An imported cURL command gives you one request. A collection groups many of them. Here’s how to build one:

  1. Create a new collection and give it a clear name, like the name of the API.
  2. Save your imported request into it. Use a short name that says what the call does, such as Create user.
  3. Repeat the import for each cURL command. Postman handles one command at a time.
  4. Group related calls into folders, like Users and Orders.
  5. Set auth once at the collection level and let each request inherit it.

That last step saves hours. Change the token in one place and every request follows.

Clean up after the import

A fresh import works, but it’s rarely tidy. Spend five minutes on these fixes:

  • Replace hardcoded hosts with a variable. Use {{baseUrl}} instead of a full domain, so one click switches between staging and production.
  • Move secrets into variables. Store tokens as {{token}} in an environment. Keep real secrets in the current value field, not the initial value, because the initial value can sync to teammates.
  • Delete noise. Browser copies carry dozens of headers you don’t need. Keep only the ones the API requires.
  • Check encoded values. If a query value looks garbled, decode it with our URL encoder decoder and fix it.
  • Inspect tokens. A bearer token in the command may have expired. Read its claims with our JWT decoder before you blame the API, and see our guide on reading a JWT safely for safe habits.
  • Check basic auth. A basic auth header is only a user and password in Base64. Our Base64 decoder shows you what’s inside.
  • Rename the request and add a short description.

Then add a first test. In the Tests tab, a line like pm.test("Status is 200", () => { pm.response.to.have.status(200) }) confirms the call works every time you run it.

Quirks that break an import

Most failed imports come from a short list of causes:

  • Shell quoting. Windows command prompt copies use different quote and escape rules than bash. If Postman rejects the command, copy the bash version instead.
  • Smart quotes. Pasting from a chat app or a document can swap straight quotes for curly ones. Paste into a plain text editor first to check.
  • Broken line continuations. A missing backslash at the end of a line splits the command in two.
  • File uploads. A form field that points to a local file keeps the path, but Postman can’t read your disk. Select the file again in the Body tab.
  • Ignored flags. Settings for certificates, proxies, compression and retries don’t travel. Set them in Postman’s settings instead.
  • Redirects. cURL follows redirects only when you ask. Postman follows them by default, so results can differ. Our guide on debugging redirect chains explains why.
  • Escaped JSON. Backslashes and quotes inside a data string can double up. Paste the body into our JSON formatter to confirm it’s valid and readable.

Share and automate your collection

Once the collection looks right, you have three good moves.

  • Export it. Use the collection menu to export it as JSON in the v2.1 format, then commit the file to your repo.
  • Run it. The Collection Runner sends every request in order, which makes a fast smoke test.
  • Automate it. Newman is Postman’s command line runner. Run it with newman run collection.json and add it to your CI pipeline.

Did something change after an edit? Compare the old and new exports in our text diff checker to see exactly what moved. And if you want to rebuild a request from scratch as a double check, try our API request builder.

Mistakes to avoid

A few slips cause most of the grief.

  • Importing a command with a live secret, then sharing the collection. Strip tokens first.
  • Leaving browser headers in place, which makes requests fail or look suspicious to the server.
  • Skipping variables, which locks the collection to one environment.
  • Forgetting to save the request into a collection. An imported tab alone isn’t saved anywhere.
  • Never testing the response. A request without a test only tells you the server answered.

The short version

To convert a cURL command to a Postman collection, copy the command, use Import with Raw text, review each tab and save the request into a collection. Then swap hardcoded values for variables, clean out noise headers and add a simple test. Export the collection and run it with Newman when you’re ready to automate.

Take the last cURL command you pasted into chat and import it right now. Five minutes of cleanup turns a throwaway line into a tool your whole team can reuse.

Free browser based tools on Black Claaw to build requests, format responses, decode tokens and compare changes.

View all tools

Advertisement