# Sendtide CLI

> The Sendtide CLI: log in, test webhooks locally with listen --forward-to, fire events with trigger, send test mail, follow logs and manage templates.

URL: https://sendtide.ch/en/docs/cli/

The command line tool for developers: test webhooks on your machine without a public URL, fire any event, send test mail, follow the logs and keep templates in your repository.
One static binary for macOS, Linux and Windows, no dependencies.
## Install

Download the binary for your platform (sendtide_<version>_<os>_<arch>) from the build artifacts, check it against SHA256SUMS, make it executable and put it on your PATH:

```
chmod +x sendtide_0.1.0_darwin_arm64
mv sendtide_0.1.0_darwin_arm64 /usr/local/bin/sendtide
sendtide version
```

A Homebrew package is planned for later.
## Log in

```
sendtide login                      # asks for the key, input hidden
sendtide login --api-key sk_test_…
sendtide whoami
sendtide logout
```

The key is stored in your user config directory (macOS ~/Library/Application Support/sendtide, Linux ~/.config/sendtide, Windows %AppData%\sendtide) with mode 0600. SENDTIDE_API_KEY and --api-key take precedence. Use a test key (sk_test_) while you build: nothing is delivered, but mails and their events are real. SENDTIDE_API_URL or --api-url point to another API.
## Test webhooks locally

```
sendtide listen --forward-to http://localhost:3000/webhooks
```

```
Ready! Listening for all mail events (test key sk_test_8d09eb…).
Forwarding to http://localhost:3000/webhooks
Your webhook signing secret is whsec_6wq82dgkbxqbyqdmqga4g7hv0h8ztb11m5kxchg
Press Ctrl+C to stop.
2026-11-29 10:39:12  email.queued            evt_51861  msg_vh25njrpw09qec7g  [200] 12 ms
2026-11-29 10:39:13  email.sent              evt_51862  msg_vh25njrpw09qec7g  [200] 9 ms
```

While it runs, every mail event of your account is POSTed to the local URL with the same body and the same Sendtide-Signature header as a real delivery, signed with the secret it prints. The secret stays the same for your key: configure your app with it once (SENDTIDE_WEBHOOK_SECRET) and verify signatures exactly as in production, see [Webhooks](https://sendtide.ch/en/docs/webhooks/#verify-the-signature).
- A test key receives the events of mail sent with test keys, a live key those of live mail.
- Your configured webhooks are not touched: the listener is separate and creates no deliveries.
- --events email.bounced,email.complained limits the event types, --print-json prints each body, --header "Authorization: Bearer dev" adds a header to the forwarded request, --json writes one JSON line per event.
- The CLI does not retry: a non-2xx answer shows up in the line, in red.
- After 5 minutes without a connection (a sleeping laptop) the listener expires, the CLI reconnects on its own. Events in between are not replayed.
- email.received and email.unsubscribed do not reach the listener. Fire them with sendtide trigger.
## Fire events

```
sendtide trigger email.bounced                      # to the URL of the running "sendtide listen"
sendtide trigger email.received --forward-to http://localhost:3000/webhooks/inbound
sendtide trigger email.delivered --email-id msg_8kq2m4bt --to anna@example.com
sendtide trigger email.complained --print > fixtures/complaint.json   # body to stdout, header to stderr
sendtide trigger --list
```

trigger builds a realistic sample of each of the 15 [event types](https://sendtide.ch/en/docs/webhooks/) (bounces with their class, clicks with the link, inbound mail with the reply without quote) and signs it with --secret, $SENDTIDE_WEBHOOK_SECRET or the listener secret of your key.
## Send a test mail

```
sendtide send --from hello@example.ch --to anna@example.com --subject Hi --text "Hello Anna"
sendtide send --from "Shop <shop@example.ch>" --to anna@example.com --template welcome --data '{"name":"Anna"}'
sendtide send --from hello@example.ch --to anna@example.com --subject Test --html @mail.html --tag test
sendtide emails get msg_8kq2m4bt
sendtide emails list --query "status:bounced domain:gmx.ch"
```

Values starting with @ are read from a file. With --idempotency-key a repeated call sends once.
## Follow the logs

```
sendtide logs --follow --query "status:bounced"      # emails, shown again when their status changes
sendtide logs --query "tag:invoice" --limit 50
sendtide logs tail --requests --query "status:4xx"   # the API request log, live
```

For emails the search language of the dashboard applies (status:, tag:, domain:, to:, template:, stream:, - to negate, free text). logs tail is the same as logs --follow.
## Templates in your repository

```
sendtide templates list
sendtide templates pull welcome                       # templates/welcome.json
sendtide templates pull welcome --published --stdout
sendtide templates push templates/welcome.json --publish --note "New footer"
```

The file has the fields of POST /v1/templates (alias, name, kind, style, languages with subject, preheader, blocks, HTML and text). push updates the draft, or creates the template if the alias is new. Pushing needs a live key: test keys may read templates but not change them (test_key_forbidden).
## Scripting

Every command takes --json. Colors are used only on a terminal and never with NO_COLOR or --no-color. Exit codes: 0 success, 1 error (API or endpoint), 2 wrong usage, 130 interrupted.
## How the listener works

sendtide listen uses three public endpoints (see the [API reference](https://sendtide.ch/en/docs/api/webhooks/)): POST /v1/webhooks/listen starts the listener of the key and returns its id, secret and cursor, GET /v1/webhooks/listen/{id}/events waits up to 20 seconds by long poll for the next events, DELETE /v1/webhooks/listen/{id} stops it. The CLI signs each event itself and posts it to your address, so the API never connects to your machine. A dashboard login cannot listen (api_key_required), an expired listener answers 410 listener_expired.
