
HTTPie: How to Add a Header
Updated
Learn how to add custom headers to a request using HTTPie

Before we start, make sure you have HTTPie installed on your computer. If you don't have it yet, you can install it with Homebrew:
brew install httpie
First, open your terminal. To add a header, put the header name, a colon and the value after the URL:
http https://example.com X-Custom-Header:value
Just replace X-Custom-Header and value with your own header. If the value has spaces, wrap the whole header in quotes, and to send more than one, list them with spaces in between:
http https://example.com 'X-Custom-Header:Hello World' X-Foo:Bar
Remove or Empty a Header
To remove a header HTTPie adds by default, leave the value empty after the colon, like Accept:. To send a header with an empty value, put a semicolon after the name instead of a colon, like X-Empty-Header;. Be careful: X-Empty-Header:; sends a real ; as the value.
http https://example.com Accept: 'X-Empty-Header;'
Read a Header From a File
Use :@ to read the value from a file, so your token never shows up in your shell history:
http https://example.com Authorization:@token.txt
To check exactly which headers you're sending, add -v, or --offline to print the request without sending it.
