> **Building with AI coding agents?** Install the authstack plugin with one command. This equips your agent with accurate Scalekit implementation patterns.
>
> **Recommended** (the `-y` flags skip prompts, so the command runs without an interactive terminal):
> ```bash
> npx -y @scalekit-inc/cli setup -y
> ```
>
> Global:
> ```bash
> npm install -g @scalekit-inc/cli
> scalekit setup -y
> ```
>
> Supports Claude Code, Cursor, GitHub Copilot, Codex + skills for other Agent Skills-compatible agents in `~/.agents/skills`.
> Skills: integrate-agentkit, implement-saaskit, add-mcp-oauth, implement-sso, implement-scim.
> [Full setup guide](https://docs.scalekit.com/dev-kit/build-with-ai/)

---

# Connect AI agents to Campaign Cleaner

The Campaign Cleaner connector lets your AI agent act in each user's Campaign Cleaner account. Each user connects their own Campaign Cleaner API key once, and Scalekit sends it with every call, so your agent never handles credentials. It comes with 20 tools.

**Authentication:** API Key
**Categories:** Marketing
**Tools:** 20: 12 read, 5 write, 3 destructive
**Users sign in with:** API key
**Built by:** Scalekit connector
**Try it:** [Playground in the Scalekit dashboard](https://app.scalekit.com/ws/signup?sk_intent=playground&provider=CAMPAIGNCLEANER)

## Setup

1. ### Install the SDK

   **Node.js**

   ```bash
   npm install @scalekit-sdk/node dotenv
   ```

   **Python**

   ```bash
   pip install scalekit-sdk-python python-dotenv
   ```

2. ### Set your credentials

   Add your Scalekit credentials to your `.env` file. Find values in **[app.scalekit.com](https://app.scalekit.com)** > **Developers** > **API Credentials**.

   ```sh title=".env"
   SCALEKIT_ENVIRONMENT_URL=<your-environment-url>
   SCALEKIT_CLIENT_ID=<your-client-id>
   SCALEKIT_CLIENT_SECRET=<your-client-secret>
   ```

3. ### Create the Campaign Cleaner connection

   In **AgentKit > Connections**, create a Campaign Cleaner connection. The name you give it is the `connection_name` your code passes. See [Configure connections](/agentkit/connections/).

4. ### Authorize a user and make your first call

   **Node.js** (`quickstart.mts`)

   ```typescript
   import { ScalekitClient } from '@scalekit-sdk/node'
   import 'dotenv/config'
   import { createInterface } from 'node:readline/promises'

   const scalekit = new ScalekitClient(
     process.env.SCALEKIT_ENVIRONMENT_URL,
     process.env.SCALEKIT_CLIENT_ID,
     process.env.SCALEKIT_CLIENT_SECRET,
   )
   const actions = scalekit.actions

   const connector = 'campaigncleaner'
   const identifier = 'user_123'

   // Generate an authorization link for the user
   const { link } = await actions.getAuthorizationLink({ connectionName: connector, identifier })
   console.log('Authorize Campaign Cleaner:', link)
   const rl = createInterface({ input: process.stdin, output: process.stdout })
   await rl.question('Press Enter after authorizing...')
   rl.close()

   // Make your first call
   const result = await actions.executeTool({
     connector,
     identifier,
     toolName: 'campaigncleaner_campaigns_list',
     toolInput: {},
   })
   console.log(result)
   ```

   ```bash
   npx tsx quickstart.mts
   ```

   **Python** (`quickstart.py`)

   ```python
   import os
   from scalekit import ScalekitClient
   from dotenv import load_dotenv
   load_dotenv()

   scalekit_client = ScalekitClient(
       env_url=os.getenv("SCALEKIT_ENVIRONMENT_URL"),
       client_id=os.getenv("SCALEKIT_CLIENT_ID"),
       client_secret=os.getenv("SCALEKIT_CLIENT_SECRET"),
   )
   actions = scalekit_client.actions

   connection_name = "campaigncleaner"
   identifier = "user_123"

   # Generate an authorization link for the user
   link_response = actions.get_authorization_link(
       connection_name=connection_name,
       identifier=identifier,
   )
   print("Authorize Campaign Cleaner:", link_response.link)
   input("Press Enter after authorizing...")

   # Make your first call
   result = actions.execute_tool(
       tool_input={},
       tool_name="campaigncleaner_campaigns_list",
       connection_name=connection_name,
       identifier=identifier,
   )
   print(result)
   ```

   ```bash
   python quickstart.py
   ```

   Each user opens the link once and enters their Campaign Cleaner credentials there. See [Authorize a user](/agentkit/tools/authorize/) for the full flow and statuses.

## Tools

Pass the exact name to `execute_tool`, with an input like each tool's example. To ask for a tool that's missing, use the [request form](https://scalekitsupport.portal.usepylon.com/forms/request-a-connector-tool).

**Node.js**

```typescript
const result = await actions.executeTool({
  toolName: 'campaigncleaner_campaign_get',
  toolInput: {
    campaign_id: '<campaign_id>',
  },
  connector: 'campaigncleaner',
  identifier: 'user_123',
})
```

**Python**

```python
result = actions.execute_tool(
    tool_name="campaigncleaner_campaign_get",
    tool_input={
        "campaign_id": "<campaign_id>",
    },
    connection_name="campaigncleaner",
    identifier="user_123",
)
```

`result.data` is the app's response as JSON, and `result.execution_id` (`executionId` in Node.js) is the ID of the call.

### `campaigncleaner_campaign_get`

Get Campaign · Read-only

Get a processed campaign with its cleaned HTML and full analysis.
Returns the cleaned HTML, settings used, spam keyword findings, link and image summaries, SpamAssassin score and other checks.
Use after campaigncleaner_campaign_status_get reports completed.

Read only: yes. Destructive: no. Idempotent (safe to retry): yes.

Inputs:

- `campaign_id` (`string`, required): ID of the saved campaign, from campaigncleaner_campaign_send or campaigncleaner_campaigns_list. Example: 4f8a2c1e9b7d.
- `minimize_html` (`boolean`, optional): Return minified HTML without extra whitespace. Defaults to true. Example: true.

Example input: `{"campaign_id":"<campaign_id>"}`

### `campaigncleaner_campaign_status_get`

Get Campaign Status · Read-only

Get the processing status of a submitted campaign.
Returns the campaign id, name, status (processing, completed or paused) and date added.
When completed, read it with campaigncleaner_campaign_get.

Read only: yes. Destructive: no. Idempotent (safe to retry): yes.

Inputs:

- `campaign_id` (`string`, required): ID of the saved campaign, from campaigncleaner_campaign_send or campaigncleaner_campaigns_list. Example: 4f8a2c1e9b7d.

Example input: `{"campaign_id":"<campaign_id>"}`

### `campaigncleaner_campaigns_list`

List Campaigns · Read-only

List every saved campaign on the account.
Returns each campaign's id, name, status and date added.
Use an id with campaigncleaner_campaign_get.

Read only: yes. Destructive: no. Idempotent (safe to retry): yes.

Inputs: none.

Example input: `{}`

### `campaigncleaner_credits_get`

Get Credits · Read-only

Get how many API credits the account has left.
Returns credits.
Sending a campaign or creating an inbox test uses 1 credit; monitor tools use none.

Read only: yes. Destructive: no. Idempotent (safe to retry): yes.

Inputs: none.

Example input: `{}`

### `campaigncleaner_inbox_test_results_get`

Get Inbox Test Results · Read-only

Get the placement results of an inbox test.
Returns the test's status (Processing or Completed) and, per seed mailbox, where the email landed (inbox, spam, tab) plus authentication results.
Call again until status is Completed.

Read only: yes. Destructive: no. Idempotent (safe to retry): yes.

Inputs:

- `job_id` (`string`, required): job_id returned by campaigncleaner_inbox_test_create. Example: 186.

Example input: `{"job_id":"<job_id>"}`

### `campaigncleaner_monitor_alerts_list`

List Monitor Alerts · Read-only

List alert rules and the 50 most recent alerts.
Returns alerts (rules with alert_id, kind, recipients) and recent events with status, domain, provider and detail.
Use campaigncleaner_monitor_alert_save to create or change a rule.

Read only: yes. Destructive: no. Idempotent (safe to retry): yes.

Inputs: none.

Example input: `{}`

### `campaigncleaner_monitor_domains_list`

List Monitor Domains · Read-only

List the account's monitored and alert domains with verification status and limits.
Returns domains with domain_id, domain, purpose, status, DNS record and message counts, plus limits.
Only mail sent from a verified domain is recorded.

Read only: yes. Destructive: no. Idempotent (safe to retry): yes.

Inputs: none.

Example input: `{}`

### `campaigncleaner_monitor_message_get`

Get Monitor Message · Read-only

Get one stored monitor message with authentication details, selected headers and a text preview.
Returns the message fields plus first and last seen times, DKIM domain, sender IP, preview, headers, and optionally the original as eml_base64.
Use campaigncleaner_monitor_messages_list for message IDs.

Read only: yes. Destructive: no. Idempotent (safe to retry): yes.

Inputs:

- `message_id` (`integer`, required): ID of the message, from campaigncleaner_monitor_messages_list. Example: 52731.
- `include_eml` (`boolean`, optional): true adds the original message (up to 10 MB) as eml_base64; limited to 10 a minute. Defaults to false. Example: false.

Example input: `{"message_id":52731}`

### `campaigncleaner_monitor_messages_list`

List Monitor Messages · Read-only

List stored copies of your mail that reached a monitor seed, newest first, with placement and authentication results (last 30 days).
Returns page, page_size, total and messages with message_id, domain, provider, placement, subject, from and SPF/DKIM/DMARC results.
Use campaigncleaner_monitor_message_get for one message.

Read only: yes. Destructive: no. Idempotent (safe to retry): yes.

Inputs:

- `days` (`integer`, optional): Look back this many days, 1 to 30. Defaults to 30. Example: 7.
- `domain_id` (`integer`, optional): Only this monitored domain. Defaults to all verified domains. Example: 13.
- `page` (`integer`, optional): Page number, starting at 1. Example: 1.
- `page_size` (`integer`, optional): Messages per page, 1 to 200. Defaults to 50. Example: 50.
- `placement` (`string`, optional): Only messages in this folder. Example: Spam. One of: `Inbox`, `Spam`, `Promotions`, `Social`, `Updates`, `Newsletter`, `Announcements`, `Forums`, `Other`.
- `provider_key` (`string`, optional): Only this provider, using a provider_key from campaigncleaner_monitor_seeds_list. Example: gmail.com.

Example input: `{}`

### `campaigncleaner_monitor_seeds_list`

List Monitor Seeds · Read-only

Get the Inbox Placement Monitor seed addresses to add as To recipients on your real sends.
Returns count and seeds with address, provider and provider_key.
Needs a plan with Inbox Placement Monitor. Send from a verified domain (campaigncleaner_monitor_domains_list).

Read only: yes. Destructive: no. Idempotent (safe to retry): yes.

Inputs: none.

Example input: `{}`

### `campaigncleaner_monitor_summary_get`

Get Monitor Placement Summary · Read-only

Get inbox and spam rates overall and per mailbox provider.
Returns overall and per-provider totals for inbox, tabs, spam and other, plus inbox_rate and spam_rate.
Use campaigncleaner_monitor_messages_list for individual messages.

Read only: yes. Destructive: no. Idempotent (safe to retry): yes.

Inputs:

- `days` (`integer`, optional): Look back this many days, 1 to 365. Defaults to 30. Example: 30.
- `domain_id` (`integer`, optional): Only this monitored domain. Example: 13.

Example input: `{}`

### `campaigncleaner_monitor_usage_get`

Get Monitor Usage · Read-only

Get how many monitor messages were stored this billing period against the limits.
Returns messages_used, messages_limit, failed_auth_used, failed_auth_limit, not_stored and resets_at.
A null limit means unlimited.

Read only: yes. Destructive: no. Idempotent (safe to retry): yes.

Inputs: none.

Example input: `{}`

### `campaigncleaner_campaign_send`

Send Campaign for Cleaning · Write

Submit an email campaign's HTML to be sanitized, CSS-inlined, optimized for deliverability and analyzed for spam triggers, broken links, image sizes and more.
Returns the campaign id; processing usually takes seconds and up to a few minutes.
Poll campaigncleaner_campaign_status_get, then read the cleaned HTML and analysis with campaigncleaner_campaign_get. Uses 1 credit.

Read only: no. Destructive: no. Idempotent (safe to retry): no.

Inputs:

- `campaign_html` (`string`, required): The full HTML of the email campaign. Example: <html><body><h1>Spring sale</h1>Save 40% this week.
</body></html>.
- `campaign_name` (`string`, required): Name for the campaign. Example: Spring Sale Newsletter.
- `adjust_font_colors` (`boolean`, optional): Shift spam-trigger colors such as pure red to a near-identical shade. Defaults to true. Example: true.
- `adjust_font_size` (`boolean`, optional): Clamp font sizes to min_font_size_allowed and max_font_size_allowed. Defaults to true. Example: true.
- `convert_h_to_p_tags` (`boolean`, optional): Turn H tags into P tags with matching font sizes. Defaults to false. Example: false.
- `convert_tables_to_divs` (`boolean`, optional): Experimental: convert tables to divs. Defaults to false. Example: false.
- `custom_info` (`string`, optional): Your own data (up to 500 characters) returned with the campaign. Example: batch-2026-11.
- `host_extensionless_images` (`boolean`, optional): Also host images without file extensions when resize_and_host is on. Defaults to false. Example: false.
- `inline_css` (`boolean`, optional): Inline CSS into style attributes. Defaults to true. Example: true.
- `inline_css_important` (`boolean`, optional): Keep !important flags when inlining. Defaults to false. Example: false.
- `max_font_size_allowed` (`integer`, optional): Largest font size in pixels, under 100. Defaults to 32. Example: 32.
- `media_queries_important` (`boolean`, optional): Mark media query styles !important. Defaults to true. Example: true.
- `min_font_size_allowed` (`integer`, optional): Smallest font size in pixels, under 100. Defaults to 10. Example: 10.
- `preserve_media_queries` (`boolean`, optional): Keep media queries. Defaults to true. Example: true.
- `relative_links_base_url` (`string`, optional): Base URL used to turn relative links into absolute ones. Example: https://example.com.
- `remove_classes_and_ids` (`boolean`, optional): Remove class and id attributes after inlining. Defaults to true. Example: true.
- `remove_comments` (`boolean`, optional): Strip HTML and CSS comments. Defaults to true. Example: true.
- `remove_control_non_printable` (`boolean`, optional): Remove control and non-printable characters. Defaults to false. Example: false.
- `remove_css_inheritance` (`boolean`, optional): Remove inherited CSS. Defaults to true. Example: true.
- `remove_image_height` (`boolean`, optional): Remove height styles from images. Defaults to true. Example: true.
- `remove_large_widths_over` (`integer`, optional): Experimental: remove widths above this many pixels on elements other than images and tables. Example: 800.
- `remove_successive_punctuation` (`boolean`, optional): Collapse repeated punctuation such as !!! to one. Defaults to true. Example: true.
- `replace_diacritics` (`boolean`, optional): Replace accented characters with plain ones. Defaults to true. Example: true.
- `replace_non_ascii_characters` (`boolean`, optional): Replace non-ASCII characters with ASCII equivalents. Defaults to true. Example: true.
- `resize_and_host` (`boolean`, optional): Resize, convert and host eligible images on Campaign Cleaner's CDN. Defaults to true. Example: true.
- `set_image_max_width` (`integer`, optional): Apply this max-width in pixels to all images. Example: 600.
- `surrounding_div` (`object`, optional): Wrap the HTML in a div with max_width (pixels), text_align (left, center or right), font_size (pixels) and center_to_parent (true or false). Example: {"max_width": 600, "text_align": "left", "font_size": 15, "center_to_parent": true}
- `webhook_url` (`string`, optional): Absolute URL with no query string that receives the results when processing finishes. Example: https://example.com/webhooks/campaign-cleaner.

Example input: `{"campaign_html":"<campaign_html>","campaign_name":"<campaign_name>"}`

### `campaigncleaner_inbox_test_create`

Create Inbox Placement Test · Write

Create an inbox placement test and get the seed addresses to send your campaign to.
Returns job_id, test_name, mailtester_address and the send_to list of seed addresses.
Send the campaign to every address, then poll campaigncleaner_inbox_test_results_get. Needs a subscription that includes it; uses 1 credit.

Read only: no. Destructive: no. Idempotent (safe to retry): no.

Inputs:

- `test_name` (`string`, required): Name of the test, up to 80 characters. Example: Spring Sale Inbox Test.

Example input: `{"test_name":"<test_name>"}`

### `campaigncleaner_monitor_alert_save`

Save Monitor Alert · Write

Create an alert rule, or replace an existing one when alert_id is given.
Returns the saved alert.
Recipients must be the account owner, team members or addresses at a verified domain.

Read only: no. Destructive: no. Idempotent (safe to retry): no.

Inputs:

- `kind` (`string`, required): spam (mail lands in spam), notinbox (spam, Gmail tabs or Outlook Other), rate (inbox rate below threshold) or auth (SPF, DKIM or DMARC fails). Example: spam. One of: `spam`, `notinbox`, `rate`, `auth`.
- `alert_id` (`integer`, optional): ID of the alert to replace. Leave empty to create a new one. Example: 4.
- `delivery` (`string`, optional): instant, or digest (once a day). Defaults to instant. Example: instant. One of: `instant`, `digest`.
- `domain_id` (`integer`, optional): One monitored domain; leave empty or 0 for all. Example: 13.
- `enabled` (`boolean`, optional): Whether the alert is on. Defaults to true. Example: true.
- `min_messages` (`integer`, optional): For kind rate: minimum messages in 24 hours before it can trigger, 1 to 1000. Defaults to 5. Example: 5.
- `provider_key` (`string`, optional): One provider (from campaigncleaner_monitor_seeds_list); leave empty for all. Example: gmail.com.
- `recipients` (`array`, optional): Up to 5 email addresses; empty sends to the account owner. Example: ["ops@example.com"]
- `threshold` (`integer`, optional): For kind rate: inbox rate in percent, 1 to 100. Defaults to 80. Example: 80.

Example input: `{"kind":"spam"}`

### `campaigncleaner_monitor_domain_add`

Add Monitor Domain · Write

Add a sending domain to the Inbox Placement Monitor.
Returns the domain with the DNS TXT record to publish and the next step.
Publish the record, then call campaigncleaner_monitor_domain_verify.

Read only: no. Destructive: no. Idempotent (safe to retry): no.

Inputs:

- `domain` (`string`, required): The domain you send From, such as news.example.com. Freemail and shared sending domains can't be added. Example: news.example.com.
- `alerts_only` (`boolean`, optional): true verifies the domain only so alerts can be sent to addresses at it; it is not monitored. Defaults to false. Example: false.

Example input: `{"domain":"<domain>"}`

### `campaigncleaner_monitor_domain_verify`

Verify Monitor Domain · Write

Check the DNS TXT record of a pending monitored domain.
Returns verified (true or false), a message and the domain's status.
DNS can take a while; retry later if not verified.

Read only: no. Destructive: no. Idempotent (safe to retry): yes.

Inputs:

- `domain_id` (`integer`, required): ID of the monitored domain, from campaigncleaner_monitor_domains_list. Example: 13.

Example input: `{"domain_id":13}`

### `campaigncleaner_campaign_delete`

Delete Campaign · Destructive

Permanently delete a saved campaign and its analysis.
Returns status success.
This cannot be undone.

Read only: no. Destructive: yes. Idempotent (safe to retry): yes.

Inputs:

- `campaign_id` (`string`, required): ID of the saved campaign, from campaigncleaner_campaign_send or campaigncleaner_campaigns_list. Example: 4f8a2c1e9b7d.

Example input: `{"campaign_id":"<campaign_id>"}`

### `campaigncleaner_monitor_alert_delete`

Delete Monitor Alert · Destructive

Delete an alert rule and its alert history.
Returns the status.
Use campaigncleaner_monitor_alerts_list for alert IDs.

Read only: no. Destructive: yes. Idempotent (safe to retry): yes.

Inputs:

- `alert_id` (`integer`, required): ID of the alert to delete. Example: 4.

Example input: `{"alert_id":4}`

### `campaigncleaner_monitor_domain_remove`

Remove Monitor Domain · Destructive

Remove a monitored domain; its stored messages and alerts are deleted immediately.
Returns the status.
This cannot be undone.

Read only: no. Destructive: yes. Idempotent (safe to retry): yes.

Inputs:

- `domain_id` (`integer`, required): ID of the monitored domain, from campaigncleaner_monitor_domains_list. Example: 13.

Example input: `{"domain_id":13}`

## Related

Other Marketing connectors ([all 190](/agentkit/connectors/?category=marketing)):

- [HubSpot](/agentkit/connectors/hubspot/): Scalekit connector, OAuth, 457 tools
- [Mailchimp](/agentkit/connectors/mailchimp/): Scalekit connector, OAuth, 73 tools
- [Twitter / X](/agentkit/connectors/twitteroauth/): Scalekit connector, OAuth, 92 tools


---

## More Scalekit documentation

| Resource | What it contains | When to use it |
|----------|-----------------|----------------|
| [/llms.txt](/llms.txt) | Structured index with routing hints per product area | Start here — find which documentation set covers your topic before loading full content |
| [/llms-full.txt](/llms-full.txt) | Complete documentation for all Scalekit products in one file | Use when you need exhaustive context across multiple products or when the topic spans several areas |
| [sitemap-0.xml](https://docs.scalekit.com/sitemap-0.xml) | Full URL list of every documentation page | Use to discover specific page URLs you can fetch for targeted, page-level answers |
