     [Answers](https://scrapfly.io/blog)   /  [curl](https://scrapfly.io/blog/tag/curl)   /  [How To Send cURL POST Requests?](https://scrapfly.io/blog/answers/how-to-send-a-post-request-using-curl)   # How To Send cURL POST Requests?

 by [Mazen Ramadan](https://scrapfly.io/blog/author/mazen) Apr 18, 2026 3 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-send-a-post-request-using-curl "Share on LinkedIn")    

 

 

To send a curl post request, we can use the following syntax:

bash```bash
curl -X POST \
     -H "Headers" \
     -d "Body" \
     https://httpbin.dev/post
```



This snippet shows the basic elements of a curl post data request:

`-X`: Specifies the request HTTP method, POST in this case. `-H`: For adding request headers, which are often required for POST requests. `-d`: For adding the cURL post body, which is where your payload goes (JSON, XML, or form data).

## Common cURL POST Request Examples

Let's go through some typical use cases for sending a curl post request.

### cURL POST Request with JSON

To pass a JSON body in a cURL POST request with JSON, use the -d option followed by the data object:

bash```bash
curl -X POST -H "Content-Type: application/json" -d '{"key1": "value1", "key2": "value2"}' https://httpbin.dev/post
```



Here, we modify the request `Content-Type` [header](https://scrapfly.io/blog/posts/how-to-avoid-web-scraping-blocking-headers/) and include the cURL request body in JSON format. The server responds with the parsed request:

json```json
{
  "args": {},
  "headers": {
    ....
    "Content-Type": [
      "application/json"
    ],
  },
  "method": "POST",
  "data": "{\"key1\": \"value1\", \"key2\": \"value2\"}",
  "json": {
    "key1": "value1",
    "key2": "value2"
  }
}
```



### cURL POST Request with XML

You can also send a cURL POST request with XML by changing the header and body format:

bash```bash
curl -X POST \
     -H "Content-Type: application/xml"
     -d "<?xml version="1.0" encoding="UTF-8"?><product><id>1</id><name type="title">Box of Chocolate Candy</name></product>"
     https://httpbin.dev/post
```



This approach is common for SOAP-based or legacy APIs that require XML payloads.

### Sending Files with cURL POST

To make cURL POST files, we use the `-F` flag to send file data as multipart/form-data:

bash```bash
curl -X POST -F "file=@/file/path/file.img" https://httpbin.dev/post
```



Note: If you're uploading multiple files, use multiple `-F` flags. This is useful for form-based file upload endpoints.

### Sending Form POST Requests

Form POST requests are commonly required to retrieve tokens or data behind forms. Let's replicate this [form example](https://httpbin.dev/forms/post) using cURL POST requests:

bash```bash
curl -X POST \
     -d 'custname=Scrapfly&custtel=&custemail=&size=small&topping=cheese&delivery=13%3A45&comments=' \
     https://httpbin.dev/post
```



This is especially useful when interacting with APIs or web apps that use forms to receive input.

### Authenticate cURL POST Requests

Let's make cURL POST requests support basic HTTP authentication. For this, we can use the `basic` option:

bash```bash
curl -X POST --user user:passwd --basic https://httpbin.dev/basic-auth/user/passwd
```



The response of the above cURL request indicates that it's successfully authenticated:

json```json
{
  "authorized": true,
  "user": "user"
}
```



For further details on different mechanisms for handling authentication with cURL requests, refer to our [dedicated guide](https://scrapfly.io/blog/answers/how-to-set-authorization-with-curl-full-examples-guide).

## Further cURL Options

Sending cURL POST requests often require additional configuration for the request. Here are additional cURL arguments and their usage:

| Argument | Full Option | Description |
|---|---|---|
| -x | --proxy | Use proxy with cURL, either as HTTP or SOCKS |
| -Z | --parallel | Send multiple cURL requests in parallel |
| -L | --location | Make cURL follow request redirects |
| -O | --output | Save the response binary data to a local directory |
| -I | --head | Use the request HEAD HTTP method |
| -b | --cookie | Add request cookies |
| -v | --verbose | Sends the request in verbose mode, which include further debugging details |
| -k | --insecure | Skip SSL verification for HTTPs connection |







For further details on sending requests with 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)



 

    Table of Contents- [Common cURL POST Request Examples](#common-curl-post-request-examples)
- [cURL POST Request with JSON](#curl-post-request-with-json)
- [cURL POST Request with XML](#curl-post-request-with-xml)
- [Sending Files with cURL POST](#sending-files-with-curl-post)
- [Sending Form POST Requests](#sending-form-post-requests)
- [Authenticate cURL POST Requests](#authenticate-curl-post-requests)
- [Further cURL Options](#further-curl-options)
 
    Join the Newsletter  Get monthly web scraping insights 

 

  



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-send-a-post-request-using-curl) [ Gemini ](https://www.google.com/search?udm=50&aep=11&q=Summarize%20this%20page%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fanswers%2Fhow-to-send-a-post-request-using-curl) [ Grok ](https://x.com/i/grok?text=Summarize%20this%20page%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fanswers%2Fhow-to-send-a-post-request-using-curl) [ Perplexity ](https://www.perplexity.ai/search/new?q=Summarize%20this%20page%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fanswers%2Fhow-to-send-a-post-request-using-curl) [ Claude ](https://claude.ai/new?q=Summarize%20this%20page%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fanswers%2Fhow-to-send-a-post-request-using-curl) 



 ## 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) [     

### What is HTTP 405 Error? (Method Not Allowed)

HTTP error codes can be confusing, especially when they disrupt your web scraping or automation tasks. One such error is...

 

 ](https://scrapfly.io/blog/posts/what-is-http-405-error) [  

 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 a HEAD Request With cURL? ](https://scrapfly.io/blog/answers/how-to-send-curl-head-requests)
- [ Q How To Send Multiple cURL Requests in Parallel? ](https://scrapfly.io/blog/answers/how-to-send-multiple-curl-requests-in-parallel)
- [ Q What is The cURL (28) Error, Couldn't connect to server? ](https://scrapfly.io/blog/answers/what-is-the-curl-28-error)
- [ Q How to get file type of an URL in Python? ](https://scrapfly.io/blog/answers/how-to-get-url-filetype-in-python)
 
  



   



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