xh — Friendly and Fast HTTPie-Compatible HTTP Client in Rust
xh is a blazing-fast HTTP client with an HTTPie-compatible UX, written in Rust, shipping as a single static binary with built-in JSON syntax highlighting, forms, sessions, and HTTP/2.
What it is
xh is a command-line HTTP client written in Rust that provides an HTTPie-compatible user experience with better performance. It ships as a single static binary with built-in JSON syntax highlighting, form submission, session management, and HTTP/2 support. The syntax matches HTTPie, so existing HTTPie users can switch without relearning commands.
xh targets developers and API testers who want a fast, portable HTTP client for the terminal. Its single-binary distribution means no Python runtime dependency (unlike HTTPie) and near-instant startup times.
How it saves time or tokens
xh starts faster than HTTPie because it is a compiled binary, not a Python script. For developers making dozens of API calls during a debugging session, the accumulated startup time savings are noticeable. The built-in JSON highlighting and formatting mean you do not need to pipe output through jq for readability. Session support persists cookies and auth across requests without manual header management.
How to use
- Install xh:
brew install xh
- Make HTTP requests with readable syntax:
# GET with pretty JSON
xh httpbin.org/json
# POST JSON body with header
xh POST api.example.com/users name=alice role=admin \
Authorization:'Bearer $TOKEN'
# Form submission
xh -f POST example.com/login username=admin password=secret
- Use sessions for persistent cookies:
xh --session=myapi POST api.example.com/login
xh --session=myapi GET api.example.com/profile
Example
API testing workflow with xh:
# Test an API endpoint with JSON payload
xh POST https://api.example.com/v1/messages \
content-type:application/json \
model=claude-sonnet-4-20250514 \
max_tokens:=1024 \
messages:='[{"role":"user","content":"Hello"}]'
# Download a file
xh -d https://example.com/report.pdf -o report.pdf
# Follow redirects and show headers
xh -v --follow https://short.url/abc
The := syntax sends raw JSON values (numbers, arrays, booleans) without quoting.
Related on TokRepo
- AI Tools for API — API tools for testing and development
- AI Tools for DevOps — DevOps tools for debugging and infrastructure management
Common pitfalls
- The
=syntax sends string values;:=sends raw JSON. Using=for a number sends it as a string, which may cause API validation errors. - Session files store cookies and auth tokens in plain text. Protect session files with appropriate filesystem permissions.
- xh does not support HTTPie plugins. If you rely on HTTPie's plugin ecosystem, check whether xh covers your specific use case natively.
- Always check the official documentation for the latest version-specific changes and migration guides before upgrading in production environments.
- For team deployments, establish clear guidelines on configuration and usage patterns to ensure consistency across developers.
Frequently Asked Questions
Yes for most use cases. xh supports HTTPie's syntax for headers, JSON bodies, form data, and authentication. Some advanced HTTPie plugins and features may not be available in xh.
xh provides human-friendly syntax and formatted output by default. JSON is highlighted, headers are readable, and the request syntax is intuitive. curl provides more raw control but requires more flags and piping for readable output.
Yes. xh supports HTTP/2 natively without additional configuration. It negotiates the protocol version automatically with servers that support HTTP/2.
Sessions persist cookies, authentication, and custom headers across requests. Use --session=name to create or continue a session. Session data is stored in files that are reused on subsequent requests.
Yes. xh supports multipart file uploads using the @ syntax. For example: xh -f POST api.example.com/upload file@report.pdf uploads the file as multipart form data.
Citations (3)
- xh GitHub— xh is a fast HTTPie-compatible HTTP client written in Rust
- HTTPie Documentation— HTTPie-compatible CLI syntax for HTTP requests
- Rust Documentation— Rust static binary compilation for portable tools
Related on TokRepo
Discussion
Related Assets
Conda — Cross-Platform Package and Environment Manager
Install, update, and manage packages and isolated environments for Python, R, C/C++, and hundreds of other languages from a single tool.
Sphinx — Python Documentation Generator
Generate professional documentation from reStructuredText and Markdown with cross-references, API autodoc, and multiple output formats.
Neutralinojs — Lightweight Cross-Platform Desktop Apps
Build desktop applications with HTML, CSS, and JavaScript using a tiny native runtime instead of bundling Chromium.