Skip to main content
Rhetoric publishes official client libraries for TypeScript, Python, Rust, and Go. Each one exposes every operation in the API reference with typed inputs and outputs, so you can call Rhetoric without hand-writing HTTP requests. Use them on your backend, where your API key lives. They can also drive a filing session with its session token, as described below.

Install

The Python package is installed as rhetoric_py but imported as rhetoric. The Go package is named rhetoric.

Create a client

Every client takes the API URL and an API key. Keep the key on your backend.

Make a request

Operations are methods on the client. This example creates a filer and then starts a filing session for them.
The session token is only returned once, at creation time. Pass it to your frontend so the Element can drive the session.

Drive a filing session

The operations that read and advance a filing session, resume filing session and apply filing session event, authenticate with the session token instead of your API key. Create a second client with that token. The Element does this for you in the browser; do it yourself when you are building your own frontend or running an agent. This example sets a field and then advances to the next step. Each response carries a state_version, which you echo back on the next event.
The form reference describes what each form contains and how to fill it in. An application error such as stale_state or session_busy is reported like any other failure; see Error handling.

Error handling

Each library reports failures in the way that is idiomatic for its language:
  • TypeScript throws an error when an operation fails.
  • Python raises an exception when an operation fails.
  • Rust returns an Err when an operation fails.
  • Go returns an error when an operation fails. Use errors.As to distinguish an *rhetoric.OperationAppError from an *rhetoric.OperationTransportError.

Command line

If you would rather explore the API from a terminal, the Rhetoric CLI exposes the same operations as commands.