Back to articlesTechnology
Driving email campaigns with AI agents
When every action is an API call, an AI agent can do all the work: write, target, send, measure, repeat. Here’s what that looks like in practice.
#ai-agent#api#automation#emailing
Mike Codeur
August 09, 20263 min
Driving campaigns with AI agents
Most marketing tools have an API at the edge: a way to export contacts, wire up a webhook. The real work still happens with a mouse. AgentMail flips that. The API is the product, the web interface is just one client. Any action you can do on screen is an HTTP call — which makes it doable by an agent.What "driving with an agent" means
An AI agent — a script, an assistant, a workflow — chains the steps with no human intervention in between:- Create and fill a list —
POST /api/v1/lists, then a bulk contact import, up to 500 per call. - Write a template —
POST /api/v1/templates, with the email's HTML. - Create a campaign from that template, then edit its content independently —
PATCH /api/v1/campaigns/{id}. - Trigger the send —
POST /api/v1/campaigns/{id}/send. - Read the results —
GET /api/v1/campaigns/{id}returns progress, sends, bounces.
A concrete example
# 1. Create the list
curl -X POST https://emails.example.com/api/v1/lists \
-H "x-api-key: $MK_API_KEY" \
-d '{"name":"Active customers"}'
# 2. Import contacts in bulk
curl -X POST https://emails.example.com/api/v1/lists/$LIST_ID/contacts/bulk \
-H "x-api-key: $MK_API_KEY" \
-d '{"contacts":[{"email":"ada@example.com","firstName":"Ada"}]}'
# 3. Launch the campaign
curl -X POST https://emails.example.com/api/v1/campaigns/$CAMPAIGN_ID/send \
-H "x-api-key: $MK_API_KEY"Why it's useful, not just clever
Repetition disappears. A weekly campaign to a segment that changes each week no longer needs manual handling: the agent recomputes the target, adapts the message, sends, and hands you a report. The guardrails stay. Driving by API doesn't mean opening everything. Sending stays protected — an organization must be explicitly allowed to send, and triggering requires a specific role. A misconfigured agent can't burn your sender reputation. Tracking is legible. At any moment, the agent — or you — can query a campaign's state: how many sends went out, how many are in flight, how long since the last activity. Enough to tell a slow send from a stuck one.The right level of autonomy
Driving with an agent doesn't mean automating everything blindly. The model that works lets the agent prepare — write, target, schedule — and keeps a human check before the sends that matter. That's exactly what an API where every step is a separate call enables: you choose what the agent does alone, and what goes through you.Written by
MC
Mike Codeur
Author
Related Articles
Tech
React 19 New Features
Discover the revolutionary new features of React 19
Aug 08, 20261 min
Read more
MarketingHow to write a marketing campaign that gets read
A good marketing email isn’t a pretty one. It’s one that gets opened, read, and clicked. Subject line, structure, call to action: the principles that actually matter.
Aug 09, 20263 min
Read more
DevelopmentGood email deliverability: DNS, SPF, DKIM, DMARC
Sending an email is easy. Getting it into the inbox is not. A tour of the DNS records that decide whether your campaigns land — or fall into spam.
Aug 09, 20263 min
Read more