How to generate Curl Command from Postman

How to generate Curl Command from Postman | ninjasquad

In this tutorial, we’ll learn how to generate Curl command using Postman.


Many times we need to execute GET, POST, PUT, PATCH, DELETE Http requests to verify endpoints. Normally we use:

  • Browser to execute GET request
  • Postman to execute GET, POST, PUT, PATCH, DELETE requests

There are many times where we stuck in a situation where:

  • Browser is not available on the machine
  • Postman is not able to install on certain machine
  • Using Linux environment

In such cases Curl command is very useful which can be used to execute HTTP endpoints from command prompt or terminal.

Installing Curl

The curl package is pre-installed on most Linux distributions today.

If curl is not installed you can easily install it using the package manager of your distribution.

Install Curl on Ubuntu and Debian
sudo apt update
sudo apt install curl
Install Curl on CentOS and Fedora
sudo yum install curl

Generate Curl from Postman

Considering that you are already familiar with Postman. Follow these steps:

  1. Create HTTP request using Postman

  2. Click on the Code button.

    Postman Post Request

  3. A dialog “GENERATE CODE SNIPPET” will appear. Select “cURL” from the dropdown.

    Generate CURL from Postman
    curl -X POST \ \
      -H 'cache-control: no-cache' \
      -H 'content-type: application/x-www-form-urlencoded' \
      -H 'postman-token: 2fbfab60-2a72-6c9d-754a-c7ff0fdedd23' \
      -d strange=boom
  4. You can copy the command using Copy to Clipboard button.

Please note that Postman generate multi-line CURL command which works in Mac and Linux environment but not in windows terminal. In such cases, you need to change command to single-line manually.

Source: Internet

Leave a Comment

We are offering free coding tuts