A command-line interface for interacting with osTicket using the unofficial osTicket API. Written in Go for fast, single-binary deployment.
This CLI requires the osTicket Unofficial API to be installed on your osTicket server.
# Clone the repository
cd osticket-cli-go
# Build the binary
go build -o osticket ./cmd/osticket
# Optional: Move to PATH
sudo mv osticket /usr/local/bin/Download the appropriate binary for your platform from the releases page.
The CLI can be configured via environment variables or a config file. Environment variables take precedence.
export OSTICKET_BASE_URL="https://your-osticket.com/ost_wbs/"
export OSTICKET_API_KEY="YOUR_API_KEY"# Set the API URL and key
osticket config set --url https://your-osticket.com/ost_wbs/ --key YOUR_API_KEY
# View current configuration (shows source: env or config)
osticket config show
# Clear configuration
osticket config clearConfiguration file is stored in ~/.osticket-cli/config.yaml
- Environment variables (
OSTICKET_BASE_URL,OSTICKET_API_KEY) - Config file (
~/.osticket-cli/config.yaml)
# Get a specific ticket by ID or ticket number
osticket ticket get 12345
osticket ticket get API123
# Search tickets by user email
osticket ticket search --email user@example.com
# Search tickets by ticket number
osticket ticket search --number API123
# Search tickets by status (0=all, 1=open, 2=resolved, 3=closed)
osticket ticket search --status 1
# Search tickets by date range
osticket ticket search --from 2024-01-01 --to 2024-12-31
# Output as JSON
osticket ticket search --status 0 --json# Create a new ticket
osticket ticket create \
--title "Issue with login" \
--subject "I cannot log into my account" \
--user-id 5
# With all options
osticket ticket create \
--title "Urgent: Server down" \
--subject "The main server is not responding" \
--user-id 5 \
--priority 3 \
--dept 2 \
--sla 1 \
--topic 1osticket ticket reply 12345 \
--body "We are looking into this issue." \
--staff-id 1osticket ticket close 12345 \
--body "Issue has been resolved." \
--staff-id 1 \
--username "admin"# Get user by ID
osticket user get --id 5
# Get user by email
osticket user get --email user@example.com
# Create a new user
osticket user create \
--name "John Doe" \
--email "john@example.com" \
--password "secretpassword" \
--phone "555-1234"# List all departments
osticket info departments
# List all help topics
osticket info topics
# List all SLA plans
osticket info sla| Status ID | Description |
|---|---|
| 0 | All (for search) |
| 1 | Open |
| 2 | Resolved |
| 3 | Closed |
| 4 | Archived |
| 5 | Deleted |
| Priority ID | Description |
|---|---|
| 1 | Low |
| 2 | Normal |
| 3 | High |
| 4 | Emergency |
# Linux AMD64
GOOS=linux GOARCH=amd64 go build -o osticket-linux-amd64 ./cmd/osticket
# Linux ARM64
GOOS=linux GOARCH=arm64 go build -o osticket-linux-arm64 ./cmd/osticket
# macOS AMD64
GOOS=darwin GOARCH=amd64 go build -o osticket-darwin-amd64 ./cmd/osticket
# macOS ARM64 (Apple Silicon)
GOOS=darwin GOARCH=arm64 go build -o osticket-darwin-arm64 ./cmd/osticket
# Windows
GOOS=windows GOARCH=amd64 go build -o osticket.exe ./cmd/osticketMIT
- osTicket Unofficial API by BMSVieira