curl

Client for URLs. A tool to transfer data from or to a server, using one of the supported protocols (HTTP, HTTPS, FTP, etc.). Essential for testing APIs.

Synopsis

curl [options] [url]

Core Options

-X METHOD

Specify request method (GET, POST, PUT, DELETE, etc.).

-H 'Header: Value'

Add a custom header to the request.

-d 'data'

Send data (e.g., JSON) in a POST request.

-o file

Write output to <file> instead of stdout.

-I

Fetch the HTTP-header only.

-L

Follow redirects.

Usage Examples

GET Request

Fetch the content of a page.

curl https://api.github.com

Download File

Download a file and save it with a specific name.

curl -o archive.zip https://example.com/file.zip

POST JSON Data

Send a POST request with JSON body and Content-Type header.

curl -X POST -H 'Content-Type: application/json' -d '{"name":"John"}' https://api.example.com/users

Check Headers

View response headers only (useful for checking status codes or cache headers).

curl -I https://google.com

Follow Redirects

Follow 3xx redirects to the final destination.

curl -L http://google.com
Built for builders.