Reconnect mailboxes in a batch
Queues one reconnect batch for mailboxes whose status is suspended,
failed or error — the same check as the dashboard's Reconnect.
The sending-worker re-verifies each mailbox from its sending IP
(SMTP login, or OAuth token refresh + SMTP for Gmail/Outlook):
- passed → status
active, sending re-enabled, error fields cleared. - failed → status
errorwithlastErrorset. Mailboxes are never deleted.
Select with mailboxIds, or omit it to take every mailbox in the
workspace matching status (default: all three). status also
narrows mailboxIds; listed mailboxes in other statuses come back in
skipped. At most 500 mailboxes per batch — larger selections are
rejected with BATCH_TOO_LARGE, not split.
Not reconnected:
- Mailboxes suspended because the workspace owner's subscription
lapsed. They're restored automatically once the subscription is
renewed. Listed in
skippedwhen selected by ID, and counted inbillingSuspendedSkipped. - Mailboxes already in a reconnect batch that is still pending or
processing. They come back in
skippedwith thatbatchId. If nothing else is left to queue, the request fails with409 ALREADY_IN_PROGRESSand the running batch IDs, so retrying can't pile up logins against the mail provider.
Poll GET /v1/mailboxes/reconnect/{batchId} for progress.
curl -X POST "https://api.sendkit.ai/v1/mailboxes/reconnect" \
-H "Content-Type: application/json" \
-H "X-Api-Key: YOUR_API_KEY" \
-d '{
"status": [
"suspended",
"failed"
]
}'
import requests
import json
url = "https://api.sendkit.ai/v1/mailboxes/reconnect"
headers = {
"Content-Type": "application/json",
"X-Api-Key": "YOUR_API_KEY"
}
data = {
"status": [
"suspended",
"failed"
]
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
const response = await fetch("https://api.sendkit.ai/v1/mailboxes/reconnect", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-Api-Key": "YOUR_API_KEY"
},
body: JSON.stringify({
"status": [
"suspended",
"failed"
]
})
});
const data = await response.json();
console.log(data);
package main
import (
"fmt"
"net/http"
"bytes"
"encoding/json"
)
func main() {
data := []byte(`{
"status": [
"suspended",
"failed"
]
}`)
req, err := http.NewRequest("POST", "https://api.sendkit.ai/v1/mailboxes/reconnect", bytes.NewBuffer(data))
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("X-Api-Key", "YOUR_API_KEY")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println("Response Status:", resp.Status)
}
require 'net/http'
require 'json'
uri = URI('https://api.sendkit.ai/v1/mailboxes/reconnect')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request['Content-Type'] = 'application/json'
request['X-Api-Key'] = 'YOUR_API_KEY'
request.body = '{
"status": [
"suspended",
"failed"
]
}'
response = http.request(request)
puts response.body
{
"success": true,
"data": {
"batchId": "smtp_reconnect_test_1761200000000_k3j9x2a",
"status": "pending",
"queuedCount": 1,
"skippedCount": 1,
"notFoundCount": 0,
"billingSuspendedSkipped": 0,
"queued": [
{
"id": "665f1c2e9b1e8a0012345678",
"email": "sam@acme.com",
"status": "suspended"
}
],
"skipped": [
{
"id": "665f1c2e9b1e8a0012345679",
"email": "alex@acme.com",
"reason": "Skipped — status is active"
}
],
"notFound": []
}
}
{
"error": "Bad Request",
"message": "The request contains invalid parameters or malformed data",
"code": 400,
"details": [
{
"field": "email",
"message": "Invalid email format"
}
]
}
{
"success": false,
"error": {
"code": "ALREADY_IN_PROGRESS",
"message": "These mailboxes are already being reconnected. Poll batch smtp_reconnect_test_1761200000000_k3j9x2a for progress.",
"batchIds": [
"smtp_reconnect_test_1761200000000_k3j9x2a"
]
}
}
{
"error": "Service Unavailable",
"message": "The service is temporarily unavailable. Please try again later",
"code": 503
}
/v1/mailboxes/reconnect
Target server for requests. Edit to use your own host.
Platform API key (sk_user_...) or Workspace API key (sk_...)
The media type of the request body
Statuses to reconnect. Defaults to all three.
Request Preview
Response
Response will appear here after sending the request
Authentication
API Key for authentication. Platform API key (sk_user_...) or Workspace API key (sk_...)