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

# Add Email Accounts to Campaign

> Associates one or more email accounts with a campaign for automatic sender rotation.

<Note>
  Associates one or more email accounts with a campaign for automatic sender rotation SmartLead distributes emails across added accounts to maximize deliverability, avoid ESP limits, and build sender reputation
</Note>

## Overview

Associates one or more email accounts with a campaign for automatic sender rotation

**Key Features**:

* Validates account ownership and connection status before adding

<Warning>
  Accounts must be successfully connected (is\_smtp\_success=true, is\_imap\_success=true) and not suspended
</Warning>

## Path Parameters

<ParamField path="campaign_id" type="number" required>
  The campaign ID
</ParamField>

## Query Parameters

<ParamField query="api_key" type="string" required>
  Your SmartLead API key
</ParamField>

## Request Body

<ParamField body="email_account_ids" type="array" required>
  Array of email account IDs to add to the campaign

  Example: `[456, 457, 458]`
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "https://server.smartlead.ai/api/v1/campaigns/123/email-accounts?api_key=YOUR_KEY" \
    -H "Content-Type: application/json" \
    -d '{"email_account_ids": [456, 457, 458]}'
  ```

  ```python Python theme={null}
  import requests

  API_KEY = "YOUR_API_KEY"
  campaign_id = 123

  payload = {
      "email_account_ids": [456, 457, 458]
  }

  response = requests.post(
      f"https://server.smartlead.ai/api/v1/campaigns/{campaign_id}/email-accounts",
      params={"api_key": API_KEY},
      json=payload
  )

  print("Email accounts added successfully!")
  ```

  ```javascript JavaScript theme={null}
  const API_KEY = 'YOUR_API_KEY';
  const campaignId = 123;

  const response = await fetch(
    `https://server.smartlead.ai/api/v1/campaigns/${campaignId}/email-accounts?api_key=${API_KEY}`,
    {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({
        email_account_ids: [456, 457, 458]
      })
    }
  );
  ```
</RequestExample>

## Response Codes

<ResponseField name="200" type="Success">
  Request successful
</ResponseField>

<ResponseField name="400" type="Bad Request">
  Invalid request parameters or malformed request body
</ResponseField>

<ResponseField name="401" type="Unauthorized">
  Invalid or missing API key. Check your authentication.
</ResponseField>

<ResponseField name="404" type="Not Found">
  The requested resource (campaign, lead, email account, etc.) does not exist or you don't have access to it
</ResponseField>

<ResponseField name="422" type="Validation Error">
  Request validation failed. Check parameter types, required fields, and value constraints.
</ResponseField>

<ResponseField name="429" type="Rate Limit Exceeded">
  Too many requests. Please slow down and retry after the rate limit resets.
</ResponseField>

<ResponseField name="500" type="Internal Server Error">
  Server error occurred. Please try again or contact support if the issue persists.
</ResponseField>

<ResponseField name="503" type="Service Unavailable">
  API is temporarily unavailable or under maintenance. Please try again later.
</ResponseField>

<ResponseExample>
  ```json 200 - Success theme={null}
  {
    "ok": true
  }
  ```

  ```json 401 - Unauthorized theme={null}
  {
    "message": "Invalid API Key"
  }
  ```

  ```json 404 - Not Found theme={null}
  {
    "error": "Resource not found"
  }
  ```

  ```json 422 - Validation Error theme={null}
  {
    "error": "Invalid parameters provided"
  }
  ```
</ResponseExample>

## Best Practices

<Tip>
  **Use Multiple Accounts**: Add 5-10 email accounts for better deliverability and higher sending volume
</Tip>

<Tip>
  **Ensure Warmup**: Only add accounts that are warmed up (reputation >80%)
</Tip>

<Tip>
  **Check Limits**: Make sure accounts have sufficient daily sending capacity
</Tip>

## Account Rotation

SmartLead automatically rotates between added accounts to:

* Distribute sending load
* Improve deliverability
* Build sender reputation
* Maximize daily volume

## Implementation Details

Accounts are immediately available for rotation. Ensure accounts are warmed up before adding to campaigns.

**Response Format**: object

## Related Endpoints

* [Get Campaign Email Accounts](/api-reference/campaigns/get-email-accounts)
* [Remove Email Accounts](/api-reference/campaigns/remove-email-accounts)
* [Get All Email Accounts](/api-reference/email-accounts/get-all)
