---
source: https://iinventedlight.com/library/notes/curl-custom-headers.md
title: "curl -H adds or replaces an HTTP request header"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "CC-BY-4.0 (Everything curl); curl license (MIT-derived) (curl/curl (GitHub)); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "Summary by iinventedlight (AI-assisted). Sources: Everything curl, Customize headers; curl/curl (GitHub), --header. CC-BY-4.0 (https://raw.githubusercontent.com/curl/everything-curl/master/LICENSE). Copyright the everything curl authors. curl license (MIT-derived) (https://raw.githubusercontent.com/curl/curl/master/COPYING). Copyright (c) 1996 - 2026, Daniel Stenberg, and many contributors."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-23
status: published
approved_by: "Cole Withington, 2026-11-27 14:30 PT: \"Yes, publish all of that now\""
checked_on: 2026-11-23
as_of: 2026-11-23
confidence: medium
untested: "Not reproduced (2026-11-23). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-cli: curl custom headers"
tags: [curl, headers, http, --header]
client: Librarian
sources:
  - id: S1
    title: "Customize headers"
    publisher: Everything curl
    url: https://everything.curl.dev/http/modify/headers.html
    accessed: 2026-11-23
    license: "CC-BY-4.0"
  - id: S2
    title: "--header"
    publisher: curl/curl (GitHub)
    url: https://github.com/curl/curl/blob/master/docs/cmdline-opts/header.md
    accessed: 2026-11-23
    license: "curl license (MIT-derived)"
---
# curl -H adds or replaces an HTTP request header
**Answer:** curl -H or --header lets you add a header to the request. When used in an HTTP request, that header is added to the regular request headers. All headers set by curl itself can be replaced by the user. Like this: curl -H "Empty;" http://example.com

## Notes

Pass -H more than once to set several headers. The man page describes --header as an extra header to include in information sent.

## See also

- [curl-follow-redirects](https://iinventedlight.com/library/notes/curl-follow-redirects/)
- [curl-post-data](https://iinventedlight.com/library/notes/curl-post-data/)
- [curl-request-method](https://iinventedlight.com/library/notes/curl-request-method/)

## Claims

- id: C1
  claim: All headers set by curl itself can be replaced by the user.
  source: S1
  evidence: "All headers set by curl itself can be replaced, by the user."

- id: C2
  claim: An empty header can be sent with a trailing semicolon.
  source: S1
  evidence: "curl -H \"Empty;\" http://example.com"

- id: C3
  claim: --header adds an extra header to include in information sent.
  source: S2
  evidence: "Extra header to include in information sent."

- id: C4
  claim: On an HTTP request, the header is added to the regular request headers.
  source: S2
  evidence: "When used within an HTTP request, it is added to the regular request headers."

## Sources

- [S1] Customize headers. Everything curl. https://everything.curl.dev/http/modify/headers.html . License: CC-BY-4.0. Accessed 2026-11-23.

- [S2] --header. curl/curl (GitHub). https://github.com/curl/curl/blob/master/docs/cmdline-opts/header.md . License: curl license (MIT-derived). Accessed 2026-11-23.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Everything curl, Customize headers; curl/curl (GitHub), --header. CC-BY-4.0 (https://raw.githubusercontent.com/curl/everything-curl/master/LICENSE). Copyright the everything curl authors. curl license (MIT-derived) (https://raw.githubusercontent.com/curl/curl/master/COPYING). Copyright (c) 1996 - 2026, Daniel Stenberg, and many contributors. Text was condensed and changed from the originals.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
