     [Answers](https://scrapfly.io/blog)   /  [curl](https://scrapfly.io/blog/tag/curl)   /  [How to Use cURL Config Files?](https://scrapfly.io/blog/answers/how-to-set-curl-config-file)   # How to Use cURL Config Files?

 by [Mazen Ramadan](https://scrapfly.io/blog/author/mazen) Apr 18, 2026 1 min read [\#curl](https://scrapfly.io/blog/tag/curl) 

 [  ](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fscrapfly.io%2Fblog%2Fanswers%2Fhow-to-set-curl-config-file "Share on LinkedIn")    

 

 

cURL offers an option to create config files for defining command options. These files can be utilized with individual cURL commands to use the configuration defined in them.

Let's use cURL config files. First, create a text file `config.txt` in the same directory of the cURl terminal and the following data:

text```text
# set the HTTP method to POST
-X POST

# set User-Agent
-A "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/113.0"

# add request header
-H "Accept: application/json"

# add cookie values
-b "cookie1=value1; cookie2=value2"

# follow redirects
--location

# add request body
-d "{\"key1\": \"value1\", \"key2\": \"value2\"}"  # Enclosed in quotes and escaped internal quotes
```



Here, we set a few cURL options, such as User-Agent, headers, cookies, HTTP method and request body. To use the cURL config file, we can use the `-K` cURL config followed by the file name:

shell```shell
curl -K config.txt https://httpbin.dev/anything
```



The response includes the defined cURL options in the config file:

json```json
{
  "args": {},
  "headers": {
    "Accept": [
      "application/json"
    ],
    "Accept-Encoding": [
      "gzip"
    ],
    "Content-Length": [
      "36"
    ],
    "Content-Type": [
      "application/x-www-form-urlencoded"
    ],
    "Cookie": [
      "cookie1=value1; cookie2=value2"
    ],
    "Host": [
      "httpbin.dev"
    ],
    "User-Agent": [
      "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/113.0"
    ]
  },
  "url": "https://httpbin.dev/anything",
  "data": "{\"key1\": \"value1\", \"key2\": \"value2\"}",
  "files": null,
  "form": {
    "{\"key1\": \"value1\", \"key2\": \"value2\"}": [
      ""
    ]
  },
  "json": null
}
```



For more details on cURL, refer to our dedicated guide.

[How to Use cURL For Web ScrapingIn this article, we'll go over a step-by-step guide on sending and configuring HTTP requests with cURL. We'll also explore advanced usages of cURL for web scraping, such as scraping dynamic pages and avoiding getting blocked.](https://scrapfly.io/blog/posts/how-to-use-curl-for-web-scraping)



 

    



Scale Your Web Scraping

Anti-bot bypass, browser rendering, and rotating proxies, all in one API. Start with 1,000 free credits.

  No credit card required  1,000 free API credits  Anti-bot bypass included 

 [Start Free](https://scrapfly.io/register) [View Docs](https://scrapfly.io/docs/onboarding) 

 Not ready? Get our newsletter instead. 

 

## Explore this Article with AI

 [ ChatGPT ](https://chat.openai.com/?q=Summarize%20this%20page%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fanswers%2Fhow-to-set-curl-config-file) [ Gemini ](https://www.google.com/search?udm=50&aep=11&q=Summarize%20this%20page%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fanswers%2Fhow-to-set-curl-config-file) [ Grok ](https://x.com/i/grok?text=Summarize%20this%20page%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fanswers%2Fhow-to-set-curl-config-file) [ Perplexity ](https://www.perplexity.ai/search/new?q=Summarize%20this%20page%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fanswers%2Fhow-to-set-curl-config-file) [ Claude ](https://claude.ai/new?q=Summarize%20this%20page%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fanswers%2Fhow-to-set-curl-config-file) 



 ## Related Articles

 [  

 curl 

### How to Use cURL GET Requests

Here's everything you need to know about cURL GET requests and some common pitfalls you should avoid.

 

 ](https://scrapfly.io/blog/posts/how-to-use-curl-get-requests) [  

 blocking proxies 

### How to Hide Your IP Address

In this article we'll be taking a look at several ways to hide IP addresses: proxies, tor networks, vpns and other techn...

 

 ](https://scrapfly.io/blog/posts/how-to-hide-your-ip-address-while-scraping) [  

 http tools 

### How to Use cURL For Web Scraping

In this article, we'll go over a step-by-step guide on sending and configuring HTTP requests with cURL. We'll also explo...

 

 ](https://scrapfly.io/blog/posts/how-to-use-curl-for-web-scraping) 

  ## Related Questions

- [ Q How To Send Multiple cURL Requests in Parallel? ](https://scrapfly.io/blog/answers/how-to-send-multiple-curl-requests-in-parallel)
- [ Q How To Download a File With cURL? ](https://scrapfly.io/blog/answers/how-to-download-file-curl)
- [ Q How to load local files in Puppeteer? ](https://scrapfly.io/blog/answers/how-to-load-local-files-in-puppeteer)
- [ Q How to Set User Agent With cURL? ](https://scrapfly.io/blog/answers/how-to-set-curl-user-agent)
 
  



   



 Scale your web scraping effortlessly, **1,000 free credits** [Start Free](https://scrapfly.io/register)