<- back
# CURL and how to use it
Posted on Jan 17, 2026
CURL stands for Client URL Request Library, it allows us to send and receive data from the command line. It can be used for transferring data between servers and has support for many protocols such as: HTTP, HTTPS, FTP, etc.
The basic structure of a CURL command is: curl [options] [URL]
Example:
curl https://example.com/
curl -X POST https://example.com/api/resource/
## Commonly Used Flags
| Flag | Desc. | Syntax |
|---|---|---|
| -O | Download the file and save it under its original name |
|
| -o | Download the file and save it with a different name |
|
| -X | Allows us to specify HTTP method |
|
| -I | Only fetch headers |
|
| -d | Implies POST, used to send data |
|
| -L | Follow redirect |
|
| --limit-rate [speed] | Allows us to throttle download speed |
|
| -c | Download the cookies to a file |
|
| -i | Include response headers in output |
|
## Common Use Cases
POST JSON
curl -H "Content-Type: application/json" -d '{"id":1001}' [URL]
Custom methods
curl -X PUT URL
curl -X PATCH URL
curl -X DELETE URL
## Basic Authentication
Inline passing username and password:
curl -u user:pass [URL]
Prompt for password in terminal (safer):
curl -u user [URL]
Pass API key in query string
curl "https://api.example.com/me?api_key=$API_KEY"