XH(1)
π XH(1) β User Commands π
okay bestie, welcome to the xh manual page, section 1 of the User Commands vibe. grab a boba, we're sending HTTP requests and we're gonna look cute doing it π«Ά
β¨ NAME β¨
xh β friendly and fast tool for sending HTTP requests
like literally it's an HTTP client that is friendly AND fast, both at once, slay.
πΈ SYNOPSIS πΈ
xh [OPTIONS] [METHOD] URL [--] [REQUEST_ITEM ...]
that's the whole shape of it. options first, then maybe a method, then the URL, and if you need to put the vibes after the URL, there's a -- to gatekeep the boundary. β¨
π¦ DESCRIPTION π¦
xh is an HTTP client with a friendly command line interface. it is striving β like genuinely putting in the work β to have readable output and easy-to-use options. no cap, that's the whole mission statement.
xh is mostly compatible with HTTPie β see http(1). so if you already know HTTPie you're basically already home π
and here's the iconic part: the --curl option can be used to print a curl(1) translation of the command instead of sending a request. so it just⦠hands you the curl version. it's giving translator. it's giving "let me say that in curl for you." obsessed.
π POSITIONAL ARGUMENTS π
[METHOD]
the HTTP method you want to use for the request. that's it, that's the job.
it defaults to GET, or to POST if the request contains a body. so like, no body, no method given? GET. body present? surprise, it's POST. iykyk.
URL
the URL to request. yes you do have to give it one, that's kind of the whole point bestie.
the URL scheme defaults to "http://" normally, or "https://" if the program is invoked as "xhs". so the name you call it by changes its whole personality. main character energy fr fr.
a leading colon works as shorthand for localhost. so:
":8000"is equivalent to"localhost:8000"":/path"is equivalent to"localhost/path"
the colon is the short king of hostnames π
[REQUEST_ITEM ...]
optional key-value pairs to be included in the request. this is where it gets fun.
the separator is used to determine the type. so like, the punctuation IS the instruction. let's go through them:
key==valueβ Add a query string to the URL.key=valueβ Add a JSON property (--json) or form field (--form) to the request body.key:=valueβ Add a field with a literal JSON value to the request body.
example: "numbers:=[1,2,3] enabled:=true" π₯
key@filenameβ Upload 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" β yes bestie, upload your pfp, set the type, set the name, all in one item. iconic.
@filenameβ Use a file as the request body.header:valueβ Add a header, e.g."user-agent:foobar"header:β Unset a header, e.g."connection:"header;β Add a header with an empty value.
π careful, bestie:header:valueadds a header,header:unsets one, andheader;adds one that's empty. three different punctuation marks, three completely different outcomes. do not mix them up.
an "@" prefix can be used to read a value from a file. for example: "x-api-key:@api-key.txt". so the secret stays in the file and your shell history stays clean, we love a privacy moment π
a backslash can be used to escape special characters, e.g. "weird\:key=value". because sometimes you really do mean a literal colon and the colon needs to chill.
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. π
that's part 1 bestie, don't go anywhere β there's more π
β¨ OPTIONS β¨
okay so quick thing before we dive in: every single --OPTION in this list can be undone with a --no-OPTION argument. yes literally, --no-follow, --no-json, whatever β it's the uno reverse card of flags. π
-j,--jsonβ (this is the default btw) Serialize data items from the command line as a JSON object.
Overrides both --form and --multipart. π
-f,--formβ Serialize data items from the command line as form fields.
Overrides both --json and --multipart.
--multipartβ Like--form, but force amultipart/form-datarequest even when there are no files involved. stubborn king behavior π
Overrides both --json and --form.
--raw=RAWβ Pass raw request data without extra processing. no thoughts, just vibes, just bytes.--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. (she knows when you're piping her somewhere, bestie, and she acts accordingly π)
--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 containHβ 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 --all for printing intermediary requests/responses while following redirects.
Using verbose twice i.e. -vv will print the response metadata as well.
Equivalent to --print=HhBb --all.
--debugβ Print full error stack traces and debug log messages. screaming into the void but productively π₯
Logging can be configured in more detail using the $RUST_LOG environment variable. Set RUST_LOG=trace to show even more messages. See https://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. -qq will suppress warnings as well. π€«
-S,--streamβ Always stream the response body.-x,--compressβ Content compressed (encoded) with Deflate algorithm.
The Content-Encoding header is set to deflate.
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 toFILEinstead of stdout.-d,--downloadβ Download the body to a file instead of printing it.
The Accept-Encoding header is set to identity and any redirects will be followed.
-c,--continueβ Resume an interrupted download. Requires--downloadand--output. (resume queen π )--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. look but don't touch energy π-A,--auth-type=AUTH_TYPEβ Specify the auth mechanism.
[possible values: basic, bearer, digest]
-a,--auth=USER[:PASS] | TOKENβ Authenticate asUSERwithPASS(-A basic|digest) or withTOKEN(-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. manifesting the request but not manifesting the response β¨--check-statusβ (default) Exit with an error status code if the server replies with an error.
The exit code will be 4 on 4xx (Client Error), 5 on 5xx (Server Error), or 3 on 3xx (Redirect) if --follow isn'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. living on the edge fr fr π
--proxy=PROTOCOL:URLβ Use a proxy for a protocol. For example:--proxy https:http://proxy.host:8080.
PROTOCOL can 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 --proxy is 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]
--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. gaslighting DNS, iconic tbh π
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 to https://httpie.io/docs/cli/best-practices.
--curlβ Print a translation to acurlcommand.
For translating the other way, try https://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. slay π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. See <https://no-color.org> β your no-color era πRUST_LOGβ Configure low-level debug messages. See <https://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 all clicks, fr fr. here's the whole vibe in action π
xh httpbin.org/jsonβ sends a GET request. that's it. that's the whole thing. iconic.xh httpbin.org/post name=ahmed age:=24β sends a POST request with the body{"name": "ahmed", "age": 24}. notice the:=onage?? that's the raw JSON one, so24stays a number and doesn't get quoted like a lil string π§xh get httpbin.org/json id==5 sort==trueβ sends a GET request tohttp://httpbin.org/json?id=5&sort=true. the==is your query-string bestie, and yes it'll assemble that whole URL for you πxh get httpbin.org/json x-api-key:12345β sends a GET request and slips in a header namedX-Api-Keywith the value12345. one colon = header, periodt.echo "[1, 2, 3]" | xh post httpbin.org/postβ sends a POST request where the body gets read straight from stdin π«Ά pipe it in, she'll take it.xh put httpbin.org/put id:=49 age:=25 | lessβ sends a PUT request and pipes the result right intoless. chef's kiss for long responses β¨xh -d httpbin.org/json -o res.jsonβ downloads and saves it tores.json.-dis download mode,-ois where it lands πΎxh httpbin.org/get user-agent:foobarβ makes a request with a custom user agent. you're the main character now, not the default one πxhs example.comβ makes an HTTPS request tohttps://example.com. lowercases, huge glow-up π
π REPORTING BUGS π
found something cursed?? not me gatekeeping, go tell the devs directly:
- xh's Github issues <https://github.com/ducaale/xh/issues>
no cap, that's the spot π
π SEE ALSO π
like,,,,, the extended universe besties:
curl(1),http(1)- HTTPie's online documentation <https://httpie.io/docs/cli>
iykyk πΈ
and that's a wrap on XH(1), bestie!! this page is from version 0.26.2, dated 2026-07-27, and you read the whole thing which is honestly main character energy ππ go forth and make requests, drink water, and remember: == is query, : is header, := is raw JSON. bye pookie ππ¦
π¦ where this page comes from
- ubuntu stonking: xh 0.26.2-1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms