https(1)
β¨ https(1) β HTTPie Manual β¨
okay bestie, sit down, hydrate, because we're about to make you genuinely dangerous with the command line. this is https, from the HTTPie manual. π
πΈ NAME πΈ
https
like, that's it, that's the whole name. iconic behaviour, no notes.
π¦ SYNOPSIS π¦
https [METHOD] URL [REQUEST_ITEM ...]
π DESCRIPTION π
HTTPie: modern, user-friendly command-line HTTP client for the API era.
that's the official one-liner and honestly? it ate. it's giving "curl but it actually respects you as a person."
π Positional arguments π
okay so these come after any flags, and in the exact order they're listed here. and listen β only URL is required. everything else is a lil bonus. β¨
METHODβ the HTTP method for the request (GET,POST,PUT,DELETE, ...).
you can literally just not provide it, and HTTPie will figure it out: it uses POST if there's some data to send, otherwise GET:
$ http example.org # => GET
$ http example.org hello=world # => POST
URLβ the request URL. if your URL doesn't include a scheme, it defaults tohttp://. (and yes you can override that with--default-scheme=http/https)
also there's a lil shorthand for localhost, because typing localhost is so much work:
$ 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 what type of thing it is. this is the part that lowkey unlocks everything:':'β HTTP headers:
Referer:https://httpie.io Cookie:foo=bar User-Agent:bacon/1.0
'=='β URL parameters to be appended to the request URI:
search==httpie
'='β data fields to be 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--formor--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 something in your field name, you escape it with a backslash:
field-name-with\:colon=value
π Predefined content types π
--json,-jβ this is the default, bestie. 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.
the Content-Type is set to application/x-www-form-urlencoded (if not specified). and heads up: the presence of any file fields results in a multipart/form-data request.
--multipartβ similar to--form, but it always sends amultipart/form-datarequest (i.e., even without files).--boundaryβ specify a custom boundary string formultipart/form-datarequests. only has effect only together with--form. (yes, "only has effect only" β that's what it says, we don't question the lore)--rawβ this option lets you pass raw request data without any extra processing (as opposed to the structured request items syntax):
$ http --raw='data' pie.dev/post
you can get the same result by piping the data via stdin:
$ echo data | http pie.dev/post
or you can have HTTPie load the raw data from a file:
$ http pie.dev/post @data.txt
π Content processing options π
--compress,-xβ content compressed (encoded) with the Deflate algorithm. theContent-Encodingheader is set todeflate.
compression is skipped if it appears that the compression ratio is negative. and if you really want it, you can force compression by repeating the argument. periodt.
π 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,-s STYLEβ output coloring style (default is"auto"). it can be one of:
auto, pie, pie-dark, pie-light, solarized
for finding out all available styles in 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 that the $TERM environment variable is set to "xterm-256color" or similar (e.g., via export TERM=xterm-256color in your ~/.bashrc). do this or your colors will look cursed, no cap.
--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-charset ENCODINGβ override the response encoding for terminal display purposes, e.g.:
--response-charset=utf8
--response-charset=big5
--response-mime MIME_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. these 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, as well as 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. iykyk. π
π«Ά Output options π«Ά
--print,-p WHATβ 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 is printed), if standard output is not redirected. 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. for the level one (with 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 like`tail -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 is useful also without --pretty: it ensures that the output is flushed more often and in smaller chunks.
--output,-o FILEβ save output toFILEinstead of stdout. if--downloadis also set, then only the response body is saved toFILE. 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 twice to suppress warnings as well. stdout is still redirected if--outputis specified. flag doesn't affect behaviour of download beyond not printing to terminal.
π§ Sessions π§
--session SESSION_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. yes, it remembers things for you. main character energy.
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-only SESSION_NAME_OR_PATHβ create or read a session without updating it form the request/response exchange. (yes, "form" β we're quoting the original, don't @ us π)
π Authentication π
--auth,-a USER[: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. cute, secure, thoughtful.--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.
bestie. that's only part 1 of this saga. more is coming, don't go anywhere π
π NETWORK π
--offlineβ builds the whole request and prints it out for you, but does NOT actually send it anywhere. window shopping, basically π--proxy PROTOCOL:PROXY_URLβ a string that maps a protocol to the URL of the proxy (likehttp:http://foo.bar:3128). you can stack multiple proxies for different protocols, no problem. and yes, the environment variables$ALL_PROXY,$HTTP_PROXY, and$HTTPS_proxyare supported too π«Ά--follow,-Fβ follow those 30xLocationredirects, bestie. chase the link, don't just stare at it π¦--max-redirectsβ by default requests cap out at 30 redirects (this one works together with--follow).--max-headersβ the max number of response headers to read before it gives up (default0, which means no limit at all).--timeout SECONDSβ the connection timeout of the request, in seconds. default is0, i.e. no timeout limit whatsoever. important tho: 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 (more precisely, if no bytes have been received on the underlying socket for timeout seconds). so it's the silent-treatment detector β¨--check-statusβ okay so by default HTTPie exits with0when no network or other fatal errors happen. this flag tells it to ALSO check the HTTP status code and exit with an error if the status is giving error.
when the server replies with a 4xx (Client Error) or 5xx (Server Error) status code, HTTPie exits with 4 or 5 respectively. and if the response is a 3xx (Redirect) and --follow hasn't been set, then the exit status is 3. also, an error message gets written to stderr if stdout is redirected. π
--path-as-isβ bypass that dot segment (/../or/./) URL squashing. no squashing today, the path stays exactly as you typed it π--chunkedβ turns on streaming via chunked transfer encoding. theTransfer-Encodingheader gets set tochunked. iconic behavior π
π SSL π
--verifyβ set it to"no"(or"false") to skip checking the host's SSL certificate. defaults to"yes"("true"). you can also hand it the path to aCA_BUNDLEfile for private certs. (or alternatively, set theREQUESTS_CA_BUNDLEenvironment variable instead.) β--sslβ the desired protocol version to use. this defaults to SSL 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 get 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 can specify--cert-keyseparately.--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 use 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. no cap π
π οΈ TROUBLESHOOTING π οΈ
--ignore-stdin,-Iβ do not attempt to read stdin. minding its own business fr fr π--helpβ show this help message and exit.--manualβ show the full manual. (yes, the whole thing, the big one π)--versionβ show version and exit.--tracebackβ prints the exception traceback should one occur.--default-schemeβ the default scheme to use if it's not specified in the URL.--debugβ prints the exception traceback should one occur, plus other info that's useful for debugging HTTPie itself and for reporting bugs. the full detective mode π
π SEE ALSO π
for every --OPTION there is also a --no-OPTION that reverts OPTION back to its default value. symmetry, we love to see it π
suggestions and bug reports are greatly appreciated:
https://github.com/httpie/cli/issues
and that's the whole page, bestie!! πβ¨ this was HTTPie 3.2.4 from 2024-07-10, filed under https(1) β go forth and slay those requests, mwah π
π«Ά
π¦ 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
- nixos 26.05: python3.13-httpie 3.2.4
- nixos 26.05: python3.14-httpie 3.2.4
- nixpkgs unstable: python3.13-httpie 3.2.4
- nixpkgs unstable: python3.14-httpie 3.2.4
- 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