smartlead-cli
smartlead-cli provides a smartlead command for working with the Smartlead API from a terminal.
It follows the same project structure as plane-cli and wildberries-cli: Typer commands, a shared config layer, JSON-first output, and a raw command for full API coverage.
Install
pip install smartlead-cli
Authentication
Smartlead uses an API key passed as api_key query parameter. Configure it once:
smartlead config init
You can also override at runtime:
SMARTLEAD_API_KEY=... smartlead campaigns list
Config
Config file path:
~/.config/smartlead-cli/config.toml
Supported keys (examples):
core.api_keycore.base_urlcore.timeout_secondscore.retriesdefaults.limit
Examples:
smartlead config show
smartlead config set core.timeout_seconds 30
smartlead config set core.retries 3
smartlead config set defaults.limit 100
Commands (v1)
config- manage local configcampaigns- list/get/create/update/schedule/delete/status + analytics/statistics + campaign leadsleads- a few global lead operationswebhooks- campaign webhook helpersraw- direct API access for unsupported endpoints
Examples
smartlead campaigns list
smartlead campaigns list --client-id 123
smartlead campaigns list --include-tags
smartlead campaigns get 12345
smartlead campaigns create --name "New Campaign"
smartlead campaigns update 12345 --name "New Campaign (edited)"
smartlead campaigns schedule 12345 --timezone "America/New_York" --day 1 --day 2 --day 3 --day 4 --day 5 --start-hour 09:00 --end-hour 18:00
smartlead campaigns status 12345 --status PAUSED
smartlead campaigns statistics 12345 --limit 50 --offset 0
smartlead campaigns analytics top 12345
smartlead campaigns analytics by-date 12345 --start-date 2025-01-01 --end-date 2025-01-31
Campaign leads:
smartlead campaigns leads list 12345
smartlead campaigns leads get 12345 67890
smartlead campaigns leads add 12345 --body-file leads.json
smartlead campaigns leads patch 12345 67890 --first-name "Updated" --custom-fields-file custom-fields.json
smartlead campaigns leads update 12345 67890 --body-file lead-update.json
smartlead campaigns leads pause 12345 67890
smartlead campaigns leads resume 12345 67890 --delay-days 2
smartlead campaigns leads unsubscribe 12345 67890
smartlead campaigns leads delete 12345 67890
smartlead campaigns leads message-history 12345 67890
Global lead helpers:
smartlead leads get-by-email --email person@example.com
smartlead leads unsubscribe-all 67890
Campaign webhooks:
smartlead webhooks list 12345
smartlead webhooks upsert 12345 --body-file webhook.json
smartlead webhooks delete 12345 --webhook-id 555
Webhook upsert payload notes:
event_typesallowed values:EMAIL_SENT,EMAIL_OPEN,EMAIL_BOUNCE,EMAIL_LINK_CLICK,EMAIL_REPLY,LEAD_UNSUBSCRIBED,LEAD_CATEGORY_UPDATED,CAMPAIGN_STATUS_CHANGED,UNTRACKED_REPLIES,MANUAL_STEP_REACHEDcategoriesis required and must contain at least one Smartlead lead category name- Smartlead lead categories are workspace-specific/customizable labels, so there is no single global CLI enum for
categories - If unsure which category names exist, inspect Smartlead UI lead categories or use Smartlead's "Test Webhook" / existing webhook payloads and copy the category labels
Example webhook.json:
{
"id": null,
"name": "Reply webhook",
"webhook_url": "https://example.com/webhook",
"event_types": ["EMAIL_REPLY"],
"categories": ["Interested"]
}
Raw endpoint access (fallback for full API surface):
smartlead raw request --method GET --path /campaigns
smartlead raw request --method POST --path /campaigns/12345/status --query status=PAUSED
smartlead raw request --method POST --path /campaigns/12345/leads --body-file leads.json
Preferred Command Style (LLMs / Agents)
- Prefer curated commands (
campaigns,leads,webhooks) overrawwhenever possible. - Prefer
--body-fileover inline--body-jsonfor non-trivial payloads (less shell escaping, easier review). - Normalize emails to lowercase before lookups/updates.
- For lead edits, prefer
smartlead campaigns leads patch ...if you only want to change a few fields. - Delete commands prompt for confirmation in interactive shells; use
--yesin scripts/automation.
Output
- Default output is JSON on stdout
- Errors are structured JSON on stderr
- Use
--prettyfor Rich tables on selected list commands
Publishing to PyPI
The repo includes a GitHub Actions workflow (.github/workflows/publish.yml) for trusted publishing on tags matching v*.
Notes
- Smartlead API docs (official): https://helpcenter.smartlead.ai/en/articles/125-full-api-documentation
- Smartlead API base URL defaulted in this CLI:
https://server.smartlead.ai/api/v1 - Rate limiting is handled with simple retries/backoff for
429and5xx
Metadata
Release files for smartlead-cli 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| smartlead_cli-0.1.4.tar.gz | 18.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| smartlead_cli-0.1.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 41.9 kB
Release files / smartlead_cli-0.1.4.tar.gz
| Download URL | smartlead_cli-0.1.4.tar.gz |
|---|---|
| Size | 18.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
074703d31db2a2d25f999af3d6d8be4f57a0184723139228e68c439306c22c35
|
|
BLAKE2b-256 checksum How to use checksums |
a18abe455ba509cb48fbcf61fddb42fc032687a4172fb1cc16cb9207894e9053
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / smartlead_cli-0.1.4-py3-none-any.whl
| Download URL | smartlead_cli-0.1.4-py3-none-any.whl |
|---|---|
| Size | 23.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b4cf7400a423638595a347a3aab44e7e1e6d63a17ec811e8b14eb2fd0704c72c
|
|
BLAKE2b-256 checksum How to use checksums |
05b24d319bf699bb903d7ac0c3decf7f8ca590963aabd82ca5a215409b3f565f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|