Skip to main content
POST
This is the API equivalent of the Reallocate Mailboxes button in the app. Use it after removing email accounts from a campaign so their leads keep sending from a mailbox that is still attached.

Overview

When an email account is removed from a campaign, leads already assigned to it stay on that account. This endpoint finds those leads (and leads with no mailbox assigned) and assigns each one to a randomly chosen mailbox that is currently attached to the campaign. Behavior:
  • Only moves leads whose mailbox is not attached to the campaign, or is empty
  • Leads with status STARTED are not moved
  • Each moved lead gets a random attached mailbox
  • Runs synchronously: the response is sent after all leads are moved
  • Safe to repeat: a second call returns leads_reallocated: 0 once nothing is left to move

Path Parameters

number
required
The campaign ID

Query Parameters

string
required
Your SmartLead API key

Body Parameters (optional)

number[]
Optional. Only move leads that are on these email accounts. 1 to 100 unique email account IDs. Every ID must be an account that is no longer attached to the campaign, otherwise the request fails with 400.Omit this field (or send an empty body {}) to move leads off all removed mailboxes.Example: [3703387, 3703397]

Response Fields

boolean
true when the request completed
number
Number of leads moved to an attached mailbox. 0 when there was nothing to move.
number[]
All email accounts currently attached to the campaign, i.e. the pool leads were distributed across. A given account may not have received any leads.

Response Codes

Success
Leads reallocated (or nothing to reallocate)
Bad Request
The campaign has no email accounts attached, an ID in from_email_account_ids is still attached to the campaign, or the request failed validation (unknown body field, duplicate or non-integer IDs, more than 100 IDs)
Unauthorized
Invalid or missing API key
Not Found
Campaign not found or does not belong to your account
Internal Server Error
Server error occurred. Please try again or contact support if the issue persists.
Attach at least one replacement mailbox with Add Email Accounts before calling this endpoint. Mailboxes that are disconnected but still attached to the campaign are not affected; remove them from the campaign first.