home / http-apis / xh

xh

7.6k

HTTP client CLI for sending API requests, inspecting responses, downloading bodies, and reusing state with sessions.

$brew install xh
Language
Rust
Stars
7,637
Category
HTTP & APIs
Agent
AI Analysis

xh is a command-line HTTP client for calling APIs and other HTTP services with HTTPie-style request syntax. It covers request construction, response inspection, downloads, sessions, and curl translation from one binary.

What It Enables
  • Send HTTP requests with methods, headers, query params, JSON or form fields, multipart uploads, stdin or file bodies, auth, proxies, TLS controls, HTTP version selection, and Unix sockets.
  • Inspect response headers, body, or metadata separately, follow redirects, build requests offline before sending them, and translate an xh command into curl when needed.
  • Download response bodies with resume support and reuse cookies, auth, and custom headers across repeated API calls with session files.
Agent Fit
  • The command surface is mostly flag-driven and non-interactive, and xh fails on unexpected HTTP status codes by default, which makes inspect or change or verify loops safer in unattended runs.
  • Output control is script-friendly through --print, --body, --headers, --meta, --offline, and --ignore-stdin, but machine-readability is still limited because there is no dedicated structured output mode.
  • Best used as a generic HTTP primitive when an agent already knows the target API and wants direct shell access rather than a higher-level service CLI.
Caveats
  • Output formatting changes when stdout is a TTY, so automation should usually pin flags like --pretty=none, --print, and --ignore-stdin for deterministic behavior.
  • Some auth paths can prompt for missing credentials, and session files persist cookies and auth material on disk.