Bulk create IMAP email accounts
curl --request POST \
--url https://app.gtm-api.com/email/v4/api/email-accounts/bulk-create-imap \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Team-SID: <api-key>' \
--data '
{
"rows": [
{
"address": "jsmith@example.com",
"connection": {
"imap_host": "<string>",
"imap_port": 32768,
"smtp_host": "<string>",
"smtp_port": 32768,
"imap_username": "<string>",
"smtp_username": "<string>"
},
"imap_password": "<string>",
"display_name": "<string>",
"label": "<string>",
"smtp_password": "<string>"
}
],
"backfill_days": 1825
}
'import requests
url = "https://app.gtm-api.com/email/v4/api/email-accounts/bulk-create-imap"
payload = {
"rows": [
{
"address": "jsmith@example.com",
"connection": {
"imap_host": "<string>",
"imap_port": 32768,
"smtp_host": "<string>",
"smtp_port": 32768,
"imap_username": "<string>",
"smtp_username": "<string>"
},
"imap_password": "<string>",
"display_name": "<string>",
"label": "<string>",
"smtp_password": "<string>"
}
],
"backfill_days": 1825
}
headers = {
"Authorization": "Bearer <token>",
"Team-SID": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: 'Bearer <token>',
'Team-SID': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
rows: [
{
address: 'jsmith@example.com',
connection: {
imap_host: '<string>',
imap_port: 32768,
smtp_host: '<string>',
smtp_port: 32768,
imap_username: '<string>',
smtp_username: '<string>'
},
imap_password: '<string>',
display_name: '<string>',
label: '<string>',
smtp_password: '<string>'
}
],
backfill_days: 1825
})
};
fetch('https://app.gtm-api.com/email/v4/api/email-accounts/bulk-create-imap', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.gtm-api.com/email/v4/api/email-accounts/bulk-create-imap",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'rows' => [
[
'address' => 'jsmith@example.com',
'connection' => [
'imap_host' => '<string>',
'imap_port' => 32768,
'smtp_host' => '<string>',
'smtp_port' => 32768,
'imap_username' => '<string>',
'smtp_username' => '<string>'
],
'imap_password' => '<string>',
'display_name' => '<string>',
'label' => '<string>',
'smtp_password' => '<string>'
]
],
'backfill_days' => 1825
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Team-SID: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.gtm-api.com/email/v4/api/email-accounts/bulk-create-imap"
payload := strings.NewReader("{\n \"rows\": [\n {\n \"address\": \"jsmith@example.com\",\n \"connection\": {\n \"imap_host\": \"<string>\",\n \"imap_port\": 32768,\n \"smtp_host\": \"<string>\",\n \"smtp_port\": 32768,\n \"imap_username\": \"<string>\",\n \"smtp_username\": \"<string>\"\n },\n \"imap_password\": \"<string>\",\n \"display_name\": \"<string>\",\n \"label\": \"<string>\",\n \"smtp_password\": \"<string>\"\n }\n ],\n \"backfill_days\": 1825\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Team-SID", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.gtm-api.com/email/v4/api/email-accounts/bulk-create-imap")
.header("Authorization", "Bearer <token>")
.header("Team-SID", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"rows\": [\n {\n \"address\": \"jsmith@example.com\",\n \"connection\": {\n \"imap_host\": \"<string>\",\n \"imap_port\": 32768,\n \"smtp_host\": \"<string>\",\n \"smtp_port\": 32768,\n \"imap_username\": \"<string>\",\n \"smtp_username\": \"<string>\"\n },\n \"imap_password\": \"<string>\",\n \"display_name\": \"<string>\",\n \"label\": \"<string>\",\n \"smtp_password\": \"<string>\"\n }\n ],\n \"backfill_days\": 1825\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.gtm-api.com/email/v4/api/email-accounts/bulk-create-imap")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Team-SID"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"rows\": [\n {\n \"address\": \"jsmith@example.com\",\n \"connection\": {\n \"imap_host\": \"<string>\",\n \"imap_port\": 32768,\n \"smtp_host\": \"<string>\",\n \"smtp_port\": 32768,\n \"imap_username\": \"<string>\",\n \"smtp_username\": \"<string>\"\n },\n \"imap_password\": \"<string>\",\n \"display_name\": \"<string>\",\n \"label\": \"<string>\",\n \"smtp_password\": \"<string>\"\n }\n ],\n \"backfill_days\": 1825\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"operation": "action",
"action": "<string>",
"item": "<unknown>",
"result": {
"applied": 123,
"failed": 123,
"items": [
{
"address": "<string>",
"ok": true,
"already_exists": true,
"item": {
"sid": "<string>",
"team_sid": "<string>",
"email_sending_domain_sid": "<string>",
"provider": "google",
"address": "<string>",
"display_name": "<string>",
"aliases": [
"<string>"
],
"status": "connecting",
"sending_paused_at": "<string>",
"sending_paused_reason": "manual",
"connection": {
"imap_host": "<string>",
"imap_port": 123,
"imap_encryption": "ssl",
"imap_username": "<string>",
"smtp_host": "<string>",
"smtp_port": 123,
"smtp_encryption": "ssl",
"smtp_username": "<string>"
},
"sending_limits": {
"daily_limit": 123,
"min_interval_seconds": 123,
"sending_window": {
"time_zone": "<string>",
"days": [
123
],
"start": "<string>",
"end": "<string>"
}
},
"warmup_config": {
"enabled": true,
"ramp_start_daily": 123,
"ramp_step_per_day": 123,
"target_daily": 123
},
"signature_html": "<string>",
"track_opens": true,
"track_clicks": true,
"email_tracking_domain_sid": "<string>",
"email_oauth_app_sid": "<string>",
"backfill_days": 123,
"last_messages_sync_at": "<string>",
"last_folders_sync_at": "<string>",
"connected_at": "<string>",
"reconnect_required_at": "<string>",
"sync_config": {},
"webhook_config": {},
"created_by": {
"actor_type": "user",
"actor_sid": "<string>",
"team_sid": "<string>",
"permissions": {},
"actor_name": "<string>",
"oauth_client_sid": "<string>",
"reason": "<string>",
"cluster_id": 123,
"trace_id": "<string>"
},
"sending_paused_until": "<string>",
"reconnect_reason": "<string>",
"email_box_sid": "<string>",
"label": "<string>",
"address_domain": "<string>",
"sent_today": 123,
"daily_cap_today": 123,
"warmup_day": 123,
"auth_suspect": {
"since": "<string>",
"failures": 123,
"next_try_at": "<string>",
"source": "<string>"
},
"subscription_hold_reason": "server_full",
"created_at": "<string>",
"updated_at": "<string>",
"deleted_at": "<string>"
},
"error": {
"code": "<string>",
"reason": "<string>",
"message": "<string>"
}
}
]
},
"meta": {
"trace_id": "<string>",
"span_id": "<string>",
"timestamp": "<string>",
"duration_ms": 1,
"team_sid": "<string>",
"actor_type": "<string>"
}
}
email_accounts
Bulk create IMAP email accounts
Connect up to 100 IMAP and SMTP mailboxes in one call, each row with its own servers and password. Every row is probed (a real sign-in to its IMAP and SMTP servers) and answered on its own in result.items: a refused password costs that row only. A username left out is the address; an SMTP password left out is the IMAP one. With no free seat on the server a row lands held (subscription_required), it is not refused. The same rows again answer already_exists true. Rows are probed one after another inside the request, so keep a call to about 10 rows. Requires can_manage_email_accounts.
Contract:
- REST only: no MCP tool serves this route (registry package
mcp.email/email_accounts, surface api). - Operation
action, response envelopeaction. - Flags: none.
POST
/
api
/
email-accounts
/
bulk-create-imap
Bulk create IMAP email accounts
curl --request POST \
--url https://app.gtm-api.com/email/v4/api/email-accounts/bulk-create-imap \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Team-SID: <api-key>' \
--data '
{
"rows": [
{
"address": "jsmith@example.com",
"connection": {
"imap_host": "<string>",
"imap_port": 32768,
"smtp_host": "<string>",
"smtp_port": 32768,
"imap_username": "<string>",
"smtp_username": "<string>"
},
"imap_password": "<string>",
"display_name": "<string>",
"label": "<string>",
"smtp_password": "<string>"
}
],
"backfill_days": 1825
}
'import requests
url = "https://app.gtm-api.com/email/v4/api/email-accounts/bulk-create-imap"
payload = {
"rows": [
{
"address": "jsmith@example.com",
"connection": {
"imap_host": "<string>",
"imap_port": 32768,
"smtp_host": "<string>",
"smtp_port": 32768,
"imap_username": "<string>",
"smtp_username": "<string>"
},
"imap_password": "<string>",
"display_name": "<string>",
"label": "<string>",
"smtp_password": "<string>"
}
],
"backfill_days": 1825
}
headers = {
"Authorization": "Bearer <token>",
"Team-SID": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: 'Bearer <token>',
'Team-SID': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
rows: [
{
address: 'jsmith@example.com',
connection: {
imap_host: '<string>',
imap_port: 32768,
smtp_host: '<string>',
smtp_port: 32768,
imap_username: '<string>',
smtp_username: '<string>'
},
imap_password: '<string>',
display_name: '<string>',
label: '<string>',
smtp_password: '<string>'
}
],
backfill_days: 1825
})
};
fetch('https://app.gtm-api.com/email/v4/api/email-accounts/bulk-create-imap', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.gtm-api.com/email/v4/api/email-accounts/bulk-create-imap",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'rows' => [
[
'address' => 'jsmith@example.com',
'connection' => [
'imap_host' => '<string>',
'imap_port' => 32768,
'smtp_host' => '<string>',
'smtp_port' => 32768,
'imap_username' => '<string>',
'smtp_username' => '<string>'
],
'imap_password' => '<string>',
'display_name' => '<string>',
'label' => '<string>',
'smtp_password' => '<string>'
]
],
'backfill_days' => 1825
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Team-SID: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.gtm-api.com/email/v4/api/email-accounts/bulk-create-imap"
payload := strings.NewReader("{\n \"rows\": [\n {\n \"address\": \"jsmith@example.com\",\n \"connection\": {\n \"imap_host\": \"<string>\",\n \"imap_port\": 32768,\n \"smtp_host\": \"<string>\",\n \"smtp_port\": 32768,\n \"imap_username\": \"<string>\",\n \"smtp_username\": \"<string>\"\n },\n \"imap_password\": \"<string>\",\n \"display_name\": \"<string>\",\n \"label\": \"<string>\",\n \"smtp_password\": \"<string>\"\n }\n ],\n \"backfill_days\": 1825\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Team-SID", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.gtm-api.com/email/v4/api/email-accounts/bulk-create-imap")
.header("Authorization", "Bearer <token>")
.header("Team-SID", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"rows\": [\n {\n \"address\": \"jsmith@example.com\",\n \"connection\": {\n \"imap_host\": \"<string>\",\n \"imap_port\": 32768,\n \"smtp_host\": \"<string>\",\n \"smtp_port\": 32768,\n \"imap_username\": \"<string>\",\n \"smtp_username\": \"<string>\"\n },\n \"imap_password\": \"<string>\",\n \"display_name\": \"<string>\",\n \"label\": \"<string>\",\n \"smtp_password\": \"<string>\"\n }\n ],\n \"backfill_days\": 1825\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.gtm-api.com/email/v4/api/email-accounts/bulk-create-imap")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Team-SID"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"rows\": [\n {\n \"address\": \"jsmith@example.com\",\n \"connection\": {\n \"imap_host\": \"<string>\",\n \"imap_port\": 32768,\n \"smtp_host\": \"<string>\",\n \"smtp_port\": 32768,\n \"imap_username\": \"<string>\",\n \"smtp_username\": \"<string>\"\n },\n \"imap_password\": \"<string>\",\n \"display_name\": \"<string>\",\n \"label\": \"<string>\",\n \"smtp_password\": \"<string>\"\n }\n ],\n \"backfill_days\": 1825\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"operation": "action",
"action": "<string>",
"item": "<unknown>",
"result": {
"applied": 123,
"failed": 123,
"items": [
{
"address": "<string>",
"ok": true,
"already_exists": true,
"item": {
"sid": "<string>",
"team_sid": "<string>",
"email_sending_domain_sid": "<string>",
"provider": "google",
"address": "<string>",
"display_name": "<string>",
"aliases": [
"<string>"
],
"status": "connecting",
"sending_paused_at": "<string>",
"sending_paused_reason": "manual",
"connection": {
"imap_host": "<string>",
"imap_port": 123,
"imap_encryption": "ssl",
"imap_username": "<string>",
"smtp_host": "<string>",
"smtp_port": 123,
"smtp_encryption": "ssl",
"smtp_username": "<string>"
},
"sending_limits": {
"daily_limit": 123,
"min_interval_seconds": 123,
"sending_window": {
"time_zone": "<string>",
"days": [
123
],
"start": "<string>",
"end": "<string>"
}
},
"warmup_config": {
"enabled": true,
"ramp_start_daily": 123,
"ramp_step_per_day": 123,
"target_daily": 123
},
"signature_html": "<string>",
"track_opens": true,
"track_clicks": true,
"email_tracking_domain_sid": "<string>",
"email_oauth_app_sid": "<string>",
"backfill_days": 123,
"last_messages_sync_at": "<string>",
"last_folders_sync_at": "<string>",
"connected_at": "<string>",
"reconnect_required_at": "<string>",
"sync_config": {},
"webhook_config": {},
"created_by": {
"actor_type": "user",
"actor_sid": "<string>",
"team_sid": "<string>",
"permissions": {},
"actor_name": "<string>",
"oauth_client_sid": "<string>",
"reason": "<string>",
"cluster_id": 123,
"trace_id": "<string>"
},
"sending_paused_until": "<string>",
"reconnect_reason": "<string>",
"email_box_sid": "<string>",
"label": "<string>",
"address_domain": "<string>",
"sent_today": 123,
"daily_cap_today": 123,
"warmup_day": 123,
"auth_suspect": {
"since": "<string>",
"failures": 123,
"next_try_at": "<string>",
"source": "<string>"
},
"subscription_hold_reason": "server_full",
"created_at": "<string>",
"updated_at": "<string>",
"deleted_at": "<string>"
},
"error": {
"code": "<string>",
"reason": "<string>",
"message": "<string>"
}
}
]
},
"meta": {
"trace_id": "<string>",
"span_id": "<string>",
"timestamp": "<string>",
"duration_ms": 1,
"team_sid": "<string>",
"actor_type": "<string>"
}
}
Authorizations
Headers
Body
application/json