Most of the time, we find ourselves in situations that require us to configure and troubleshoot web servers. This involves identifying and resolving issues and misconfiguration in the servers, code, network etc. In most scenarios, people look at the logs, use cURL to test the endpoints, check connectivity, permissions, backend services, review code etc. In this guide, I will introduce a new and simplified web service interaction method.
HTTPie, pronounced as aitch-tee-tee-pie is an HTTP client that simplifies the interaction with web services. This tool is developed to help test, debug and interact with APIs and HTTP servers with minimal effort. By using http
& https
commands, you can easily create and send arbitrary HTTP requests. A simple and natural syntax is used, providing formatted and colourized output.
HTTPie provides several features, among them are:
- It has built-in JSON support
- Expressive and intuitive syntax
- Formatted and colorized terminal output
- HTTPS, proxies, and authentication
- It supports forms and file uploads
- Custom headers
- Arbitrary request data
- It has wget-like downloads
- It supports persistent sessions
Let’s dive in!
Install HTTPie on Your System
HTTPie can be installed in several ways on MacOS, Linux, Windows and FreeBSD systems. Below are some of the methods for installing HTTPie.
a. Installing HTTPie CLI
Depending on your system, you can install HTTPie CLI by following the below steps.
- On Linux
Begin by adding the repositories that provide the packages.
##On Debian/Ubuntu
sudo apt update && sudo apt install curl -y
curl -SsL https://packages.httpie.io/deb/KEY.gpg | sudo gpg --dearmor -o /usr/share/keyrings/httpie.gpg
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/httpie.gpg] https://packages.httpie.io/deb ./" | sudo tee /etc/apt/sources.list.d/httpie.list
sudo apt update && sudo apt install httpie
##On CentOS/RHEL/Rocky/AlmaLinux
sudo yum install epel-release
sudo yum install httpie
##On Fedora
sudo dnf install httpie
##On Arch Linux
sudo pacman -Syu httpie
##Using SnapCraft
snap install httpie
- On MacOS
To install HTTPie on MacOS, use any of the preferred methods below
##Using HomeBrew
bew update
brew install httpie
##Using MacPorts
port selfupdate
port install httpie
- On Windows
On Windows, you need to have Chocolatey installed. Then proceed and install HTTPie by executing the below command:
choco install httpie
b. Installing HTTPie Desktop
HTTPie also provides a desktop app that can be installed on Linux, Windows and MacOS systems. Below are the commands and steps of installation.
- On Linux
On Linux, we use the AppImage to run the HTTPie Desktop. Download the latest release of the HTTPie AppImage from the release page. You can also use wget as shown.
Export the latest available version.
VER=$(curl --silent "https://api.github.com/repos/httpie/desktop/releases/latest"|grep '"tag_name"'|sed -E 's/.*"([^"]+)".*/\1/'|sed 's/v//')
echo $VER
Pull the image with the command:
wget https://github.com/httpie/desktop/releases/download/v$VER/HTTPie-$VER.AppImage
Once downloaded, make the file executable.
chmod +x HTTPie-$VER.AppImage
Then run the app with the command:
./HTTPie-$VER.AppImage
HTTPie will start as shown.

You can also install and use AppImageLauncher to run the application.
- On Windows
Download the latest Windows release(EXE) from the release page. Double-click on the downloaded file and then follow the steps required to install the EXE file
- On macOS
Download the latest available release(DMG) for MacOS from the release. Once downloaded, click on the file and follow the procedure of installing an app on MacOS
Using HTTPie HTTP client for the API
After installing it, we need to see how we can use HTTPie as a client for the API. The basic syntax of the HTTPie command is:
http [flags] [METHOD] URL [ITEM [ITEM]]
To get more information when stuck, you can use
http --help
##OR
man http
Below are some of the examples of the HTTPie commands.
HTTPie Usage Examples
For this guide, we will cover some of the examples of HTTPie.
To check if a site is working and obtain general information, you can use:
https <URL>
##Or
http <URL>
For example:

The default scheme is http:// and can be omitted in the URL. So the URL can be:
http example.org
- Custom HTTP method, HTTP headers and JSON data
http PUT pie.dev/put X-API-Token:123 name=Klinsmann
Sample output:
.....
{
"args": {},
"data": "{\"name\": \"Klinsmann\"}",
"files": {},
"form": {},
"headers": {
"Accept": "application/json, */*;q=0.5",
"Accept-Encoding": "gzip",
"Cdn-Loop": "cloudflare",
"Cf-Connecting-Ip": "138.201.255.67",
"Cf-Ipcountry": "DE",
"Cf-Ray": "82fa5291989d19b1-FRA",
"Cf-Visitor": "{\"scheme\":\"http\"}",
"Connection": "Keep-Alive",
"Content-Length": "21",
"Content-Type": "application/json",
"Host": "pie.dev",
"User-Agent": "HTTPie/3.2.1",
"X-Api-Token": "123"
},
"json": {
"name": "Klinsmann"
},
"origin": "138.201.255.67",
"url": "http://pie.dev/put"
}
- Submit Forms
You can also submit forms using -f
flag with the syntax:
http -f <URL>/post foo=bar
For example:
http -f POST pie.dev/post hello=World
You can see the request being sent with the output command below:
http -v pie.dev/get
- Offline Mode
You also have the option of building and printing a request offline as shown:
http --offline pie.dev/post hello=offline
- POST to API with Authentication
You can also use the POST flag to post a comment on a site that requires authentication using the syntax:
http -a USERNAME POST <URL> body='Add your Comment here'
A good example is posting a comment using the GitHub API as shown:
http -a <USERNAME> POST https://api.github.com/repos/httpie/cli/issues/83/comments body='I have successfully installed HTTPie'
This command will post the comment to the forum provided in the URL section.
- Download and Save a file
It is also possible to download and save a file using redirected output. The syntax for that is as follows:
http URL_TO_FILE > OUTPUT_FILE
For example, when saving an image file, we will have the command as shown:
http pie.dev/image/png > image.png
It is also possible to download a file using the wget
style. For that, the syntax will be:
http --download URL_TO_FILE
For example:
http --download computingforgeeks.com/wp-content/uploads/2021/12/Install-and-Manage-Applications-on-Linux-using-AppImage0A.jpeg
- Make Persistent Sessions
You can also use named sessions and make them persistent. For example:
http --session=logged-in -a username:password pie.dev/get API-Key:123
- Set Custom header
You can use HTTPie to set a custom host header that helps you work around missing DNS records. For example:
http localhost:8000 Host:example.com
- Using HTTP Methods
You can use several HTTP methods such as GET
, POST
, HEAD
, PUT
, PATCH
, DELETE
etc. On thins you need to be aware of is that the method comes right before your URL. The command looks as shown:
http <HTTP_METHOD> URL
For example:
http DELETE pie.dev/delete
You can also use a custom method aside form the standard ones. For example:
http AHOY pie.dev/post
- Optional HTTP methods
You can use the HTTP methods without specifying them. The defaults for HTTPie are:
GET
for requests without bodyPOST
for requests with body
For example the command:
http GET pie.dev/get
This command can be shortened to:
http pie.dev/get
For requests with data, we can use POST:
http POST pie.dev/post hello=world
Which can be shortened to:
http pie.dev/post hello=world
Verdict
This guide has covered some of the examples to help you get started with HTTPie, there are many more examples of using this tool. See the HTTPie documentation page. I hope this was informative.
Interested in more? See below:
- How to delete Elasticsearch Index data with curl
- Install YOURLS – Your Own URL Shortener on Ubuntu
- Extract Website data, urls, emails, files and accounts using Photon crawler