Fetch real-time data from 100+ websites,No development or maintenance required.
Over 100 million real residential IPs from genuine users across 190+ countries.
SCRAPING SOLUTIONS
Get accurate and in real-time results sourced from Google, Bing, and more.
With 120+ prebuilt and custom scrapers ready for any use case.
No blocks, no CAPTCHAs—unlock websites seamlessly at scale.
Execute scripts in stealth browsers with full rendering and automation
PROXY INFRASTRUCTURE
Over 100 million real residential IPs from genuine users across 190+ countries.
Reliable mobile data extraction, powered by real 4G/5G mobile IPs.
For time-sensitive tasks, utilize residential IPs with unlimited bandwidth.
Fast and cost-efficient IPs optimized for large-scale scraping.
SCRAPING SOLUTIONS
PROXY INFRASTRUCTURE
DATA FEEDS
Full details on all features, parameters, and integrations, with code samples in every major language.
LEARNING HUB
ALL LOCATIONS Proxy Locations
TOOLS
RESELLER
Get up to 50%
Contact sales:partner@thordata.com
Products $/GB
Fetch real-time data from 100+ websites,No development or maintenance required.
Get real-time results from search engines. Only pay for successful responses.
Execute scripts in stealth browsers with full rendering and automation.
Bid farewell to CAPTCHAs and anti-scraping, scrape public sites effortlessly.
Dataset Marketplace Pre-collected data from 100+ domains.
Over 100 million real residential IPs from genuine users across 190+ countries.
Reliable mobile data extraction, powered by real 4G/5G mobile IPs.
For time-sensitive tasks, utilize residential IPs with unlimited bandwidth.
Fast and cost-efficient IPs optimized for large-scale scraping.
Data for AI $/GB
Pricing $0/GB
Docs $/GB
Full details on all features, parameters, and integrations, with code samples in every major language.
Resource $/GB
EN $/GB
产品 $/GB
AI数据 $/GB
定价 $0/GB
产品文档 $/GB
资源 $/GB
简体中文 $/GB
When you integrate with modern APIs in 2026, you will inevitably run into curl examples in documentation, GitHub issues, and Stack Overflow answers.
Understanding how a cURL POST request works is one of the fastest ways to debug HTTP traffic and reproduce client behavior without writing extra code.
In this guide, we will walk through what a POST request actually does, how to craft reliable cURL commands, and how to send real-world payloads such as form data, JSON, and file uploads. We will also cover common errors and the exact flags you can use to understand what is going on under the hood, so you can confidently move between browser-based tools like Postman and low-level debugging with the terminal.
cURL (short for “Client URL”) is a command-line tool and library for transferring data to and from servers. It supports a long list of protocols, but for web developers the most important one is HTTP(S).
You can think of cURL as a programmable browser without a GUI: it can send requests, follow redirects, handle cookies, add headers, and show you the raw response exactly as the server sends it. As of 2026, curl also has mature support for HTTP/2 and HTTP/3 where the server and TLS stack allow it, which makes it a realistic way to simulate production traffic.
curl https://httpbin.org/get
The example above sends a simple GET request. In the rest of this article we will focus on POST requests, which are used when you need to send data to the server.
If you want to explore everything curl can do beyond POST requests, the official curl documentation and HTTP method reference such as MDN's POST guide are excellent companions to this article.
Even though graphical tools like Postman, Insomnia, and API dashboards are popular, experienced engineers still keep curl in their daily toolkit:
An HTTP POST request sends data in the request body instead of (or in addition to) the URL query string. This is how you typically submit forms, create resources in REST APIs, or send login credentials.
A minimal cURL POST request looks like this:
curl -X POST -d "name=Alice&role=developer" https://httpbin.org/post
Here is what each part means:
-d.)| Option | Meaning | Typical usage |
|---|---|---|
| -X | Specify the HTTP method (POST, PUT, PATCH, DELETE…) | -X POST when you want to be explicit about the method. |
| -d | Send data in the request body | -d "name=Alice&role=developer" or -d '{"name":"Alice"}' |
| -H | Add a custom HTTP header | -H "Content-Type: application/json" |
| -o | Write response body to a file | -o response.json |
| -F | Send multipart form data, including file uploads | -F "file=@/path/to/file.txt" |
| -L | Follow redirects | Useful for login forms or APIs that redirect after POST. |
| -u | HTTP Basic authentication | -u "username:password" |
Many web applications still send form data as application/x-www-form-urlencoded, the same format browsers use by default.
curl -X POST \
-d "username=testuser&password=secret123" \
https://example.com/login
cURL automatically sets the appropriate Content-Type header when you use -d with a URL-encoded string.
This makes it easy to reproduce login forms or simple POST endpoints during debugging.
If the server redirects after login (for example from /login to /dashboard), use -L to follow the redirect:
curl -L -X POST \
-d "username=testuser&password=secret123" \
https://example.com/login
Modern APIs usually expect JSON instead of form data. With cURL, you just have to do two things:
Content-Type header to application/json.-d (or --data).curl -X POST \
-H "Content-Type: application/json" \
-d '{"email":"user@example.com","password":"securepassword"}' \
https://api.example.com/login
To upload files, use the -F option, which encodes the request as multipart/form-data. This is the same format browsers use for file inputs in HTML forms.
curl -X POST \
-F "upload_file=@/path/to/report.csv" \
-F "description=Monthly KPI report" \
https://example.com/upload
The @ symbol tells cURL to read data from a local file. You can mix file fields and simple text fields in the same request.
Real-world APIs almost always require extra headers — for example, API keys, versioning headers, or content negotiation.
curl -X POST \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name":"Thordata","plan":"enterprise"}' \
https://api.example.com/accounts
Some internal tools and staging environments use HTTP Basic Auth. You can supply the credentials directly via -u:
curl -X POST \
-u "admin:supersecret" \
-d "action=flush-cache" \
https://admin.example.com/maintenance
When you need to test how your POST requests behave from different regions or through a proxy network, you can route traffic via a proxy:
curl -X POST \
-x http://proxy.example.com:8080 \
-H "Content-Type: application/json" \
-d '{"event":"signup","source":"campaign-123"}' \
https://api.example.com/events
Using high-quality residential or rotating proxies can help you simulate real-user behavior, avoid rate-limiting patterns, and test geo-specific API behavior more accurately.
During debugging, you often want to persist responses to a file and inspect them using additional tools.
curl -X POST \
-H "Content-Type: application/json" \
-d '{"query":"status"}' \
-o status-response.json \
https://api.example.com/status
If the API returns JSON, you can pretty-print it with jq:
curl -X POST \
-H "Content-Type: application/json" \
-d '{"query":"status"}' \
https://api.example.com/status | jq
For more advanced test setups, teams often wrap curl calls in shell scripts or CI jobs, then combine them with monitoring and alerting. This makes it easy to turn a manual troubleshooting step into a repeatable check that runs every time you deploy.
This error usually means there is a typo in the domain, the host does not exist, or your DNS/network configuration is broken.
https:// vs http://).curl https://example.com to confirm basic connectivity.
This appears when you use a protocol that your cURL build does not support, or when the URL string is malformed (for example, missing http://).
Make sure you are using http:// or https:// unless you explicitly intend to use FTP, SMTP, or another protocol and your environment supports it.
Content-Type; check the API docs for the required format.-v (verbose) or even --trace-ascii debug.log to your cURL command to inspect raw request and response headers.
This often reveals mismatched headers, redirects, or proxy behavior that is hard to see otherwise.
Content-Type explicitly when sending JSON or non-default payloads.-L when working with login flows or endpoints that redirect.cURL POST requests are one of the most versatile tools in a developer’s toolbox. With a single command, you can reproduce browser forms, hit REST endpoints, submit JSON payloads, or upload files — all without writing a new script.
Once you understand how options like -d, -H, -F, -L, and -u work together, debugging HTTP issues becomes dramatically faster.
Start by copying a working example from this guide, adjust the URL and payload for your own API, and then iterate using verbose mode and logs until the server responds exactly the way you expect.
Frequently asked questions
What is a cURL POST request used for?
A cURL POST request is used to send data in the body of an HTTP request, typically to submit forms, create or update resources in an API, send JSON payloads, or upload files. It is especially useful for testing API endpoints and reproducing client behavior directly from the command line.
How do I send JSON with a cURL POST request?
Add a Content-Type: application/json header with -H and pass a valid JSON string to -d, for example:
curl -X POST -H "Content-Type: application/json" -d '{"email":"user@example.com","password":"secret"}' https://api.example.com/login.
Make sure your JSON is properly quoted for your shell.
How can I debug a failing cURL POST request?
Start by adding the -v flag to see request and response headers, confirm the URL and HTTP method, and compare your payload and headers with the API documentation.
If the server responds with 4xx or 5xx codes, look at the response body for error messages and check for issues like invalid JSON, missing authentication, or wrong Content-Type.
About the author
Kael is a Senior Technical Copywriter at Thordata. He works closely with data engineers and API platform teams to document best practices for sending and debugging HTTP requests at scale. His focus is on turning low-level protocol details into practical workflows that developers can apply in day-to-day debugging.
The thordata Blog offers all its content in its original form and solely for informational intent. We do not offer any guarantees regarding the information found on the thordata Blog or any external sites that it may direct you to. It is essential that you seek legal counsel and thoroughly examine the specific terms of service of any website before engaging in any scraping endeavors, or obtain a scraping permit if required.
Looking for
Top-Tier Residential Proxies?
您在寻找顶级高质量的住宅代理吗?
How to Scraping Dynamic Websites with Python?
In this article, learn how to ...
Anna Stankevičiūtė
2026-03-03
Scraping Yahoo Finance using Python
Xyla Huxley Last updated on 2026-03-02 10 min read […]
Unknown
2026-03-03
TCP Deep Dive with Wireshark
Xyla Huxley Last updated on 2026-03-03 6 min read TCP i […]
Unknown
2026-03-03
Web Scraping with Python using Requests
Xyla Huxley Last updated on 2026-03-03 6 min read Web c […]
Unknown
2026-03-03
Crawl4AI: Open-Source AI Web Crawler with MCP Automation
Xyla Huxley Last updated on 2026-03-03 10 min read AI a […]
Unknown
2026-03-03
Using Wget with Python: A Practical Guide for Reliable, Scalable Web Data Retrieval
Xyla Huxley Last updated on 2026-03-03 10 min read […]
Unknown
2026-03-03
How to Make HTTP Requests in Node.js With Fetch API (2026)
A practical 2026 guide to usin ...
Kael Odin
2026-03-03
How to Scrape Job Postings in 2026: Complete Guide
A 2026 end-to-end guide to scr ...
Kale Odin
2026-03-03
BeautifulSoup Tutorial 2026: Parse HTML Data With Python
A 2026 step-by-step BeautifulS ...
Kael Odin
2026-03-03