http(1)
πΈ NAME πΈ
http β okay bestie, this is the one, the icon, the main character π
This is the manual page for http(1), and honestly? It's giving legend behaviour. Sit down, grab a boba, we're doing this. π§
β¨ SYNOPSIS β¨
http [METHOD] URL [REQUEST_ITEM ...]
That's it. That's the whole vibe. π«Ά
π DESCRIPTION π
HTTPie: modern, user-friendly command-line HTTP client for the API era. β¨
No cap, it's the prettiest way to talk to an API from your terminal. π
π POSITIONAL ARGUMENTS π
So these little cuties come after any flags, and in the exact order they're listed here. Only URL is required β everything else is optional, like your third coffee of the day. β
METHODβ the HTTP method for the request (GET,POST,PUT,DELETE, ...). You can literally just skip it, and HTTPie will usePOSTif there's some data to send, otherwiseGET:
$ http example.org # => GET
$ http example.org hello=world # => POST
URLβ the request URL. If your URL doesn't have a scheme, it defaults to'http://'. (You can override this with:--default-scheme=http/https)
There's also a lil shorthand for localhost, and it ate:
$ http :3000 # => http://localhost:3000
$ http :/foo # => http://localhost/foo
REQUEST_ITEMβ optional key-value pairs to include in the request. The separator you use decides the type, so pay attention bestie:
':' HTTP headers:
Referer:https://httpie.io Cookie:foo=bar User-Agent:bacon/1.0
'==' URL parameters, appended to the request URI:
search==httpie
'=' Data fields, serialized into a JSON object (with --json, -j) or form data (with --form, -f):
name=HTTPie language=Python description='CLI HTTP client'
':=' Non-string JSON data fields (only with --json, -j):
awesome:=true amount:=42 colors:='["red", "green", "blue"]'
'@' Form file fields (only with --form or --multipart):
cv@~/Documents/CV.pdf
cv@'~/Documents/CV.pdf;type=application/pdf'
'=@' A data field like '=', but it takes a file path and embeds its content:
essay=@Documents/essay.txt
':=@' A raw JSON field like ':=', but it takes a file path and embeds its content:
package:=@./package.json
And if a separator is colliding with your field name? Escape it with a backslash, bestie:
field-name-with\:colon=value
π¦ PREDEFINED CONTENT TYPES π¦
--json,-jβ (this is the default, btw) Data items from the command line get serialized as a JSON object. TheContent-TypeandAcceptheaders are set toapplication/json(if not specified).--form,-fβ Data items from the command line get serialized as form fields. TheContent-Typeis set toapplication/x-www-form-urlencoded(if not specified). And the presence of any file fields results in amultipart/form-datarequest. π«--multipartβ Similar to--form, but it always sends amultipart/form-datarequest (i.e., even without files). Periodt.--boundaryβ Specify a custom boundary string formultipart/form-datarequests. Only has effect together with--form.--rawβ This lets you pass raw request data without extra processing (as opposed to the structured request items syntax):
$ http --raw='data' pie.dev/post
You can achieve the same thing by piping the data via stdin:
$ echo data | http pie.dev/post
Or have HTTPie load the raw data from a file:
$ http pie.dev/post @data.txt
π₯ CONTENT PROCESSING OPTIONS π₯
--compress,-xβ Content gets compressed (encoded) with the Deflate algorithm. TheContent-Encodingheader is set todeflate. Compression is skipped if it appears that the compression ratio is negative. Compression can be forced by repeating the argument. πͺ
π OUTPUT PROCESSING π
--prettyβ Controls output processing. The value can be"none"to not prettify the output (default for redirected output),"all"to apply both colors and formatting (default for terminal output),"colors", or"format".--style,-sSTYLE β Output coloring style (default is"auto"). It can be one of:
auto, pie, pie-dark, pie-light, solarized
For finding out all available styles on your system, try:
$ http --style
The "auto" style follows your terminal's ANSI color styles. For non-auto styles to work properly, please make sure the $TERM environment variable is set to "xterm-256color" or similar (e.g., via export TERM=xterm-256color in your ~/.bashrc). π¨
--unsortedβ Disables all sorting while formatting output. It's a shortcut for:
--format-options=headers.sort:false,json.sort_keys:false
--sortedβ Re-enables all sorting options while formatting output. It's a shortcut for:
--format-options=headers.sort:true,json.sort_keys:true
--response-charsetENCODING β Override the response encoding for terminal display purposes, e.g.:
--response-charset=utf8
--response-charset=big5
--response-mimeMIME_TYPE β Override the response mime type for coloring and formatting for the terminal, e.g.:
--response-mime=application/json
--response-mime=text/xml
--format-optionsβ Controls output formatting. Only relevant when formatting is enabled through (explicit or implied)--pretty=allor--pretty=format. The following are the default options:
headers.sort:true
json.format:true
json.indent:4
json.sort_keys:true
xml.format:true
xml.indent:2
You may use this option multiple times, and also specify multiple comma-separated options at the same time. For example, this modifies the settings to disable the sorting of JSON keys, and sets the indent size to 2:
--format-options json.sort_keys:false,json.indent:2
This is something you will typically put into your config file. ποΈ
π OUTPUT OPTIONS π
--print,-pWHAT β A string specifying what the output should contain:
'H' request headers
'B' request body
'h' response headers
'b' response body
'm' response metadata
The default behaviour is 'hb' (i.e., the response headers and body get printed), if standard output is not redirected. But if the output is piped to another program or to a file, then only the response body is printed by default.
--headers,-hβ Print only the response headers. Shortcut for--print=h.--meta,-mβ Print only the response metadata. Shortcut for--print=m.--body,-bβ Print only the response body. Shortcut for--print=b.--verbose,-vβ Verbose output, we love a chatty king π. For level one (with a single-v/--verbose), print the whole request as well as the response. Also print any intermediary requests/responses (such as redirects). For the second level and higher, print these as well as the response metadata.
Level one is a shortcut for: --all --print=BHbh Level two is a shortcut for: --all --print=BHbhm
--allβ By default, only the final request/response is shown. Use this flag to show any intermediary requests/responses as well. Intermediary requests include followed redirects (with--follow), the first unauthorized request when Digest auth is used (--auth=digest), etc.--stream,-Sβ Always stream the response body by line, i.e., behave liketail -f.
Without --stream and with --pretty (either set or implied), HTTPie fetches the whole response before it outputs the processed data.
Set this option when you want to continuously display a prettified long-lived response, such as one from the Twitter streaming API. π¦
It's useful also without --pretty: it ensures that the output is flushed more often and in smaller chunks.
--output,-oFILE β Save output to FILE instead of stdout. If--downloadis also set, then only the response body is saved to FILE. Other parts of the HTTP exchange are printed to stderr.--download,-dβ Do not print the response body to stdout. Rather, download it and store it in a file. The filename is guessed unless specified with--output [filename]. This action is similar to the default behaviour ofwget.--continue,-cβ Resume an interrupted download. Note that the--outputoption needs to be specified as well.--quiet,-qβ Do not print to stdout or stderr, except for errors and warnings when provided once. Provide it twice to suppress warnings as well. stdout is still redirected if--outputis specified. This flag doesn't affect the behaviour of download beyond not printing to terminal. π€«
π SESSIONS π
--sessionSESSION_NAME_OR_PATH β Create, or reuse and update a session. Within a session, custom headers, auth credential, as well as any cookies sent by the server persist between requests. π
Session files are stored in:
[HTTPIE_CONFIG_DIR]/<HOST>/<SESSION_NAME>.json.
See the following page to find out your default HTTPIE_CONFIG_DIR:
https://httpie.io/docs/cli/config-file-directory
--session-read-onlySESSION_NAME_OR_PATH β Create or read a session without updating it from the request/response exchange. Just vibes, no writes. π§
π AUTHENTICATION π
--auth,-aUSER[:PASS] | TOKEN β For username/password based authentication mechanisms (e.g. basic auth or digest auth), if only the username is provided (-a username), HTTPie will prompt for the password. π--auth-type,-Aβ The authentication mechanism to be used. Defaults to"basic".
"basic": Basic HTTP auth
"digest": Digest HTTP auth
"bearer": Bearer HTTP Auth
To see all available auth types on your system, including ones installed via plugins, run:
$ http --auth-type
--ignore-netrcβ Ignore credentials from.netrc. π
π Network
okay so this is where we tell httpie how to actually go outside and talk to the internet, and bestie, there are SO many knobs. let's go. π
--offlineβ builds the request and prints it out like a little show-and-tell, but does NOT actually send it. zero network. all vibes, no delivery. π«Ά--proxy PROTOCOL:PROXY_URLβ a string that maps a protocol to the URL of a proxy, likehttp:http://foo.bar:3128. you can stack up multiple proxies for different protocols, no problem. and the environment variables$ALL_PROXY,$HTTP_PROXY, and$HTTPS_proxyare supported too, so you can just set it and forget it. β¨--follow,-Fβ follow those 30xLocationredirects. go where the server points you. π¦--max-redirectsβ by default requests cap out at 30 redirects (and yeah, this one works with--follow). so it's not infinite, thank god.--max-headersβ the maximum number of response headers to read before giving up. the default is0, which means no limit at all. go off, read every single one. π--timeout SECONDSβ the connection timeout of the request, in seconds. default value is0, i.e. there's literally no timeout limit. IMPORTANT: this is not a time limit on the entire response download. it's more like β an error gets reported if the server hasn't issued a response for timeout seconds (and to be precise, if no bytes have been received on the underlying socket for timeout seconds). so it's a "hey are you alive" check, not a "hurry up and finish" check. π--check-statusβ by default, HTTPie exits with0when no network or other fatal errors occur, period. this flag makes it also check the HTTP status code and exit with an error if the status is giving error. here's the tea:- server replies with a
4xx(Client Error) or5xx(Server Error) β HTTPie exits with4or5respectively. - response is a
3xx(Redirect) and--followhasn't been set β exit status is3. - also, an error message gets written to
stderrifstdoutis redirected. π
- server replies with a
--path-as-isβ bypass the dot segment (/../or/./) URL squashing. sometimes you just want your path to stay exactly how you wrote it. iconic.--chunkedβ enable streaming via chunked transfer encoding. theTransfer-Encodingheader gets set tochunked. stream it, bestie. π₯
π SSL
the security section, aka where we keep your certs safe and sound. π
--verifyβ set it to"no"(or"false") to skip checking the host's SSL certificate. defaults to"yes"("true"). you can also pass the path to aCA_BUNDLEfile for private certs. (or you can set theREQUESTS_CA_BUNDLEenvironment variable instead β same energy, different outfit. π )--sslβ the desired protocol version to use. this defaults toSSL v2.3, which will negotiate the highest protocol that both the server and your installation of OpenSSL support. heads up: the available protocols may vary depending on your OpenSSL installation (only the supported ones are shown here). π--ciphersβ a string in the OpenSSL cipher list format.
see http --help for the default ciphers list on you system.
--certβ you can specify a local cert to use as a client side SSL certificate. this file may either contain both the private key and the certificate, or you may specify--cert-keyseparately. your call, queen. π--cert-keyβ the private key to use with SSL. only needed if--certis given and the certificate file doesn't contain the private key.--cert-key-passβ the passphrase to be used to with the given private key. only needed if--cert-keyis given and the key file requires a passphrase. if you don't provide it, you'll be prompted interactively. π
π οΈ Troubleshooting
when things are Not Behaving, this is your group chat of last resorts.
--ignore-stdin,-Iβ do not attempt to read stdin. hands off the keyboard input. π«--helpβ show this help message and exit. the classic.--manualβ show the full manual. that's... this! hi bestie!! π«Ά--versionβ show version and exit.--tracebackβ prints the exception traceback should one occur. all the gory details.--default-schemeβ the default scheme to use if not specified in the URL.--debugβ prints the exception traceback should one occur, as well as other information useful for debugging HTTPie itself and for reporting bugs. the full deep-dive. π
π SEE ALSO
- for every
--OPTIONthere is also a--no-OPTIONthat reverts OPTION to its default value. so like, the undo button for every single flag. love that for us. π - suggestions and bug reports are greatly appreciated:
https://github.com/httpie/cli/issues
and that's the whole thing, bestie!! π this page is from HTTPie 3.2.4, dated 2024-07-10, and it lives in section http(1) of the manual. go forth and make some requests, you absolute icon. periodt. π
β¨π
π¦ where this page comes from
- alpine 3.24: httpie-doc 3.2.4-r2 Β· BSD-3-Clause
- arch rolling: httpie 3.2.4-2 Β· BSD-3-Clause
- debian trixie: httpie 3.2.4-3 Β· BSD-3-Clause
- fedora 43: httpie 3.2.4-11.fc43 Β· BSD-3-Clause
- fedora 44: httpie 3.2.4-12.fc44 Β· BSD-3-Clause
- opensuse-leap 16.0: httpie 3.2.4-bp160.1.3 Β· BSD-3-Clause
- ubuntu questing: httpie 3.2.4-3
- ubuntu resolute: httpie 3.2.4-4 Β· BSD-3-Clause
- ubuntu stonking: httpie 3.2.4-4 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms