cURL HTTP and API Workflows/Conditional request with ETag

Use a saved ETag to avoid downloading unchanged content.

Section: Response Inspection

Conditional request with ETag

bash
bash
curl --etag-compare etag.txt -O https://example.com/data.json
Explanation

If the content is unchanged the server can return `304 Not Modified`.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Response Inspection
Save ETag metadata
Store ETag metadata for conditional requests.
OpenIn sheetbashsame section
Conditional request by modification time
Only fetch if the remote file is newer than a local file.
OpenIn sheetbashsame section
Request compressed response
Ask the server for a compressed response body.
OpenIn sheetbashsame section
Write headers to a file
Store response headers separately from the body.
OpenIn sheetbashsame section
Verbose HTTP/TLS details
Show detailed request and response conversation.
OpenIn sheetbashsame section
Full ASCII trace
Capture a detailed ASCII trace of the transfer.
OpenIn sheetbashsame section