JSON-RPC API
A real API for your terminal. JSON-RPC over stdin/stdout. Automate anything.
Questions this answers
- iTerm2 Python API automate terminal alternative
- Programmatically open terminal tabs macOS
- Terminal automation API Unix socket
- Script terminal emulator open tabs run commands
- Automate terminal workflow macOS without AppleScript
How it works
Chau7 exposes a JSON-RPC 2.0 API over a Unix domain socket, allowing any programming language that can open a socket to automate the terminal. The socket path follows a predictable convention in the user's runtime directory, and the API uses standard JSON-RPC request/response framing with full error codes and result types. No SDK or library installation is required: a simple socat or netcat command can interact with the API for quick scripting.
The API surface covers tab management (create, close, list, focus, rename), command execution (send keystrokes, run commands, read output), history access (search, retrieve, export), snippet management (CRUD operations on saved commands), and settings modification (read and write preferences programmatically). Each method is documented with parameter types, return types, and error conditions.
Notifications are supported via JSON-RPC notification messages pushed from Chau7 to connected clients. Subscribe to events like tab creation, command completion, directory change, or bell ring to build reactive automation. A single persistent socket connection can issue commands and receive notifications simultaneously, enabling real-time terminal orchestration from external tools.
Why it matters
Most terminal emulators provide no automation API, forcing developers to use AppleScript, osascript hacks, or fragile keybinding simulation. Chau7 exposes a JSON-RPC API that lets any programming language create tabs, run commands, read output, and manage sessions programmatically. If you can send JSON, you can control Chau7.
Frequently asked questions
What protocol does the API use?
JSON-RPC 2.0 over a Unix domain socket. Any language or tool that can open a Unix socket and send JSON can interact with the API. No SDK required.
Can I automate tab creation and command execution?
Yes. The API supports creating tabs, running commands, reading output, managing history and snippets, and modifying settings. You can build complete terminal automation workflows.
Does the API support event notifications?
Yes. Subscribe to events like tab creation, command completion, directory changes, and bell rings. Notifications are pushed over the same socket connection for real-time reactive automation.