Skip to content

HTTP Requests

By default, orb uses GET. Use -X or --request to specify a different method:

Terminal window
orb -X POST https://api.example.com/users
orb -X PUT https://api.example.com/users/1
orb -X DELETE https://api.example.com/users/1
orb -X PATCH https://api.example.com/users/1

Add custom headers with -H or --header:

Terminal window
orb https://api.example.com \
-H "Authorization: Bearer token123" \
-H "Accept: application/json" \
-H "X-Custom-Header: value"

Orb automatically sets these headers:

  • Host: Derived from the URL
  • User-Agent: orb/<version>
  • Accept: */*

Custom headers override defaults with the same name.

Use -d or --data to send URL-encoded form data:

Terminal window
orb https://api.example.com/login \
-X POST \
-d "username=alice&password=secret"

This automatically sets Content-Type: application/x-www-form-urlencoded.

Prefix with @ to read data from a file:

Terminal window
orb https://api.example.com/data \
-X POST \
-d @payload.txt

The --json flag is a convenient way to send JSON:

Terminal window
orb https://api.example.com/users \
-X POST \
--json '{"name": "Alice", "email": "alice@example.com"}'

This automatically:

  • Sets Content-Type: application/json
  • Sends the data as the request body

Use -F or --form for multipart form uploads:

Terminal window
# Upload a file
orb https://api.example.com/upload \
-X POST \
-F "file=@/path/to/image.png"
# Multiple fields
orb https://api.example.com/upload \
-X POST \
-F "file=@/path/to/image.png" \
-F "title=My Image" \
-F "description=A beautiful sunset"

Orb automatically:

  • Detects the MIME type from the file extension
  • Generates a multipart boundary
  • Sets the appropriate Content-Type header
Terminal window
# Simple GET
orb https://api.example.com/users
# With query parameters (part of URL)
orb "https://api.example.com/users?page=2&limit=10"
# With custom headers
orb https://api.example.com/users \
-H "Accept: application/json" \
-H "Authorization: Bearer token"
FlagSets Content-Type
-dapplication/x-www-form-urlencoded
--jsonapplication/json
-Fmultipart/form-data; boundary=...

You can override the automatic Content-Type with a custom header:

Terminal window
orb https://api.example.com \
-X POST \
-d '{"custom": "data"}' \
-H "Content-Type: application/json"