Request email account connect link
curl --request POST \
--url https://app.gtm-api.com/email/v4/api/email-accounts/request-connect-link \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Team-SID: <api-key>' \
--data '
{
"email_oauth_app_sid": "<string>",
"success_redirect_url": "<string>",
"backfill_days": 1825,
"display_name": "<string>",
"label": "<string>"
}
'import requests
url = "https://app.gtm-api.com/email/v4/api/email-accounts/request-connect-link"
payload = {
"email_oauth_app_sid": "<string>",
"success_redirect_url": "<string>",
"backfill_days": 1825,
"display_name": "<string>",
"label": "<string>"
}
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({
email_oauth_app_sid: '<string>',
success_redirect_url: '<string>',
backfill_days: 1825,
display_name: '<string>',
label: '<string>'
})
};
fetch('https://app.gtm-api.com/email/v4/api/email-accounts/request-connect-link', 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/request-connect-link",
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([
'email_oauth_app_sid' => '<string>',
'success_redirect_url' => '<string>',
'backfill_days' => 1825,
'display_name' => '<string>',
'label' => '<string>'
]),
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/request-connect-link"
payload := strings.NewReader("{\n \"email_oauth_app_sid\": \"<string>\",\n \"success_redirect_url\": \"<string>\",\n \"backfill_days\": 1825,\n \"display_name\": \"<string>\",\n \"label\": \"<string>\"\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/request-connect-link")
.header("Authorization", "Bearer <token>")
.header("Team-SID", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"email_oauth_app_sid\": \"<string>\",\n \"success_redirect_url\": \"<string>\",\n \"backfill_days\": 1825,\n \"display_name\": \"<string>\",\n \"label\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.gtm-api.com/email/v4/api/email-accounts/request-connect-link")
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 \"email_oauth_app_sid\": \"<string>\",\n \"success_redirect_url\": \"<string>\",\n \"backfill_days\": 1825,\n \"display_name\": \"<string>\",\n \"label\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"operation": "action",
"action": "<string>",
"item": "<unknown>",
"result": {
"connect_url": "<string>",
"expires_at": "<string>",
"email_oauth_app_sid": "<string>"
},
"meta": {
"trace_id": "<string>",
"span_id": "<string>",
"timestamp": "<string>",
"duration_ms": 1,
"team_sid": "<string>",
"actor_type": "<string>"
}
}email_accounts
Request email account connect link
Get a link the owner of a mailbox opens to connect it: they sign in with Google or Microsoft, or type their IMAP and SMTP details, on a hosted page, so no password ever passes through you. result.connect_url lives 24 hours; hand it to the person. The mailbox appears (search_email_accounts) once they finish, on the server this call named. Without provider the page lets them choose. With no free seat on the server the mailbox lands held (subscription_required). A mailbox that needs new credentials takes reconnect_email_account instead. Requires can_manage_email_accounts.
Contract:
- MCP tool
request_email_account_connect_link, registry packagemcp.email/email_accounts, mountemail.accounts. - Operation
action, response envelopeaction. - Flags: none.
POST
/
api
/
email-accounts
/
request-connect-link
Request email account connect link
curl --request POST \
--url https://app.gtm-api.com/email/v4/api/email-accounts/request-connect-link \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Team-SID: <api-key>' \
--data '
{
"email_oauth_app_sid": "<string>",
"success_redirect_url": "<string>",
"backfill_days": 1825,
"display_name": "<string>",
"label": "<string>"
}
'import requests
url = "https://app.gtm-api.com/email/v4/api/email-accounts/request-connect-link"
payload = {
"email_oauth_app_sid": "<string>",
"success_redirect_url": "<string>",
"backfill_days": 1825,
"display_name": "<string>",
"label": "<string>"
}
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({
email_oauth_app_sid: '<string>',
success_redirect_url: '<string>',
backfill_days: 1825,
display_name: '<string>',
label: '<string>'
})
};
fetch('https://app.gtm-api.com/email/v4/api/email-accounts/request-connect-link', 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/request-connect-link",
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([
'email_oauth_app_sid' => '<string>',
'success_redirect_url' => '<string>',
'backfill_days' => 1825,
'display_name' => '<string>',
'label' => '<string>'
]),
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/request-connect-link"
payload := strings.NewReader("{\n \"email_oauth_app_sid\": \"<string>\",\n \"success_redirect_url\": \"<string>\",\n \"backfill_days\": 1825,\n \"display_name\": \"<string>\",\n \"label\": \"<string>\"\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/request-connect-link")
.header("Authorization", "Bearer <token>")
.header("Team-SID", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"email_oauth_app_sid\": \"<string>\",\n \"success_redirect_url\": \"<string>\",\n \"backfill_days\": 1825,\n \"display_name\": \"<string>\",\n \"label\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.gtm-api.com/email/v4/api/email-accounts/request-connect-link")
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 \"email_oauth_app_sid\": \"<string>\",\n \"success_redirect_url\": \"<string>\",\n \"backfill_days\": 1825,\n \"display_name\": \"<string>\",\n \"label\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"operation": "action",
"action": "<string>",
"item": "<unknown>",
"result": {
"connect_url": "<string>",
"expires_at": "<string>",
"email_oauth_app_sid": "<string>"
},
"meta": {
"trace_id": "<string>",
"span_id": "<string>",
"timestamp": "<string>",
"duration_ms": 1,
"team_sid": "<string>",
"actor_type": "<string>"
}
}Authorizations
Headers
Body
application/json
Request body of request_email_account_connect_link.