Skip to content

CLI

The todoke CLI lets you manage apps and API keys and send notifications from your terminal.

Terminal window
# after cloning the todoke monorepo
bun install
cd apps/cli
bun run build

Building produces apps/cli/dist/index.js (mapped to todoke via the bin field in package.json). Run it in one of the following ways.

Terminal window
# run directly
node apps/cli/dist/index.js <command>
# or run bun link in apps/cli and invoke it globally as `todoke`
cd apps/cli
bun link
todoke <command>

The examples below use the todoke <command> form.

Terminal window
todoke login --api-key pk_xxxxxxxxxxxxxxxx
# ✔ Logged in. Saved configuration to /Users/you/.todoke.json.
  • --api-key <key>: Required. The API key issued in the dashboard.
  • --api-url <url>: Optional. Defaults to https://api.todoke.dev.

At login, the CLI calls GET /api/v1/apps internally to verify that the API key is valid. If authentication fails, the following is shown and no configuration is saved.

Terminal window
todoke login --api-key pk_invalid
# ✖ Authentication failed: <error message from the API>

The configuration file is saved to ~/.todoke.json (under os.homedir()) with permission 0600. Because apiKey and apiUrl are written as plaintext JSON, handle the file with care.

Terminal window
todoke logout
# Logged out.

Running logout while not logged in prints Not logged in. (shown in gray).

OptionRequiredDescription
--api-key <key>RequiredAPI key (a string starting with pk_)
--api-url <url>OptionalAPI URL (default: https://api.todoke.dev)

See the “Login” section above.

Deletes the saved credentials (~/.todoke.json).

Terminal window
todoke logout
# Logged out.

Shows the app the logged-in key belongs to (no arguments).

Terminal window
todoke apps list
#
# Apps (1)
#
# my-app 3f29a1d2-4b7d-4a91-9c3e-1f2b3a4d5e6f

If there are no apps, No apps. (shown in gray) is printed.

Shows an app’s statistics (active subscribers, total sends, failures, and sends this month).

Terminal window
todoke apps stats 3f29a1d2-4b7d-4a91-9c3e-1f2b3a4d5e6f
#
# Active subscribers: 42
# Total sends: 1234
# Failures: 3
# Sends this month: 567

Deletes an app.

Terminal window
todoke apps delete 3f29a1d2-4b7d-4a91-9c3e-1f2b3a4d5e6f
# ✔ Deleted.

Shows the list of API keys tied to an app (scope and last-used time).

Terminal window
todoke keys list 3f29a1d2-4b7d-4a91-9c3e-1f2b3a4d5e6f
#
# API keys (1)
#
# backend-key notify Last used: 2026/7/2 10:00:00
# 8e1c2d3f-...

If there are no keys, No API keys. (shown in gray) is printed.

Creates an API key.

OptionRequiredDescription
-n, --name <name>RequiredKey name
-s, --scope <scope>OptionalScope (subscribe_only / notify / full). Defaults to notify
Terminal window
todoke keys add 3f29a1d2-4b7d-4a91-9c3e-1f2b3a4d5e6f -n backend-key -s notify
# ✔ Created: backend-key (notify)
#
# API key: pk_a1b2c3d4e5f6...
# * This key is shown only once. Be sure to copy it.

Deletes an API key.

Terminal window
todoke keys rm 3f29a1d2-4b7d-4a91-9c3e-1f2b3a4d5e6f 8e1c2d3f-0000-0000-0000-000000000000
# ✔ Deleted.

Sends a notification.

OptionRequiredDescription
-t, --title <title>RequiredNotification title
-b, --body <body>RequiredNotification body
-u, --url <url>OptionalDestination URL on click (https:// only)
-e, --endpoint <endpoint>OptionalTarget a specific subscriber’s endpoint

See the “Sending notifications” section below for details.

Terminal window
todoke notify 3f29a1d2-4b7d-4a91-9c3e-1f2b3a4d5e6f -t "Announcement" -b "You have a new message"
# ✔ Notification sent: "Announcement"

Use -u/--url to set the destination when the notification is clicked, and -e/--endpoint to send only to a specific subscriber.

If you run any command other than login / logout while not logged in, the following message is shown and the process exits with code 1.

Terminal window
todoke apps list
# Not logged in. Run `todoke login --api-key <key>`.

Other errors (invalid API key, insufficient scope, resource not found, etc.) display the API’s error message as-is, with exit code 1. For the full list of error codes, see Error codes and limits.