Reference: every CLI command, CLI configuration, block types, the HTML bridge, the HTTP API and the FAQ
# HTTP API
> Use rply without the CLI.
The CLI is a thin wrapper around an HTTP API. You can call it directly from any language, or with `curl` in places where installing Node isn’t practical. All routes are under `/v1` on your server, e.g. `https://app.rply.sh/v1`. ## Authentication [Section titled “Authentication”](#authentication) Agents authenticate with their agent token as a bearer token:
```sh
-H "Authorization: Bearer rply_a_…"
```
The token determines the channel, so agent routes don’t need a channel id. Get a token with `rply init` or `rply join`; it’s stored in the CLI’s [config file](/docs/reference/cli-config/#config-file). ## Send a message [Section titled “Send a message”](#send-a-message)
```sh
curl -X POST https://app.rply.sh/v1/messages \
-H "Authorization: Bearer $RPLY_TOKEN" \
-H "Content-Type: application/json" \
-d '{"body":{"text":"Build #482 passed"}}'
```
```json
{"message":{"id":"fztfqpexn1956jpa","sender":"agent","created_at":1791843427399,"body":{"text":"Build #482 passed"}, …}}
```
The body takes `text`, `title` and `blocks`. Add `"silent": true` next to `body` to skip the push notification. ## Ask a question and wait for the answer [Section titled “Ask a question and wait for the answer”](#ask-a-question-and-wait-for-the-answer) A message with [input blocks](/docs/reference/blocks/#input-blocks) is a question:
```sh
curl -X POST https://app.rply.sh/v1/messages \
-H "Authorization: Bearer $RPLY_TOKEN" \
-H "Content-Type: application/json" \
-d '{"body":{"text":"Deploy?","blocks":[{"type":"choice","id":"answer","options":[{"label":"Deploy"},{"label":"Cancel"}]}]}}'
```
Then wait for it with a long-poll, using the id from the response:
```sh
curl "https://app.rply.sh/v1/asks/?wait=55" -H "Authorization: Bearer $RPLY_TOKEN"
```
The response is `{ message, answer }`. The question’s state is in `message.ask.status`: `open`, `answered`, `expired` or `cancelled`. While it’s still `open`, call again. ## Long-polling [Section titled “Long-polling”](#long-polling) Routes that take `wait` hold the request open for up to that many seconds and answer as soon as something changes. If nothing changes, they answer empty, and you ask again. Keep `wait` at 55 or below so proxies don’t cut the connection. ## Read messages from the person [Section titled “Read messages from the person”](#read-messages-from-the-person)
```sh
curl "https://app.rply.sh/v1/messages?sender=human&since=0&wait=55" \
-H "Authorization: Bearer $RPLY_TOKEN"
```
The response is `{ messages, cursor }`. Pass `cursor` as `since` on the next call. Reading as the agent marks the messages as seen; add `peek=1` to avoid that. ## Endpoints for agents [Section titled “Endpoints for agents”](#endpoints-for-agents) | Method and path | Description | | ---------------------------------------------- | -------------------------------------------------------------------------------------------------------- | | `POST /v1/messages` | Send a message or ask a question. | | `GET /v1/messages?since=&wait=&sender=&peek=1` | Read messages, optionally waiting. | | `PATCH /v1/messages/:id` | Edit a message: `title`, `text`, `blocks`, or `block_patches` merged by block id. | | `PUT /v1/messages/:id` | Replace a message’s body. | | `DELETE /v1/messages/:id` | Delete a message. | | `POST /v1/messages/:id/state` | Acknowledge a message from the person: `{ "state": "seen" \| "working" \| "done" }`. | | `POST /v1/messages/:id/cancel` | Cancel a question. | | `GET /v1/asks` | List open questions. | | `GET /v1/asks/:id?wait=` | Wait for a question’s answer. | | `GET /v1/pins` | List pinned messages. | | `PUT /v1/pins/:key` | Create or replace a pin. | | `PATCH /v1/pins/:key` | Update a pin. | | `DELETE /v1/pins/:key` | Remove a pin. | | `POST /v1/files?name=` | Upload a file as the raw request body, with its `Content-Type`. Returns `{ file_id, name, mime, size }`. | | `GET /v1/files/:id` | Download a file. | | `GET /v1/channel` | The channel’s details. | | `PATCH /v1/agent` | Rename this agent: `{ "label": "…" }`. | Secret requests also go through the API, but decrypting them requires the CLI’s key handling; use `rply secret request`. ## Other endpoints [Section titled “Other endpoints”](#other-endpoints) | Method and path | Description | | --------------- | ------------------------------------------------------------------------------------------------------------------------ | | `GET /health` | `{ "ok": true }` when the server is up. | | `GET /v1/info` | Public server info: whether it needs setup, registration mode, and which features (files, push, passkeys, email) are on. | ## Errors and limits [Section titled “Errors and limits”](#errors-and-limits) Errors return a JSON body with an `error` message and a matching status code: `400` for invalid input, `401` for a missing or revoked token, `404` for unknown ids, `409` when a question was already answered, and `429` when a rate limit is hit (120 writes a minute per channel).
# Blocks
> Every block type an agent can send, with examples.
Blocks are typed pieces of content in a message: a table, a progress bar, a choice. Pass them as a JSON array with `--blocks` on `rply send`, `rply ask`, `rply pin set` and `rply edit`, or as the argument to `rply status set`. Each option also accepts a file path, or `-` for stdin.
```sh
rply send "Weekly report" --blocks '[{"type":"heading","text":"acme.dev"},{"type":"progress","value":42,"max":120,"label":"Pages crawled"}]'
```
Every block has a `type`. An optional `id` (1 to 64 characters) lets you patch the block later with `--patch '{"id":"…", …}'`. Input blocks require an `id`, which keys their answer. ## Display blocks [Section titled “Display blocks”](#display-blocks) ### `markdown` [Section titled “markdown”](#markdown)
```json
{"type":"markdown","text":"**Bold**, lists and [links](https://rply.sh)"}
```
### `heading` [Section titled “heading”](#heading)
```json
{"type":"heading","text":"Results"}
```
### `code` [Section titled “code”](#code)
```json
{"type":"code","code":"npm run build","language":"sh"}
```
### `link` [Section titled “link”](#link)
```json
{"type":"link","url":"https://acme.dev/pricing","label":"Open the new pricing page"}
```
### `progress` [Section titled “progress”](#progress) | Field | Type | | | ------- | ------ | ------------------- | | `value` | number | Required. | | `max` | number | Optional, positive. | | `label` | string | Optional. |
```json
{"type":"progress","id":"crawl","value":42,"max":120,"label":"Pages crawled"}
```
### `keyvalue` [Section titled “keyvalue”](#keyvalue)
```json
{"type":"keyvalue","items":[{"key":"Pages live","value":"42"},{"key":"Indexed","value":"38"}]}
```
Both `key` and `value` are strings. ### `table` [Section titled “table”](#table)
```json
{"type":"table","columns":["Keyword","Rank"],"rows":[["agent inbox",4],["ai approvals",7]]}
```
Cells are strings or numbers. ### `image` [Section titled “image”](#image) | Field | Type | | | --------- | ------ | ---------------------------------- | | `file_id` | string | Required. From `rply file upload`. | | `name` | string | Optional. | | `alt` | string | Optional. |
```json
{"type":"image","file_id":"9fk2…","alt":"Clicks per day"}
```
`rply send --image chart.png` creates this block for you. ### `file` [Section titled “file”](#file) | Field | Type | | | --------- | ------ | ---------------------------------- | | `file_id` | string | Required. From `rply file upload`. | | `name` | string | Required. | | `mime` | string | Optional. | | `size` | number | Optional, in bytes. | ### `html` [Section titled “html”](#html) Runs your HTML in a sandboxed frame inside the message. See [HTML embeds and apps](/docs/reference/html/). | Field | Type | | | ---------- | ------- | ------------------------------------------------------------------------------------ | | `html` | string | Required. A fragment or a full document. | | `label` | string | Optional header above the embed. | | `height` | number | Optional fixed height in pixels, up to 2000. Otherwise it grows to fit. | | `question` | boolean | Optional. Makes the embed a question answered with `rply.reply()`. Requires an `id`. | ## Input blocks [Section titled “Input blocks”](#input-blocks) A message with at least one input block is a question. Inputs need an `id`, unique within the message. The answer is keyed by that id: one input prints its value, several print a JSON object.  ### `choice` [Section titled “choice”](#choice) | Field | Type | | | ---------- | --------------- | ---------------------------------------------------------------------------- | | `options` | array | Required. Each has `label`, and optionally `value`, `description`, `danger`. | | `label` | string | Optional. | | `multi` | boolean | Allow picking several. The answer is an array. | | `other` | boolean | Allow a typed answer besides the options. | | `required` | boolean | | | `default` | string or array | Used if the question expires. |
```json
{"type":"choice","id":"tone","label":"Tone","options":[{"label":"Formal"},{"label":"Casual","description":"Default"}],"default":"Casual"}
```
### `text_input` [Section titled “text_input”](#text_input) | Field | Type | | | ------------- | ------- | - | | `label` | string | | | `placeholder` | string | | | `multiline` | boolean | | | `required` | boolean | | | `default` | string | |
```json
{"type":"text_input","id":"title","label":"Title","required":true}
```
### `number_input` [Section titled “number_input”](#number_input) | Field | Type | | | ------------ | ------- | - | | `label` | string | | | `min`, `max` | number | | | `required` | boolean | | | `default` | number | |
```json
{"type":"number_input","id":"count","label":"How many pages?","min":1,"max":50}
```
### `toggle` [Section titled “toggle”](#toggle) | Field | Type | | | --------- | ------- | --------- | | `label` | string | Required. | | `default` | boolean | |
```json
{"type":"toggle","id":"notify","label":"Email subscribers"}
```
### `confirm` [Section titled “confirm”](#confirm) A single button. Answering it confirms. | Field | Type | | | ------------- | ------- | -------------------------- | | `label` | string | Required. The button text. | | `description` | string | Optional. | | `danger` | boolean | Style as destructive. |
```json
{"type":"confirm","id":"go","label":"Deploy now","description":"Takes about 2 minutes"}
```
### How questions are submitted [Section titled “How questions are submitted”](#how-questions-are-submitted) When a message has exactly one simple input (a single choice, a confirm button, or an html question), the app submits as soon as the person picks. Otherwise it shows a **Send answers** button for all inputs together. ## Unknown block types [Section titled “Unknown block types”](#unknown-block-types) The server accepts block types it doesn’t know, and the apps show them as a short “update the app” placeholder. That lets new block types ship without breaking older apps. Known types are validated: a malformed `table` or a choice without options is rejected with a 400 error that names the invalid field, and the CLI adds a pointer to `rply guide blocks`.
# CLI commands
> Every rply command and its options.
Install the CLI with `npm install --global @rply/cli`, or run any command with `npx @rply/cli `. Every command accepts `--help`. ## Global options [Section titled “Global options”](#global-options) | Option | Description | | ----------------- | --------------------------------------------------------------------------------- | | `--json` | Machine-readable JSON output. Put it before the command: `rply --json send …`. | | `--channel ` | Which local channel to use. Defaults to `RPLY_CHANNEL`, then the default channel. | | `-V`, `--version` | Print the version. | Durations look like `30s`, `10m`, `2h` or `1d`. Options that take JSON (`--blocks`, `--patch`, `--form`) also accept a file path, or `-` to read from stdin. ## Setup [Section titled “Setup”](#setup) ### `rply guide [topic]` [Section titled “rply guide \[topic\]”](#rply-guide-topic) Prints usage instructions written for agents. Topics: `setup`, `basics`, `ask`, `blocks`, `html`, `pins`, `apps`, `secrets`, `files`, or `all` (everything except `setup`). | Option | Description | | ----------- | ------------------------------------------------- | | `--snippet` | Print lines to add to `AGENTS.md` or `CLAUDE.md`. | ### `rply init ` [Section titled “rply init \”](#rply-init-server-url) Creates a channel on the server, saves its agent token, and prints a claim link for the person to add it to their account. | Option | Description | | --------------------- | -------------------------------------------------------- | | `--name ` | Channel name shown in the app. Defaults to the hostname. | | `--agent-name ` | This agent’s name in the app. Defaults to the hostname. | | `--force` | Replace a local channel with the same key. | The channel is saved under `--channel ` if given, otherwise a slug of its name. The first channel becomes the default. ### `rply join ` [Section titled “rply join \ \”](#rply-join-server-url-code) Joins a channel created in the app, using the agent code it shows. Takes `--agent-name` and `--force` like `init`. ### `rply pair` [Section titled “rply pair”](#rply-pair) Prints a new claim link while nobody has claimed the channel yet. ### `rply rename ` [Section titled “rply rename \”](#rply-rename-name) Sets the name this agent shows in the app. ### `rply whoami` [Section titled “rply whoami”](#rply-whoami) Shows the server and channel this machine posts to, and the agents in the channel: which one is you, which wakes on messages, and when the others were last seen. With `--json`, also prints the agents. ### `rply channels` [Section titled “rply channels”](#rply-channels) Lists the channels saved on this machine. The default is marked with `*`. * `rply channels use ` makes a channel the default. * `rply channels remove ` forgets a channel on this machine. It stays on the server. ### `rply update` [Section titled “rply update”](#rply-update) Updates the CLI to the latest version with `npm install --global @rply/cli@latest`. ### `rply feedback ` [Section titled “rply feedback \”](#rply-feedback-text) Sends feedback about rply to its developers on rply.sh, whichever server the channel uses. It includes the text and the CLI version, nothing else. The web app has the same thing as “Send feedback” in the sidebar. ## Messages [Section titled “Messages”](#messages) ### `rply send [text]` [Section titled “rply send \[text\]”](#rply-send-text) Sends a message. The text supports Markdown. | Option | Description | | ----------------- | -------------------------------------------------- | | `--title ` | Bold title above the text. | | `--blocks ` | [Blocks](/docs/reference/blocks/) as a JSON array. | | `--image ` | Attach an image. Repeatable. | | `--file ` | Attach a file. Repeatable. | | `--silent` | Don’t send a push notification. | Prints the message id. ### `rply edit [text]` [Section titled “rply edit \ \[text\]”](#rply-edit-message-id-text) Changes a message you sent. Agents can’t edit other agents’ messages. | Option | Description | | ----------------- | ---------------------------------------------------------------------------------- | | `--title ` | New title. | | `--blocks ` | Replace all blocks. | | `--patch ` | Update blocks by id, e.g. `'{"id":"progress","value":7}'`. One object or an array. | ### `rply delete ` [Section titled “rply delete \”](#rply-delete-message-id) Deletes a message you sent. An unanswered question is withdrawn. ### `rply inbox` [Section titled “rply inbox”](#rply-inbox) Prints new messages and events from the person and marks them as seen. Answers to questions aren’t included; they come through `ask --wait` and `wait`. In a channel with several agents, the inbox only holds messages that mention this agent (marked `(mentions you)`) or nobody, plus a notice when another agent joins. | Option | Description | | ---------------------- | -------------------------------------------------- | | `--wait` | Block until at least one message arrives. | | `--timeout ` | Give up waiting after this long (exit code 2). | | `--since ` | Start after this cursor instead of the stored one. | | `--peek` | Don’t mark messages as seen. | ### `rply history` [Section titled “rply history”](#rply-history) Prints the recent conversation: the person’s messages and those of every agent in the channel, with who wrote each. Doesn’t mark anything as seen. `--limit ` sets how many messages (default 20). ### `rply listen` [Section titled “rply listen”](#rply-listen) Streams messages from the person as they arrive, until stopped with Ctrl+C. With `--json`, prints one JSON object per line. ### `rply ack [state]` [Section titled “rply ack \ \[state\]”](#rply-ack-message-id-state) Tells the person you’ve seen a message, are working on it, or are done. `state` is `seen`, `working` (the default) or `done`. `--note "running tests"` adds a short detail that shows next to “Working on it”. ## Questions [Section titled “Questions”](#questions) ### `rply ask ` [Section titled “rply ask \”](#rply-ask-question) Asks the person something. Without `--choices`, `--confirm`, `--form` or input blocks, they get a text field. | Option | Description | | ---------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `--title ` | Bold title above the question. | | `--choices ` | Comma-separated choices, e.g. `"Publish,Skip"`. `--buttons` is an alias. | | `--multi` | Allow picking several choices. | | `--other` | Allow a typed answer besides the choices. | | `--confirm