How to Send cURL POST Requests: Step-by-Step Guide

At some point, if you're working with APIs, you will need to push data from the terminal. This is where cURL is great. In this tutorial, you will learn what a POST request is, how to send one with cURL, and the options that are useful for typical tasks.

Valentin Ghita

Technical Writer, Marketing, Research

Mihalcea Romeo

Co-Founder, CTO

updated 2026-04-03T04:28:04.670Z

What is a POST Request?

A POST request is how you send data to a server in order for it to create or update something on its end. The payload is in the request body instead of being in the URL, which creates a cleaner URL and allows you to send large or structured data like JSON, XML, form fields, and files. POST is the preferred method for actions like user sign up, submitting checkout details, uploading images, and running background tasks. Since a POST performs an action, if you submit the same request twice, the same action will happen twice, so be careful if you retry.

cURL works very well with proxies as well

You can use cURL to create requests using proxies very easily. cURL supports multiple protocols and types such as SOCKS5 Proxies, Datacenter Proxies, ISP Proxies or residential proxies (almost all being HTTP Proxies as a family)

How to Send a POST Request with cURL: Step-by-Step

Install cURL on Your OS

First, you'll need to install cURL if you don’t have it yet. Most Linux distros already include it; otherwise use your package manager.

  • Debian or Ubuntu: sudo apt install curl
  • Fedora: sudo dnf install curl
  • macOS: ships with cURL, or install the latest via Homebrew: brew install curl
  • Windows 10 and later: winget install curl or install Git for Windows which includes cURL

Confirm your version with:

Make Your First POST Request

The quickest form encoded POST looks like this:

Using -d automatically selects the POST method and sets the body as application/x-www-form-urlencoded. If you prefer to be explicit, you can add -X POST and a header:

You can repeat -d to add more fields. cURL will join them with &.

A Quick Overview of POST Request Arguments You Will Actually Use

The table below will assist you in making the appropriate cURL choices for daily use in posting requests quickly. Simply scan the left column to find the appropriate flag, read the brief description, grab the example, and paste it into your terminal.

Table which include cURL POST request arguments.

Send JSON Payloads

Now that you have the quick overview, here is how to post JSON in practice.

Inline JSON:

From a file for cleaner workflows:

Tip: prefer --data-binary when posting a file so cURL does not alter newlines or bytes.

Send XML Payloads

If your service uses XML, the flow is the same. Point cURL at the endpoint, set the header, and send the body.

Small XML can be sent inline, but putting it in a file keeps complex payloads readable and easy to version.

Send Form Data

There are two common web form formats, and cURL handles both.

URL encoded forms

--data-urlencode makes sure spaces and special characters are encoded correctly.

Multipart forms

cURL will build a browser style multipart/form-data request. You can also hint the media type:

Use multipart when you need to mix text fields and files in one request.

Upload a File or Multiple Files via POST

To send more than one file, repeat -F:

If your endpoint expects raw bytes rather than multipart, post the file as the entire body:

Rule of thumb: use multipart for form style uploads, and use --data-binary @file for endpoints that accept a single raw payload.

Send Authentication Credentials

Basic auth

If you omit the password, cURL will prompt you:

Bearer tokens

Cookie based sessions

Conclusion

You now have everything you need to send solid POST requests with cURL from the terminal. Start simple with -d for classic form fields, reach for --data-urlencode when special characters show up, use --data-binary when you are posting files or need exact bytes, and switch to -F for multipart uploads with text plus files. Add headers with -H, include credentials with -u or a bearer token, and lean on cookies with -c and -b when a session is involved. While you are testing, -i, -v, and -L make troubleshooting much easier, and -o saves responses cleanly.

Now if you want more guides related to cURL and you are a beginner, you can check our quick guide on using cURL to send GET requests and when you learned more about cURL and want to take it to the next level, check using cURL with a proxy. Also, if you have any questions, you can contact our support team and they will help you resolve any problem you've got.

Recommended product

Buy Backconnect Proxies

Rotating IPs on every request. Scale scraping and automation without manual IP management.

Similar posts to this one

Read about the latest news and updates.

Hero image of curl get request.
updated·2026-11-20T18:03:03.205Z

How to Use cURL to Send GET Requests: Quick Tutorial

You can think of cURL as your command line remote for the web. It is everywhere and will let you get pages, JSON, or images while setting headers, cookies, and sessions. Because curl fits nicely into scripts, it is a great tool for quick checks and simple automation. This guide will focus exclusively on GET requests, starting simply and layering in the essentials until your quick one-liners become reliable workflows.

Hero image for proxy error codes.
updated·2026-11-20T18:03:02.518Z

What Are the Main Proxy Error Codes and How to Fix Them?

Proxies are brilliant when they work. They hide your IP, route traffic through different regions, and help you automate tasks responsibly. When they hiccup, though, you see cryptic error codes instead of results. This guide translates those codes into plain language and gives you clear, field-tested fixes.

How to download files with cURL hero image
updated·2026-05-10T12:26:10.525Z

How to Download Files With cURL: Flags, Proxies, Fixes

Learn how to download files with cURL, from basic flags to proxy routing, bulk IP rotation, and fixes for the most common errors.

Proxy Helper hero image.
updated·2026-04-14T16:16:11.600Z

Proxy Helper: Step-by-Step Setup Guide for Chrome

Looking for a simple way to route your browser traffic through a proxy without dealing with hidden settings? Proxy Helper is a free lightweight Chrome extension that makes switching proxies feel easy and fast. In this guide you will learn exactly what it is, how to set it up in Chrome, why it is useful for privacy and workflows, and the smartest tips to keep things stable and speedy.

 

Ready to get started?

We accept all forms of payment, including crypto.