HTTP Client
Send HTTP requests with full control over methods, headers, body, and query parameters.
HTTP Methods
Supported Methods
tgrs supports all standard HTTP methods. You can specify the method as the first argument or use the -X / --method flag.
# Method as first argument
tgrs GET https://api.example.com/users
tgrs POST https://api.example.com/users name:John
tgrs PUT https://api.example.com/users/1 name:Jane
tgrs PATCH https://api.example.com/users/1 status:active
tgrs DELETE https://api.example.com/users/1
# Using -X / --method flag
tgrs -X POST https://api.example.com/users
tgrs --method PUT https://api.example.com/users/1
HEAD Request
Use the -I / --head flag to send a HEAD request and see only the response headers.
# Using -I flag
tgrs -I https://api.example.com/users
# Using --head flag
tgrs --head https://api.example.com/users
Default Method
When no method is specified, tgrs defaults to GET. Specify the method explicitly for POST, PUT, PATCH, and DELETE requests.
# Defaults to GET
tgrs https://api.example.com/users
# Specify POST explicitly when sending data
tgrs POST https://api.example.com/users name:John
Headers
Custom Headers
Add headers with -H / --header. You can use this flag multiple times to add multiple headers.
# Single header
tgrs GET https://api.example.com/data -H "Content-Type: application/json"
# Multiple headers
tgrs GET https://api.example.com/data \
-H "Authorization: Bearer token123" \
-H "Accept: application/json" \
-H "X-Request-Id: abc-123"
Headers Block
Use --headers to add multiple headers at once as comma-separated pairs or as a JSON object.
# Comma-separated format
tgrs GET https://api.example.com/data \
--headers "Accept: application/json, X-Api-Key: my-key"
User-Agent & Referer
Dedicated flags for commonly used headers.
# Set User-Agent with -A / --user-agent
tgrs GET https://api.example.com/data -A "MyApp/2.0"
tgrs GET https://api.example.com/data --user-agent "MyApp/2.0"
# Set Referer with -e / --referer
tgrs GET https://api.example.com/data -e "https://example.com"
tgrs GET https://api.example.com/data --referer "https://example.com"
Request Body
JSON Body (Default)
The simplest way to send JSON. Use key:value pairs directly as arguments — tgrs automatically constructs a JSON object and sets Content-Type to application/json.
# Key:value pairs become JSON
tgrs POST https://api.example.com/users \
name:John \
email:john@example.com \
age:30
Sends:
{"name": "John", "email": "john@example.com", "age": 30}
Raw Body with -d / --data / --body
Send a raw body string using any of these equivalent flags: -d, --data, or --body. All three are aliases for the same flag.
# Using -d (short form)
tgrs POST https://api.example.com/users \
-H "Content-Type: application/json" \
-d '{"name": "John", "email": "john@example.com"}'
# Using --data (long form)
tgrs POST https://api.example.com/users \
-H "Content-Type: application/json" \
--data '{"name": "John", "email": "john@example.com"}'
# Using --body (long form alias)
tgrs POST https://api.example.com/users \
-H "Content-Type: application/json" \
--body '{"name": "John", "email": "john@example.com"}'
-d) does not auto-set Content-Type — add it manually with -H. Content-Type is set automatically for: key:value pairs (application/json), form data (application/x-www-form-urlencoded), and multipart uploads (multipart/form-data).Body from File
Use the @filename prefix to read the body from a file. This works with -d, --data, and --body.
# Read body from a JSON file
tgrs POST https://api.example.com/users -d @payload.json
tgrs POST https://api.example.com/users --data @payload.json
tgrs POST https://api.example.com/users --body @payload.json
# Read body from any file
tgrs POST https://api.example.com/import \
-d @data.xml -H "Content-Type: application/xml"
Form Data
Use -f / --form to send URL-encoded form data instead of JSON. The Content-Type is set to application/x-www-form-urlencoded.
# URL-encoded form data
tgrs POST https://api.example.com/login \
-f -d "username=john&password=secret"
# Using --form
tgrs POST https://api.example.com/login \
--form -d "username=john&password=secret"
Multipart Form Data
Use -F / --file to send multipart form data — perfect for file uploads. You can use this flag multiple times for multiple fields.
# Upload a file
tgrs POST https://api.example.com/upload -F "avatar=@photo.jpg"
# File with additional fields
tgrs POST https://api.example.com/upload \
-F "file=@document.pdf" \
-F "description=My document" \
-F "tags=important"
age:30 for a number or include quotes for a string value.Reading from Stdin
Pipe URL from Stdin
tgrs can read the URL from standard input, making it easy to use with pipes.
# Pipe a URL from echo
echo "https://api.example.com/users" | tgrs
# Read URL from a file
cat url.txt | tgrs
Quick Reference
Body Flags at a Glance
| Flag | Alias | Description |
|---|---|---|
| -d | --data, --body | Raw body data or @file |
| -f | --form | Send as URL-encoded form |
| -F | --file | Multipart form field (repeatable) |
| -H | --header | Add custom header (repeatable) |
| --headers | Add multiple headers at once | |
| -A | --user-agent | Set User-Agent header |
| -e | --referer | Set Referer header |
| -X | --method | Override HTTP method |
| -I | --head | Send HEAD request |