Smartlead
Run cold-email outreach sequences and manage campaigns via the Smartlead API. This tool reads and creates campaigns, adds leads to a campaign, and controls campaign status (start / pause / stop).
Pure standard-library Python (urllib, json) — no third-party packages.
What it does
Each invocation makes a single Smartlead REST API call selected by the
operation input and returns the raw response.
- Base URL:
https://server.smartlead.ai/api/v1 - Auth: API key passed as the
api_keyquery parameter on every request.
Operations
| operation | method + path | required inputs | optional inputs |
|---|---|---|---|
list_campaigns |
GET /campaigns/ |
— | — |
get_campaign |
GET /campaigns/{id} |
campaignId |
— |
create_campaign |
POST /campaigns/create |
— | name, clientId |
add_leads_to_campaign |
POST /campaigns/{id}/leads |
campaignId, email |
firstName, lastName, companyName |
update_campaign_status |
POST /campaigns/{id}/status |
campaignId, status |
— |
status values are Smartlead campaign states such as START, PAUSED, and
STOPPED.
Outputs
The tool publishes:
status— the HTTP status code (as a string).result— the response body as a JSON string.
On a transport-level failure or a missing required input, it prints
{"error": "<message>"} and exits non-zero so the job step is marked FAILED.
HTTP 4xx/5xx responses are NOT treated as failures — the status code and
Smartlead's error body are returned in result so you can inspect them.
API key setup
- Log in to your Smartlead account.
- Go to Settings → API Keys (https://app.smartlead.ai/app/settings/profile).
- Create / copy your API key.
- Pass it as the
apiKeyinput. It is sent as?api_key=<apiKey>on each request — a single key authenticates every operation (no OAuth / token exchange required).
Examples
List all campaigns:
operation = list_campaigns
apiKey = <YOUR_API_KEY>
Get one campaign:
operation = get_campaign
apiKey = <YOUR_API_KEY>
campaignId = 123456
Create a campaign:
operation = create_campaign
apiKey = <YOUR_API_KEY>
name = Q3 Outbound Founders
clientId = 42
Add a lead to a campaign:
operation = add_leads_to_campaign
apiKey = <YOUR_API_KEY>
campaignId = 123456
email = [email protected]
firstName = Jane
lastName = Doe
companyName = Example Inc
Pause a running campaign:
operation = update_campaign_status
apiKey = <YOUR_API_KEY>
campaignId = 123456
status = PAUSED