XH(1)
β¨ NAME β¨
Okay bestie, meet xh(1) π β the manual page for xh, aka the Friendly and fast tool for sending HTTP requests. π
π¦ SYNOPSIS π¦
xh [OPTIONS] [METHOD] URL [--] [REQUEST_ITEM ...]
π DESCRIPTION π
xh is an HTTP client with a friendly command line interface. It literally strives to have readable output and easy-to-use options. π
It's mostly compatible with HTTPie β see http(1). iykyk. β¨
The --curl option can be used to print a curl(1) translation of the command instead of sending a request. Obsessed with that trick. π₯
π POSITIONAL ARGUMENTS π
πΈ [METHOD]
The HTTP method to use for the request. π
This defaults to GET, or to POST if the request contains a body. Periodt.
π¦ URL
The URL to request. β¨
The URL scheme defaults to http:// normally, or https:// if the program is invoked as xhs.
A leading colon works as shorthand for localhost. :8000 is equivalent to localhost:8000, and :/path is equivalent to localhost/path. Cute, right? π
π§ [REQUEST_ITEM ...]
Optional key-value pairs to be included in the request. π«Ά
The separator is used to determine the type:
key==valueβ adds a query string to the URL. πkey=valueβ adds a JSON property (--json) or form field (--form) to the request body. πkey:=valueβ adds a field with a literal JSON value to the request body. Example:"numbers:=[1,2,3] enabled:=true"π₯key@filenameβ uploads a file (requires--formor--multipart). To set the filename and mimetype,;type=and;filename=can be used respectively. Example:"pfp@ra.jpg;type=image/jpeg;filename=profile.jpg"π@filenameβ uses a file as the request body. πheader:valueβ adds a header, e.g."user-agent:foobar". πheader:β unsets a header, e.g."connection:". πheader;β adds a header with an empty value. β
An @ prefix can be used to read a value from a file. For example: "x-api-key:@api-key.txt". π
A backslash can be used to escape special characters, e.g. "weird\:key=value". π¦
To construct a complex JSON object, the REQUEST_ITEM's key can be set to a JSON path instead of a field name. For more information on this syntax, refer to https://httpie.io/docs/cli/nested-json. πΈ
β¨ OPTIONS β¨
okay so bestie, this is the big options buffet, and itβs lowkey iconic. Every single --OPTION can be reset with a --no-OPTION argument. Slay.
-j,--jsonβ (default) Serialize data items from the command line as a JSON object. Overrides both--formand--multipart.-f,--formβ Serialize data items from the command line as form fields. Overrides both--jsonand--multipart.--multipartβ Like--form, but force amultipart/form-datarequest even without files. Overrides both--jsonand--form.--raw=RAWβ Pass raw request data without extra processing.--pretty=STYLEβ Controls output processing. Possible values are:allβ (default) Enable both coloring and formattingcolorsβ Apply syntax highlighting to outputformatβ Pretty-print json and sort headersnoneβ Disable both coloring and formatting
Defaults to "format" if the NO_COLOR env is set and to "none" if stdout is not tty.
--format-options=FORMAT_OPTIONSβ Set output formatting options. Supported option are:json.indent:<NUM>json.format:<true|false>xml.indent:<NUM>xml.format:<true|false>headers.sort:<true|false>
Example: --format-options=json.indent:2,headers.sort:false.
-s,--style=THEMEβ Output coloring style. Possible values:auto,solarized,monokai,fruity.--response-charset=ENCODINGβ Override the response encoding for terminal display purposes. Example:--response-charset=latin1.--response-mime=MIME_TYPEβ Override the response mime type for coloring and formatting for the terminal. Example:--response-mime=application/json.-p,--print=FORMATβ String specifying what the output should contain:Hβ request headersBβ request bodyhβ response headersbβ response bodymβ response metadata
Example: --print=Hb.
-h,--headersβ Print only the response headers. Shortcut for--print=h.-b,--bodyβ Print only the response body. Shortcut for--print=b.-m,--metaβ Print only the response metadata. Shortcut for--print=m.-v,--verboseβ Print the whole request as well as the response. Additionally, this enables--allfor printing intermediary requests/responses while following redirects. Using verbose twice i.e.-vvwill print the response metadata as well. Equivalent to--print=HhBb --all.--debugβ Print full error stack traces and debug log messages. Logging can be configured in more detail using the$RUST_LOGenvironment variable. SetRUST_LOG=traceto show even more messages. Seehttps://docs.rs/env_logger/0.11.3/env_logger/#enabling-logging.--allβ Show any intermediary requests/responses while following redirects with--follow.-P,--history-print=FORMATβ The same as--printbut applies only to intermediary requests/responses.-q,--quietβ Do not print to stdout or stderr. Using quiet twice i.e.-qqwill suppress warnings as well.-S,--streamβ Always stream the response body.-x,--compressβ Content compressed (encoded) with Deflate algorithm. TheContent-Encodingheader is set todeflate. Compression is skipped if it appears that compression ratio is negative. Compression can be forced by repeating this option.
β οΈ Note: Compression cannot be used if the Content-Encoding request header is present.
-o,--output=FILEβ Save output to FILE instead of stdout.-d,--downloadβ Download the body to a file instead of printing it. TheAccept-Encodingheader is set toidentityand any redirects will be followed.-c,--continueβ Resume an interrupted download. Requires--downloadand--output.--session=FILEβ Create, or reuse and update a session. Within a session, custom headers, auth credentials, as well as any cookies sent by the server persist between requests.--session-read-only=FILEβ Create or read a session without updating it from the request/response exchange.-A,--auth-type=AUTH_TYPEβ Specify the auth mechanism. Possible values:basic,bearer,digest.-a,--auth=USER[:PASS] | TOKENβ Authenticate as USER with PASS (-A basic|digest) or with TOKEN (-A bearer). PASS will be prompted if missing. Use a trailing colon (i.e."USER:") to authenticate with just a username. TOKEN is expected if--auth-type=bearer.--ignore-netrcβ Do not use credentials from.netrc.--offlineβ Construct HTTP requests without sending them anywhere.--check-statusβ (default) Exit with an error status code if the server replies with an error. The exit code will be4on 4xx (Client Error),5on 5xx (Server Error), or3on 3xx (Redirect) if--followisn't set. If stdout is redirected then a warning is written to stderr.-F,--followβ Do follow redirects.--max-redirects=NUMβ Number of redirects to follow. Only respected if--followis used.--timeout=SECβ Connection timeout of the request. The default value is"0", i.e., there is no timeout limit.--proxy=PROTOCOL:URLβ Use a proxy for a protocol. For example:--proxy https:http://proxy.host:8080.PROTOCOLcan be"all","http"or"https". If your proxy requires credentials, put them in the URL, like so:--proxy http:socks5://user:password@proxy.host:8000. You can specify proxies for multiple protocols by repeating this option. The environment variables"ALL_PROXY","HTTP_PROXY"and"HTTPS_PROXY"can also be used, but are completely ignored if--proxyis passed.--verify=VERIFYβ If"no", skip SSL verification. If a file path, use it as a CA bundle. Specifying a CA bundle will disable the system's built-in root certificates."false"instead of"no"also works. The default is"yes"("true").--cert=FILEβ Use a client side certificate for SSL.--cert-key=FILEβ A private key file to use with--cert. Only necessary if the private key is not contained in the cert file.--ssl=VERSIONβ Force a particular TLS version."auto"gives the default behavior of negotiating a version with the server. Possible values:auto,tls1,tls1.1,tls1.2,tls1.3.--native-tlsβ Use the system TLS library instead of rustls (if enabled at compile time).--httpsβ Make HTTPS requests if not specified in the URL.--http-version=VERSIONβ HTTP version to use. Possible values:1.0,1.1,2,2-prior-knowledge,3-prior-knowledge.--resolve=HOST:ADDRESSβ Override DNS resolution for specific domain to a custom IP. You can override multiple domains by repeating this option. Example:--resolve=example.com:127.0.0.1.--interface=NAMEβ Bind to a network interface or local IP address. Example:--interface=eth0 --interface=192.168.0.2.-4,--ipv4β Resolve hostname to ipv4 addresses only.-6,--ipv6β Resolve hostname to ipv6 addresses only.--unix-socket=FILEβ Connect using a Unix domain socket. Example:xh :/index.html --unix-socket=/var/run/temp.sock.-I,--ignore-stdinβ Do not attempt to read stdin. This disables the default behaviour of reading the request body from stdin when a redirected input is detected. It is recommended to pass this flag when using xh for scripting purposes. For more information, refer tohttps://httpie.io/docs/cli/best-practices.--curlβ Print a translation to a curl command. For translating the other way, tryhttps://curl2httpie.online/.--curl-longβ Use the long versions of curl's flags.--generate=KINDβ Generate shell completions or man pages. Possible values are:complete-bashβ Generate completions for bashcomplete-elvishβ Generate completions for elvishcomplete-fishβ Generage completions for fishcomplete-nushellβ Generate completions for nushellcomplete-powershellβ Generate completions for powershellcomplete-zshβ Generate completions for zshmanβ Generate manual page in roff formatman-markdownβ Generate manual page in markdown format
Example: xh --generate=complete-bash > xh.bash.
--helpβ Print help.-V,--versionβ Print version.
π¦ EXIT STATUS π¦
0β Successful program execution.1β Usage, syntax or network error.2β Request timeout.3β Unexpected HTTP 3xx Redirection.4β HTTP 4xx Client Error.5β HTTP 5xx Server Error.6β Too many redirects.
π± ENVIRONMENT π±
XH_CONFIG_DIRβ Specifies where to look forconfig.jsonand named session data. The default is~/.config/xhfor Linux/macOS and%APPDATA%\xhfor Windows.XH_HTTPIE_COMPAT_MODEβ Enables the HTTPie Compatibility Mode. The only current difference is that--check-statusis not enabled by default. An alternative to setting this environment variable is to rename the binary to eitherhttporhttps.REQUESTS_CA_BUNDLE,CURL_CA_BUNDLEβ Sets a custom CA bundle path.ALL_PROXY=[protocol://]<host>[:port]β Sets the proxy server for all requests (unless overridden for a specific protocol).HTTP_PROXY=[protocol://]<host>[:port]β Sets the proxy server to use for HTTP.HTTPS_PROXY=[protocol://]<host>[:port]β Sets the proxy server to use for HTTPS.NO_PROXYβ List of comma-separated hosts for which to ignore the other proxy environment variables."*"matches all host names.NETRCβ Location of the.netrcfile.NO_COLORβ Disables output coloring. Seehttps://no-color.org.RUST_LOGβ Configure low-level debug messages. Seehttps://docs.rs/env_logger/0.11.3/env_logger/#enabling-logging.
π FILES π
~/.config/xh/config.jsonβ xh configuration file. The only configurable option is"default_options"which is a list of default shell arguments that gets passed to xh. Example:
{ "default_options": ["--native-tls", "--style=solarized"] }
~/.netrc,~/_netrcβ Auto-login information file.~/.config/xh/sessionsβ Session data directory grouped by domain and port number.
β¨ EXAMPLES β¨
okay bestie, this is the part where it gets good π here's a whole lil' tour of stuff you can do, copied exactly so you can just vibe-check each one and steal whatever you need π«Ά
xh httpbin.org/json
the classic. the icon. the main character. this just sends a GET request, periodt π
xh httpbin.org/json
xh httpbin.org/post name=ahmed age:=24
sends a POST request, and the body it ships off is literally {"name": "ahmed", "age": 24} β¨ (notice the := for the raw JSON value, that's the trick, iykyk)
xh httpbin.org/post name=ahmed age:=24
xh get httpbin.org/json id==5 sort==true
sends a GET request to http://httpbin.org/json?id=5&sort=true πΈ (the double-equals == is the query-string girlie, she goes straight into the URL)
xh get httpbin.org/json id==5 sort==true
xh get httpbin.org/json x-api-key:12345
sends a GET request and includes a header named X-Api-Key with the value 12345 π (single colon : = header, no cap)
xh get httpbin.org/json x-api-key:12345
echo "[1, 2, 3]" | xh post httpbin.org/post
sends a POST request where the body is read from stdin π¦ very "not me piping things into other things" of you, and we love that
echo "[1, 2, 3]" | xh post httpbin.org/post
xh put httpbin.org/put id:=49 age:=25 | less
sends a PUT request and then pipes the result straight into less π so you can scroll it like the distinguished gentleperson you are
xh put httpbin.org/put id:=49 age:=25 | less
xh -d httpbin.org/json -o res.json
downloads and saves to res.json π₯ that -d/-o combo is giving "saving my work before the wifi dies" energy
xh -d httpbin.org/json -o res.json
xh httpbin.org/get user-agent:foobar
makes a request with a custom user agent π
xh httpbin.org/get user-agent:foobar
xhs example.com
makes an HTTPS request to https://example.com β (yup β xhs, the HTTPS-only twin, tiny name change, big security energy)
xhs example.com
π REPORTING BUGS π
found a lil' gremlin in the code? π take it straight to xh's Github issues at <https://github.com/ducaale/xh/issues> β the maintainers fr fr want to hear about it, and honestly? be as specific as you can, bestie, it helps a ton π«Ά
π SEE ALSO π
go touch some other grass, these are the neighbours:
and if you want the full lore dump, HTTPie's online documentation lives at <https://httpie.io/docs/cli> π
aaand that's the whole page, bestie π you made it to the end, iconic behavior honestly π
this lil' rewrite is based on xh version 0.26.3, dated 2026-10-21 β go forth and make some requests, slay π
β¨π
π¦ where this page comes from
- arch rolling: xh 0.26.3-1 Β· MIT
- nixpkgs unstable: xh 0.26.3
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms