> ## 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.

# Email Data Retention Settings

> Set AhaSend email content and metadata retention within your plan limits, check the seven-day defaults, and request approval for zero data retention.

AhaSend retention settings control how long message metadata and content remain available; this guide explains the defaults, plan ranges and per-message overrides.

Available on Free, Pro and Max; the retention ranges depend on your plan, and zero message-data retention needs approval. See [plans and features](/docs/facts#plans-and-features).

<Info>
  Choose retention periods that fit your privacy policy. A retention setting alone does not establish compliance with a law or standard.
</Info>

## Retention Limits

| Setting | Free | Pro | Max | New-account default |
| - | - | - | - | - |
| Message metadata | 1–7 days | 1–14 days | 1–30 days | 7 days |
| Message data | 1–7 days | 0–14 days | 0–30 days | 7 days |

Zero data retention needs approval from AhaSend, to prevent abuse. Per-message retention headers are capped at the plan's maximum. Both settings are configurable within your plan's range.

All message data is stored in the EU. See [data location and the data processing agreement](/docs/facts). After retention expires, the affected content or metadata is no longer available; [S3 archives](/docs/retention/s3) have their own storage policy.

## Message Data vs Metadata

Understanding the difference between data and metadata helps you set appropriate retention policies:

<AccordionGroup>
  <Accordion title="Message Metadata" icon="tag">
    **Minimal tracking information kept for delivery monitoring:**

    * Message ID and email subject
    * From and recipient email addresses
    * Message direction (outbound/inbound)
    * Delivery status (received, delivered, bounced, failed)
    * Delivery attempt logs and timestamps

    **Retention:** 1 day to your plan's maximum (see the table above)
  </Accordion>

  <Accordion title="Message Data" icon="envelope">
    **Complete email content and details:**

    * All email headers
    * HTML and plain text body content
    * File attachments
    * Full message payload

    **Retention:** Within your plan's range; 0 days needs approval

    <Warning>
      **Message routing needs message data.** Keep message data retention at 1 day or more on any account that uses [message routing](/docs/integrations/routing).
    </Warning>
  </Accordion>
</AccordionGroup>

## Account-Wide Settings

Configure default retention periods for your entire account:

<Steps>
  <Step title="Access Retention Settings" icon="gear">
    1. **Log in** to your [AhaSend Dashboard](https://dash.ahasend.com)
    2. **Navigate** to **[Account Settings](https://dash.ahasend.com/account/-/settings)**
    3. **Find** the **Retention Policy** section
  </Step>

  <Step title="Set Default Periods" icon="calendar">
    **Configure retention periods:**

    * **Message Metadata:** Within your plan's range (new-account default: 7 days)
    * **Message Data:** Within your plan's range (new-account default: 7 days)

    <Warning>
      **Minimum Requirements:** Message metadata requires at least 1 day retention for delivery tracking. Message data can be set to 0 days on Pro and Max after approval from AhaSend. Accounts that use message routing must keep message data for at least 1 day: routes deliver inbound emails from stored message data and stop working at 0 days.
    </Warning>
  </Step>

  <Step title="Save Changes" icon="check">
    **Apply settings** to all future emails sent through your account.

    <Note>
      **Existing Data:** Changes only affect new emails. Previously sent emails retain their original retention settings.
    </Note>
  </Step>
</Steps>

## Per-Message Overrides

Override account defaults for specific emails using special headers:

### SMTP Headers

When sending via SMTP, add these headers to individual emails:

```plaintext theme={null}
ahasend-metadata-retention: 7
ahasend-data-retention: 0
```

<AccordionGroup>
  <Accordion title="ahasend-metadata-retention" icon="tag">
    **Controls metadata retention period:**

    * **Value:** Integer from 1 to your plan's maximum (days)
    * **Purpose:** Set how long delivery tracking data is kept
    * **Example:** `ahasend-metadata-retention: 7` (keep for 7 days)
  </Accordion>

  <Accordion title="ahasend-data-retention" icon="envelope">
    **Controls full email data retention:**

    * **Value:** Integer within your plan's range (days); 0 needs approval
    * **Purpose:** Set how long complete email content is stored
    * **Example:** `ahasend-data-retention: 0` (delete immediately)
  </Accordion>
</AccordionGroup>

### API v1 Implementation

For API v1, include retention headers in your message payload:

```json theme={null}
{
  "from": {
    "email": "hello@yourdomain.com",
    "name": "Your Company"
  },
  "recipients": [
    {
      "email": "user@example.com",
      "name": "John Doe"
    }
  ],
  "content": {
    "subject": "Sensitive Information",
    "text_body": "This email contains sensitive data.",
    "headers": {
      "ahasend-metadata-retention": "1",
      "ahasend-data-retention": "0"
    }
  }
}
```

### API v2 Implementation

For API v2, use the dedicated retention fields:

```json theme={null}
{
  "from": {
    "email": "hello@yourdomain.com",
    "name": "Your Company"
  },
  "recipients": [
    {
      "email": "user@example.com",
      "name": "John Doe"
    }
  ],
  "subject": "Sensitive Information",
  "text_content": "This email contains sensitive data.",
  "retention": {
    "metadata": 1,
    "data": 0
  }
}
```

<Info>
  **Full API v2 Documentation:** See the [Create Message API reference](/docs/api-reference/messages/create-message) for complete documentation on all available fields and options.
</Info>

<Note>
  **Header Removal:** Retention headers are automatically removed before email delivery and never visible to recipients.
</Note>

## Common Use Cases

Use the settings below only when they fit your plan's range. Any 0-day data setting needs prior approval.

<AccordionGroup>
  <Accordion title="Financial Services" icon="building-columns">
    **Compliance Requirements:**

    * Short retention for sensitive financial data
    * Metadata retention for audit trails

    **Recommended Settings:**

    * Metadata: 7-30 days
    * Data: 0-1 days for sensitive emails
  </Accordion>

  <Accordion title="Healthcare" icon="user-doctor">
    **Data minimisation:**

    * Minimal retention of patient information
    * Quick deletion of medical data

    **Recommended Settings:**

    * Metadata: 1-7 days
    * Data: 0 days for patient emails
  </Accordion>

  <Accordion title="Marketing" icon="bullhorn">
    **Campaign Tracking:**

    * Longer retention for analytics
    * Full content for A/B testing

    **Recommended Settings:**

    * Metadata: 30 days
    * Data: 30 days
  </Accordion>

  <Accordion title="Transactional" icon="receipt">
    **Order Confirmations:**

    * Medium retention for customer service
    * Balance between utility and privacy

    **Recommended Settings:**

    * Metadata: 30 days
    * Data: 7-14 days
  </Accordion>
</AccordionGroup>

## Best Practices

<AccordionGroup>
  <Accordion title="Compliance Strategy" icon="shield-check">
    **Develop a Retention Policy:**

    * Review legal requirements for your industry
    * Consider customer privacy expectations
    * Document your retention decisions
    * Regularly audit and update policies

    **Implementation Tips:**

    * Start with shorter periods and extend if needed
    * Use per-message overrides for sensitive content
    * Monitor compliance with internal policies
  </Accordion>

  <Accordion title="Operational Considerations" icon="gear">
    **Balance Compliance and Functionality:**

    * Keep metadata longer for delivery troubleshooting
    * Delete sensitive data quickly while retaining delivery records
    * Consider customer service needs for support queries

    **Monitoring:**

    * Track delivery issues that may require message data
    * Review retention effectiveness regularly
    * Adjust policies based on operational needs
  </Accordion>
</AccordionGroup>

## Related Guides

* [API authentication](/docs/api-reference/authentication), [Send-only API keys](/docs/send-api/credentials), [Account settings API](/docs/api-reference/accounts/update-account).
* [SMTP retention headers](/docs/smtp/special-headers), [API message retention](/docs/api-reference/messages/create-message), [S3 archiving](/docs/retention/s3).
* [Plans and limits](/docs/facts), [Tracking setup](/docs/tracking/open-tracking).


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