Quickstart

This guide walks you through connecting a mailbox, creating a campaign, and sending your first email — all in about 5 minutes.

Step 1: Get an API key

Sign up at zend.sh, go to your dashboard, and create an API key.

Keys use a prefix format:

  • zk_live_... — Production (sends real emails)
  • zk_test_... — Sandbox (validates requests but does not send)

Store your key securely. You will not be able to see it again after creation.

Step 2: Install the SDK

Choose your language:

npm install zend-sh

Or use the REST API directly with curl:

curl -H "Authorization: Bearer zk_live_..." https://app.zend.sh/api/v1/health

Step 3: Connect a mailbox

Connect a Google Workspace mailbox using the TypeScript SDK:

import { ZendClient } from 'zend-sh'

const zend = new ZendClient({ apiKey: 'zk_live_...' })

const account = await zend.accounts.create({
  email: 'outreach@yourcompany.com',
  provider: 'google',
  smtp_host: 'smtp.gmail.com',
  smtp_port: 465,
  smtp_username: 'outreach@yourcompany.com',
  smtp_password: 'your-app-password',
  imap_host: 'imap.gmail.com',
  imap_port: 993,
  imap_username: 'outreach@yourcompany.com',
  imap_password: 'your-app-password',
})

See the Mailbox Setup Guide for Google Workspace app passwords, Microsoft 365 OAuth, and custom SMTP configuration.

Step 4: Create a campaign

Create a campaign with a send window that respects business hours:

const campaign = await zend.campaigns.create({
  name: 'Q1 Outreach',
  stop_on_reply: true,
  send_window: {
    timezone: 'America/New_York',
    days: ['monday', 'tuesday', 'wednesday', 'thursday', 'friday'],
    start_hour: 9,
    end_hour: 17,
  },
})

Add an email step with variable substitution:

await zend.campaigns.steps.create(campaign.id, {
  type: 'email',
  position: 1,
  subject: 'Quick question, {{first_name|there}}',
  body: 'Hi {{first_name|there}},\n\nI noticed {{company}} is scaling their outbound efforts. We built zend.sh to handle the infrastructure side — mailbox rotation, health monitoring, and deliverability.\n\nWould it make sense to chat for 15 minutes this week?\n\nBest,\nYour Name',
})

Add a follow-up after a 3-day delay:

await zend.campaigns.steps.create(campaign.id, {
  type: 'delay',
  position: 2,
  delay_days: 3,
})

await zend.campaigns.steps.create(campaign.id, {
  type: 'email',
  position: 3,
  subject: 'Re: Quick question, {{first_name|there}}',
  body: 'Hi {{first_name|there}},\n\nJust circling back on my previous note. Happy to share how other teams in {{company|your space}} are handling cold email infrastructure.\n\nBest,\nYour Name',
})

Step 5: Add leads and start

Enroll leads into your campaign:

await zend.campaigns.leads.add(campaign.id, {
  leads: [
    { email: 'jane@acme.com', first_name: 'Jane', company: 'Acme' },
    { email: 'bob@globex.com', first_name: 'Bob', company: 'Globex' },
  ],
})

Start the campaign:

await zend.campaigns.start(campaign.id)

Emails will begin sending within your configured send window.

Step 6: Monitor

Check your campaign analytics:

const stats = await zend.analytics.campaign(campaign.id)
console.log(stats)
// { sent: 2, delivered: 2, bounced: 0, replied: 1, ... }

Set up a webhook to receive real-time events:

await zend.webhooks.create({
  url: 'https://yourapp.com/webhooks/zend',
  events: ['email.sent', 'email.bounced', 'email.replied'],
})

Next steps