> ## Documentation Index
> Fetch the complete documentation index at: https://ahasend.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> AhaSend stores all message data in the EU. See /facts.
> The API base URL is https://api.ahasend.com. Send the API key in the Authorization: Bearer header. See /api-reference/authentication.
> Use send.ahasend.com for SMTP. Ports 25, 587 and 2525 use STARTTLS. Port 465 is not supported. See /smtp.
> For send-only integrations, create an API Key v2 under Credentials → Add and scope it to messages:send:{your-domain}. See /send-api/credentials and /api-reference/scopes.

# Campaigns Through the API, CLI and MCP Server

> Automate Campaign Builder: push contacts from your app, manage lists and templates, and create, test and send campaigns with the API, CLI or MCP server.

Contacts, lists, campaign templates and campaigns are resources of the Management API, with commands in the CLI and tools in the MCP server. Two things stay in the dashboard: defining custom fields, under **Marketing > Contact fields**, and editing Simple Editor designs. The dashboard, the API, the CLI and the MCP server all work on the same data, so a contact pushed from your app shows up in the dashboard at once, and a campaign drafted by an AI tool is there for you to review.

## Typical Automations

* **Keep contacts in sync.** Push each new signup from your app or website as it happens with [Create Contact](/docs/api-reference/contacts/create-contact), or import up to 1,000 at once with [Batch Upsert Contacts](/docs/api-reference/contacts/batch-upsert-contacts). Add them to lists with [Batch Add List Contacts](/docs/api-reference/lists/batch-add-list-contacts). Batch Upsert Contacts updates contacts that already exist; Create Contact refuses an address that already exists with a `409`.
* **Mirror unsubscribes.** When a user opts out in your app, set `unsubscribed: true` with [Update Contact](/docs/api-reference/contacts/update-contact), or unsubscribe from one list with [Add or Update a List Contact](/docs/api-reference/lists/upsert-list-contact).
* **Generate a campaign.** Create the campaign from a template with [Create Campaign](/docs/api-reference/campaigns/create-campaign), fill the content from your CMS, send a test with [Test Campaign](/docs/api-reference/campaigns/test-campaign), and schedule it with [Send Campaign](/docs/api-reference/campaigns/send-campaign). The campaign goes through the same [checks and review](/docs/campaigns/test-and-send#review) as one made in the dashboard.
* **Pull the results.** Read the counters and rates with [Get Campaign Stats](/docs/api-reference/campaigns/get-campaign-stats), and the recipients behind a count with [List Campaign Recipients](/docs/api-reference/campaigns/get-campaign-recipients). For events as they happen, use [webhooks](/docs/integrations/webhooks).

## API

The [Campaigns API overview](/docs/api-reference/campaigns/overview) walks through a campaign from draft to report, with the statuses, the issues and the idempotency rules. The [Contacts API](/docs/api-reference/contacts/overview) and [Lists API](/docs/api-reference/lists/overview) overviews explain contacts, memberships and consent.

You need an API key with the `contacts`, `lists`, `campaigns` and, for templates, `templates` scopes; legacy v1 keys cannot be used. See [permission scopes](/docs/api-reference/scopes). The official [Node.js](/docs/guides/nodejs-sdk) and [Go](/docs/guides/go-sdk) SDKs cover these endpoints.

## CLI

The CLI has a command group for each resource: [`ahasend contacts`](/docs/cli/commands/contacts), [`ahasend lists`](/docs/cli/commands/lists) and [`ahasend campaigns`](/docs/cli/commands/campaigns), the last one including `campaigns templates`. Use them for scripts and one-off jobs, such as a nightly import from your database or a test send from a deploy pipeline.

## MCP Server

With the [MCP server](/docs/mcp-server), an AI tool such as Claude, ChatGPT or Cursor can do the same work in plain language: build a list from an export you hand it, import an MJML file as a template, fill a campaign from your blog posts, send you a test and schedule the send. Connect the tool with the **Marketer** preset, which reads everything and manages templates, contacts, lists and campaigns.

Important to know: a campaign only goes out after your consent. Before the agent sends or schedules one, your AI tool shows you the send time, the number of contacts, the name, the subject, the sender and the lists, and nothing is sent until you say yes. Also, a design made in the Simple Editor can be changed only in the dashboard.

## Related Guides

* [Campaign Builder overview](/docs/campaigns), [Creating a campaign](/docs/campaigns/create), [Testing, review and sending](/docs/campaigns/test-and-send).
* [Campaigns API](/docs/api-reference/campaigns/overview), [CLI quickstart](/docs/cli/quickstart), [MCP server](/docs/mcp-server).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.