Skip to main content
Developer Tools

cURL & HTTP Network Requests

Essential

HTTP methods, custom headers, JSON POST payloads, bearer auth, SSL certificate verification, and timing metrics.

Instant Copy & SearchProduction Flagged SyntaxCurrent Flag Reference

cURL & HTTP Network Requests Interactive Command Directory

Browse, search, and copy battle-tested commands & syntax recipes (16 Total Commands).

16+ Verified Recipes
JSON POST Request-X POST, -H, -d
curl -X POST "https://api.example.com/v1/users" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer <token>" \ -d '{"name":"Alex","role":"Admin"}'

Send JSON payload with authentication headers to REST endpoint.

Inspect Headers Only-I, -L
curl -I -L "https://example.com"

Fetch only HTTP response headers and follow any redirects (-L).

File Download-o, --progress-bar
curl -o package.zip "https://cdn.example.com/build.zip" --progress-bar

Download remote file saving to specific filename with progress bar.

Measure Response Time-w <format>
curl -s -o /dev/null -w "HTTP: %{http_code} | Connect: %{time_connect}s | TTFB: %{time_starttransfer}s | Total: %{time_total}s\n" "https://google.com"

Profile network latency, DNS resolution, and Time To First Byte (TTFB).

Basic Authentication-u user:pass
curl -u "username:password" "https://api.example.com/admin"

Send HTTP Basic Authorization credentials automatically Base64-encoded.

Silent Output-sS
curl -sS "https://api.github.com/zen"

Suppress progress meters (-s) while still printing error messages if request fails (-S).

Headers & Inspection-Iv
curl -Iv https://api.helloaihub.tech/v1/health

Perform an HTTP HEAD request with verbose TLS handshake, certificate validation, and response headers.

JSON POST Requests-X POST -H -d
curl -X POST https://api.example.com/items -H 'Content-Type: application/json' -d '{"name":"widget","qty":10}'

Dispatch an HTTP POST request carrying raw JSON body data and appropriate Content-Type headers.

Authentication-H 'Authorization: Bearer <token>'
curl -H 'Authorization: Bearer YOUR_JWT_TOKEN' https://api.example.com/me

Authorize HTTP request with an OAuth 2.0 or JWT Bearer token header.

Multipart File Upload-F 'field=@file'
curl -F 'file=@/path/to/archive.zip' -F 'description=Build' https://api.example.com/upload

Upload binary files using multipart/form-data with mime boundary headers.

Resilient Downloads-C - -O
curl -C - -O https://cdn.example.com/large-iso.zip

Resume an interrupted large file download from the exact byte offset using the HTTP Range header.

HTTP Status Inspection-s -o /dev/null -w
curl -s -o /dev/null -w 'HTTP Code: %{http_code} | Total: %{time_total}s\n' https://helloaihub.tech

Suppress response body and output only the HTTP status code and total connection latency in seconds.

Proxy Routing-x socks5h://
curl -x socks5h://127.0.0.1:1080 https://api.ipify.org

Route HTTP traffic through a local SOCKS5 proxy with remote DNS resolution to prevent DNS leaks.

Protocol Negotiation--http2
curl --http2 -I https://www.google.com

Enforce HTTP/2 multiplexing protocol negotiation over TLS ALPN.

Retry Policies--retry 3 --retry-delay 5
curl --retry 3 --retry-delay 5 --retry-connrefused https://api.internal/health

Automatically retry failed HTTP requests up to 3 times with 5-second backoff delays on connection drops.

Timing Breakdown-w <format> -so /dev/null
curl -w 'DNS: %{time_namelookup}s | Connect: %{time_connect}s | TTFB: %{time_starttransfer}s | Total: %{time_total}s\n' -so /dev/null https://helloaihub.tech

Output granular network performance metrics: DNS lookup time, TCP connect time, and Time To First Byte (TTFB).

Zero Setup100% In-Browser Execution

Companion Developer Tools & Playgrounds

Accelerate command execution and syntax debugging with HelloAIHub suite of interactive tools.

Explore all developer tools

cURL & HTTP Network Requests: Command Groups & Quick Index

16 indexed entries across 16 sections
JSON POST Request1 items
Inspect Headers Only1 items
File Download1 items
Measure Response Time1 items
Basic Authentication1 items
Silent Output1 items
Headers & Inspection1 items
JSON POST Requests1 items
Authentication1 items
Multipart File Upload1 items
Resilient Downloads1 items
HTTP Status Inspection1 items
Proxy Routing1 items
Protocol Negotiation1 items
Retry Policies1 items
Timing Breakdown1 items

Highlighted Flags & Syntax Examples in cURL & HTTP Network Requests

curl -X POST "https://api.example.com/v1/users" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer <token>" \ -d '{"name":"Alex","role":"Admin"}'

Send JSON payload with authentication headers to REST endpoint.

Flags: -X POST, -H, -d
curl -I -L "https://example.com"

Fetch only HTTP response headers and follow any redirects (-L).

Flags: -I, -L
curl -o package.zip "https://cdn.example.com/build.zip" --progress-bar

Download remote file saving to specific filename with progress bar.

Flags: -o, --progress-bar
curl -s -o /dev/null -w "HTTP: %{http_code} | Connect: %{time_connect}s | TTFB: %{time_starttransfer}s | Total: %{time_total}s\n" "https://google.com"

Profile network latency, DNS resolution, and Time To First Byte (TTFB).

Flags: -w <format>

Frequently Asked Questions

Expert recommendations, common traps, and production best practices for cURL & HTTP Network Requests.

What is the difference between -d and --data-raw in cURL?

With -d, if the data starts with '@', cURL treats the string as a filename and reads file contents. --data-raw sends the string literally, preventing unintended file reads if your data string happens to begin with '@'.

Why is the -L flag essential when debugging URLs with cURL?

By default, cURL does not follow HTTP 301 or 302 redirects; it stops and prints the redirect response. -L instructs cURL to follow the 'Location' header until it reaches the final destination.

What is the difference between curl -s, -S, and -sS?

-s (silent) disables progress meter and error messages. -S (show-error) tells curl to output error messages if the request fails. Combining -sS runs silently on success but outputs descriptive diagnostic errors if an HTTP connection failure occurs.

Why is curl -k (--insecure) dangerous in production scripts?

The -k flag disables SSL/TLS certificate verification, allowing any active man-in-the-middle (MITM) attacker on the network to intercept, inspect, and forge API requests and auth tokens without detection. Always import corporate CA certs via --cacert instead.

How does curl handle HTTP redirects by default?

By default, curl does NOT follow HTTP 301, 302, or 307 redirects; it simply returns the redirect headers. Adding the -L (--location) flag instructs curl to automatically follow redirect chains to the final destination URL.

How can I send form-encoded POST requests with curl?

Use the --data or -d flag with key-value pairs separated by ampersands: curl -d 'grant_type=client_credentials&client_id=123' https://auth.example.com/token. curl automatically sets Content-Type: application/x-www-form-urlencoded.

Cross-Hub Skill Acceleration

Combine command lookups with active coding interviews and complete career paths.

Need More Cheat Sheets?

Explore developer cheat sheets and syntax guides on HelloAIHub.

Browse All Cheat Sheets