Import From Curl n8n http node

When it comes to automating workflows and integrating APIs, n8n is a powerful tool that makes it easy to connect different services without writing complex code. But sometimes, you need a quick way to test API calls, fetch data, or interact with web services directly—this is where cURL comes in.

What is cURL?

cURL (short for Client URL) is a command-line tool and library (libcurl) used for making HTTP requests and transferring data between a client and a server.

Why Use Import From cURL in n8n?

This functionality quickly allows you to build an HTTP node in n8n with all the correct headers and parameters set for you. This is like a super power for those who may not understand the full complexities of how an API request is built, and saves a lot of time for those who don't want to re-type or copy and paste each section. This can be especially helpful when the api request you need to make has more than 2 headers.

Example of Using Import From cURL in n8n

For this example we will use this website: https://practicesoftwaretesting.com/

As a part of this site there is an api backend which includes all the data that is rended through the UI. For our example we will be using Chrome to get the network request. To do this:

  1. Open Chrome
  2. Visit the web page
  3. Right click on the page and select Inspect
  4. Visit the Network tab
  5. Refresh the page
  6. Find the products api call
  7. Right click it and hoover over Copy and select Copy as cURL

Below is an example of what was added to my clipboard. I know a lot of the information in the headers isn't needed to make the actual api request, but certain parts are, so let's go ahead and just import this whole thing into an n8n HTTP node.

curl 'https://api.practicesoftwaretesting.com/products?between=price,1,100&page=1' \
  -H 'Accept: application/json, text/plain, */*' \
  -H 'Accept-Language: en-US,en;q=0.9' \
  -H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL2FwaS5wcmFjdGljZXNvZnR3YXJldGVzdGluZy5jb20vdXNlcnMvbG9naW4iLCJpYXQiOjE3Mzg3MzY2NTksImV4cCI6MTczODczNjk1OSwibmJmIjoxNzM4NzM2NjU5LCJqdGkiOiIxV0RINzcxWmRRcnp6U1dGIiwic3ViIjoiMDFKS0FCM0hFVkVUQTJGME5BSjQyR1A3M1kiLCJwcnYiOiIyM2JkNWM4OTQ5ZjYwMGFkYjM5ZTcwMWM0MDA4NzJkYjdhNTk3NmY3Iiwicm9sZSI6ImFkbWluIn0.CoVvP1Pu035PKoqxaNyAQ8p7Qv9BpndPWABJilp4HHY' \
  -H 'Connection: keep-alive' \
  -H 'Content-Type: application/json' \
  -H 'DNT: 1' \
  -H 'Origin: https://practicesoftwaretesting.com' \
  -H 'Referer: https://practicesoftwaretesting.com/' \
  -H 'Sec-Fetch-Dest: empty' \
  -H 'Sec-Fetch-Mode: cors' \
  -H 'Sec-Fetch-Site: same-site' \
  -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36' \
  -H 'sec-ch-ua: "Not A(Brand";v="8", "Chromium";v="132"' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'sec-ch-ua-platform: "macOS"'

In n8n:

  1. Add a node from the nodes panel (look for the + sign)
  2. Search for HTTP Request and add this node
  3. With the node open select Import cURL
Step 3
  1. Paste the cURL command and select Import
Step 4
  1. Click Test Step and ensure you get a response
Step 5
  1. Now go back and clean up or parameterize any of the headers and query parameters needed to make this request and future requests.

Note in the case where authentication is needed, you can either create a credential and use the credential through the Authentication section. It's best to ensure that any private information isn't hard coded and saved in plain text but rather should be saved as a credential.

The above example was using a GET request. Where this get's even better is when you use the copy to cURL command for POST and PUT requests which will have an additional body section that is typically formatted json.

Conclusion

Using the Import cURL functionality with n8n is a great way to shortcut your custom HTTP node building game. I find I use it quite often as I need to make API calls through my n8n workflows.


Did I miss something or is something out of date? I'd love to hear about it, signup and comment below. You can also connect with me LinkedIn.