> ## 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 in the EU, or send-us.ahasend.com as a US connection point forwarding to the EU. 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.

# Migrate from Resend

> Migrate from Resend to AhaSend with API field and SMTP setting maps, webhook event changes, suppression import steps and a gradual traffic switch.

AhaSend migration from Resend means changing your send call or SMTP settings, mapping delivery events and carrying blocked recipients across before moving traffic.

## Prepare the AhaSend Account

[Verify the sending domain](/docs/domains) and create a domain-scoped [send-only v2 key](/docs/send-api/credentials) or [SMTP credential](/docs/smtp/credentials). Keep the old provider active while you test. Record your existing templates, headers, tracking choices, sender addresses, jobs and suppression rules so you can compare behavior.

## Map the API Fields

Use the [AhaSend Create Message endpoint](/docs/api-reference/messages/create-message) with [v2 authentication](/docs/api-reference/authentication). This is a field mapping from [Resend's send API](https://resend.com/docs/api-reference/emails/send-email), not a drop-in change of base URL.

| Resend field                        | AhaSend v2 field or change                                                                                        |
| ----------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
| `from` string                       | `from` address object                                                                                             |
| `to` strings                        | `recipients[]` address objects                                                                                    |
| `subject`, `text`, `html`           | `subject`, `text_content`, `html_content`                                                                         |
| `reply_to`                          | One `reply_to` address object; review workflows that use several addresses                                        |
| `headers`                           | `headers` string-value object                                                                                     |
| `tags` name/value pairs             | `tags` strings; pick a consistent representation such as `kind:receipt`                                           |
| React email content                 | Render it to HTML in your app, then send `html_content`                                                           |
| `attachments[].filename`, `content` | `file_name`, `data`, `content_type` and `base64: true` for base64 bytes; remote paths must be fetched by your app |
| `scheduled_at`                      | `schedule.first_attempt` as RFC3339 within the allowed window                                                     |
| `cc`, `bcc`                         | [Create Conversation](/docs/api-reference/messages/create-conversation)                                                |

AhaSend Create Message returns HTTP 202 with a result for each recipient; check each `status`, including `error`, instead of treating the request as all-or-nothing. Follow [send examples](/docs/send-api/send-email) for an actual sandbox call. Keep a stable business-event [idempotency key](/docs/api-reference/idempotency) with an unchanged payload and separate keys for sandbox and live work. Review [schedule limits](/docs/send-api/send-email) before moving future jobs.

## Replace the SMTP Settings

Replace `smtp.resend.com`, username `resend` and its API-key password with AhaSend's host and separate SMTP credentials. Use STARTTLS instead of carrying over an implicit-TLS configuration. See [Resend's SMTP guide](https://resend.com/docs/send-with-smtp).

| Setting                   | AhaSend value                                                                                       |
| ------------------------- | --------------------------------------------------------------------------------------------------- |
| Host                      | `send.ahasend.com`                                                                                  |
| Port in this migration    | `587`                                                                                               |
| Encryption                | STARTTLS                                                                                            |
| Username and password     | A new AhaSend SMTP credential; use sandbox credentials for tests                                    |
| Provider-specific headers | Replace with supported [AhaSend headers](/docs/smtp/special-headers) only where they serve the same task |

See [SMTP settings](/docs/smtp) for all hosts, ports, TLS requirements and limits. Keep your existing mail library and change its transport configuration; use the [language examples](/docs/smtp) to test.

## Map Events by Meaning

These are the closest matching outcomes, not identical payloads or a guaranteed one-to-one event sequence. Keep the provider name with each saved message ID while both systems are active. See [Resend's event documentation](https://resend.com/docs/webhooks/event-types) and the [AhaSend event list](/docs/api-reference/webhooks).

| Resend event                     | AhaSend event or application handling                                                |
| -------------------------------- | ------------------------------------------------------------------------------------ |
| `email.sent`                     | `message.reception` as the closest acceptance-stage event; provider pipelines differ |
| `email.delivered`                | `message.delivered`                                                                  |
| `email.delivery_delayed`         | `message.transient_error`                                                            |
| `email.bounced`                  | `message.bounced`                                                                    |
| `email.failed`                   | `message.failed` or a send-response error, depending on the stage                    |
| `email.suppressed`               | `message.suppressed`                                                                 |
| `email.complained`               | `suppression.created` with a complaint reason                                        |
| `email.opened` / `email.clicked` | `message.opened` / `message.clicked` when tracking is enabled                        |

Create a separate AhaSend webhook configuration and replace the old verification code with [AhaSend signature checks](/docs/api-reference/webhooks/security). Parse AhaSend's payload shape, deduplicate by its delivery header, and acknowledge verified unknown event types with 2xx. Do not reuse the old provider's signing secret, retry assumptions or event IDs.

## Export the Old Recipient Blocks

Open Resend's **Suppressions** page and choose **Download CSV**, as described in [Resend's suppression guide](https://resend.com/docs/dashboard/emails/email-suppressions). Preserve each address and its reason, including manually added blocks. Resend suppressions apply across the team’s domains: copy each required block to every AhaSend sending domain it must cover, and keep the team-wide rule in your application. Include contact unsubscribes separately: a contact preference and an email suppression are different records. Compare the export with saved bounce/complaint events and your application's opt-out records before switching.

## Import Suppressions Before Switching Traffic

Export blocked addresses using the old provider's options described above. Include hard bounces, complaints, unsubscribes and application-level opt-outs; deduplicate by address and sending domain without losing the reason. Keep the original export and your application's durable preferences. A provider change is not permission to mail an opted-out address again.

Normalize the export into a CSV with `email,domain,reason,expires_at` columns. `domain` is the **AhaSend sending domain**, not the recipient's domain. This sample row is a format template; replace both placeholders. Select an expiry that preserves your block policy, and keep permanent opt-outs blocked in your own app beyond that time. See [suppression durations](/docs/bounces#suppression-duration).

```csv suppressions.csv theme={null}
email,domain,reason,expires_at
blocked@example.com,YOUR_SENDING_DOMAIN,Migrated unsubscribe,RFC3339_FUTURE_EXPIRY
```

Use Python 3.13 or newer; the script needs no third-party packages. Set `AHASEND_ACCOUNT_ID` and `AHASEND_IMPORT_KEY`, a separate [full API key](/docs/api-reference/authentication) with `suppressions:write`. This is a real management operation: sandbox mode does not apply to suppressions. First test with a unique address on your test sending domain, then verify it with [List Suppressions](/docs/api-reference/suppressions/get-suppressions).

Save the following as `import_suppressions.py`. It validates the whole CSV before making changes and stops on the first failed request. It requires an explicit domain so an empty cell cannot broaden the import to all domains.

```python import_suppressions.py theme={null}
import csv, hashlib, json, os, sys, time, urllib.error, urllib.request
from datetime import datetime, timezone
with open(sys.argv[1], newline="", encoding="utf-8-sig") as source:
    rows = list(csv.DictReader(source))
fields = ("email", "domain", "reason", "expires_at")
for number, row in enumerate(rows, 1):
    if any(not row.get(field, "").strip() for field in fields):
        raise SystemExit(f"Row {number}: fill every required column")
    expiry = datetime.fromisoformat(row["expires_at"].replace("Z", "+00:00"))
    if expiry.tzinfo is None or expiry <= datetime.now(timezone.utc):
        raise SystemExit(f"Row {number}: use a future expiry with a timezone")
url = f"https://api.ahasend.com/v2/accounts/{os.environ['AHASEND_ACCOUNT_ID']}/suppressions"
for number, row in enumerate(rows, 1):
    payload = {field: row[field].strip() for field in fields}
    encoded = json.dumps(payload, sort_keys=True).encode()
    request = urllib.request.Request(url, encoded, headers={
        "Authorization": f"Bearer {os.environ['AHASEND_IMPORT_KEY']}",
        "Content-Type": "application/json",
        "Idempotency-Key": "import-" + hashlib.sha256(encoded).hexdigest(),
    })
    try:
        with urllib.request.urlopen(request, timeout=15) as response:
            result = json.load(response)
            if response.status != 201 or not result.get("data"):
                raise ValueError("Unexpected import result")
    except (urllib.error.URLError, TimeoutError, ValueError):
        raise SystemExit(f"Stopped at row {number}; inspect it before retrying") from None
    print(f"Imported row {number}")
    time.sleep(0.05)
```

Run `python import_suppressions.py suppressions.csv`. An existing suppression can return 409: compare its domain, reason and expiry before deciding what to do. Do not delete it just to make the import pass. A stopped run may have imported earlier rows, so keep the progress output and reconcile uncertain requests. Exact retries reuse a stable [idempotency key](/docs/api-reference/idempotency); after its time limit, verify existing records before retrying. Keep imports within [API rate limits](/docs/api-reference/rate-limits).

## Switch Traffic in Small Steps

1. Verify the AhaSend domain and leave the old provider's required DNS in place while it still sends. Test the new code in [sandbox mode](/docs/send-api/sandbox), including failure and suppression paths.
2. Keep your message templates in your app or adapt them explicitly. Provider template IDs, recipient lists, request IDs and signing secrets do not transfer to AhaSend automatically.
3. Import suppressions, then update your saved recipient preferences. Repeat the export/import for changes made since the initial snapshot before moving each traffic group.
4. Route each new job to exactly one provider. Keep that choice, the saved payload and your application event ID with the job so a retry cannot silently switch providers and duplicate it.
5. Move a small group of expected mail, compare acceptance, bounces and delivery delays, and increase only when results remain stable. Follow [deliverability and warm-up guidance](/docs/deliverability).
6. Keep receiving old-provider events for in-flight messages. If you roll back, route only new unsent jobs back and preserve all new suppressions. Retire old credentials, DNS and event handlers after old work has finished.

## Related Guides

* [Domain setup](/docs/domains), [DNS providers](/docs/dns), [send-only API keys](/docs/send-api/credentials) and [SMTP credentials](/docs/smtp/credentials).
* [Send through the API](/docs/send-api/send-email), [SMTP settings](/docs/smtp), [Node.js SDK](/docs/guides/nodejs-sdk), [Go SDK](/docs/guides/go-sdk) and [CLI quickstart](/docs/cli/quickstart).
* [Webhook setup](/docs/integrations/webhooks), [signature verification](/docs/api-reference/webhooks/security), [bounces and suppression durations](/docs/bounces), [API errors](/docs/api-reference/errors) and [idempotency](/docs/api-reference/idempotency).
