HTTP response headers show what a URL actually returned before the response body, retry logic, or application parsing hides the details. A quick header check is often enough to confirm the status line, content type, redirects, cache policy, cookies, and other metadata that explains why a request behaved the way it did.
For a normal GET request, curl can place the received header block before the body with -i, the short form of the current --show-headers option. The older --include long option remains accepted, and --dump-header writes the same received headers to a file when the body should stay separate.
Header inspection is different from sending a HEAD request. --head or -I asks the server for metadata without a response body, which can be rejected or handled differently from GET. Use the response-header options below when the question is which headers a normal request received, especially after redirects or authenticated API calls. Saved header files can contain cookies, redirect targets, and other sensitive values, so redact them before sharing.
Related: How to send HEAD requests with cURL
Related: How to view HTTP request headers with cURL
Tool: HTTP Header Checker
$ curl --silent --show-error -i https://api.example.net/headers
HTTP/1.1 200 OK
Server: ExampleHTTP/1.0
Date: Sat, 06 Jun 2026 00:00:00 GMT
Content-Type: application/json
Cache-Control: no-store
X-Request-Trace: sg-response-header-demo
Content-Length: 53
{"status":"ready","trace":"sg-response-header-demo"}
-i is the short form of --show-headers. Current curl documentation names the long option --show-headers, while older documentation and existing scripts may still use --include.
$ curl --silent --show-error -i --location https://api.example.net/redirect
HTTP/1.1 302 Found
Server: ExampleHTTP/1.0
Date: Sat, 06 Jun 2026 00:00:00 GMT
Location: /headers
Cache-Control: no-store
Content-Length: 0
HTTP/1.1 200 OK
Server: ExampleHTTP/1.0
Date: Sat, 06 Jun 2026 00:00:00 GMT
Content-Type: application/json
Cache-Control: no-store
X-Request-Trace: sg-response-header-demo
Content-Length: 53
{"status":"ready","trace":"sg-response-header-demo"}
With --location, curl shows each response block in order, so the last header block is the final response after the redirect chain.
$ curl --silent --show-error --dump-header response-headers.txt --output /dev/null https://api.example.net/headers
--output /dev/null discards the response body while --dump-header saves only the received headers.
Related: How to save cURL output to a file
$ cat response-headers.txt HTTP/1.1 200 OK Server: ExampleHTTP/1.0 Date: Sat, 06 Jun 2026 00:00:00 GMT Content-Type: application/json Cache-Control: no-store X-Request-Trace: sg-response-header-demo Content-Length: 53
Header files from authenticated requests can contain cookies, redirect targets, and other sensitive values, so redact them before sharing the file.
$ rm response-headers.txt