DevOps & APIs • Published August 17, 2026

cURL Headers: How to Add, Inspect, Customise & Send HTTP Headers

Master HTTP headers in cURL. Learn how to set custom request headers with -H, inspect response headers with -I and -i, spoof User-Agent, and manage session cookies.

Learn everything about HTTP headers in cURL. Master adding custom headers with -H, inspecting response headers with -i/-I, dumping headers to disk, setting User-Agents, and cookie handling.

Frequently Asked Questions

Q1. How do I add multiple headers in a single cURL command?

Provide multiple -H flags: curl -H "Header1: Value1" -H "Header2: Value2" https://api.example.com.

Q2. How do I spoof or change the User-Agent in cURL?

Use the -A or --user-agent flag: curl -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64)" https://example.com.

Q3. How do I send and receive cookies with cURL headers?

Use -b "name=value" or -b cookies.txt to send cookies, and -c cookies.txt to write received cookies from Set-Cookie headers into a jar file.

Q4. How do I test CORS headers with cURL?

Send an Origin header: curl -I -H "Origin: https://app.devtooladda.com" -H "Access-Control-Request-Method: POST" -X OPTIONS https://api.example.com.