Web Development · Cheatsheet
cURL HTTP Cheatsheet
GET, POST JSON, headers, auth, redirects, TLS, and useful script flags
36 commands 7 sections
No entry matches that filter.
-
curl https://example.com/GET a URL -
curl -I https://example.com/Headers only (HEAD) -
curl -i https://example.com/Include response headers -
curl -X PUT URLSet the HTTP method -
curl -X DELETE URLDELETE a resource -
curl -X PATCH URLPATCH a resource
-
curl -d "a=1&b=2" URLPOST form-encoded data -
curl -d @file.txt URLPOST body from a file -
curl --json '{"ok":true}' URLPOST JSON with type headers -
curl --json @data.json URLPOST JSON from a file -
curl -F "[email protected]" URLMultipart file upload -
curl --data-urlencode "q=a b" URLURL-encode a field
-
curl -H "Accept: application/json" URLAdd a request header -
curl -H "Authorization: Bearer TOKEN" URLSend a bearer token -
curl -u user:pass URLHTTP Basic auth -
curl -A "MyAgent/1.0" URLSet User-Agent -
curl -e https://referrer.example/ URLSet Referer -
curl -b "sid=abc" URLSend a Cookie header
-
curl -o file.bin URLWrite the body to a file -
curl -O URLSave using the remote filename -
curl -sS URLSilent progress, still show errors -
curl -v URLVerbose request and response -
curl -w "%{http_code}\n" -o /dev/null -s URLPrint the status code -
curl --compressed URLAsk for compressed content
-
curl -L URLFollow redirects -
curl -k URLSkip TLS certificate check -
curl --cacert ca.pem URLTrust a custom CA file -
curl --cert client.pem --key key.pem URLSend a client certificate -
curl --tlsv1.2 URLRequire TLS 1.2 or newer where supported
-
curl --connect-timeout 5 URLCap the connect phase -
curl --max-time 30 URLCap the whole transfer -
curl -f URLFail on HTTP error status -
curl --fail-with-body URLFail on HTTP error, keep the body -
curl -fsSL URLSilent, fail, show errors, follow redirects -
curl -D headers.txt URLWrite response headers to a file
-
https://curl.se/docs/manpage.htmlcurl manual: HTTP requests, redirects, authentication, TLS, and script options.
Related cheatsheets
Guides that use these commands
Tools for this work
- HTTP Status Code LookupSearch HTTP status codes by number or description. Get explanations, use cases, and solutions for every status code.
- HTTP Request BuilderBuild and send an HTTP request. Shows status, headers, and body. Public http and https hosts only.
- Security Headers AnalyzerCheck HTTP security headers for web applications and get improvement recommendations.