curl --request POST \
--url https://app.gtm-api.com/linkedin/v4/api/linkedin-messages/send-inmail \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Team-SID: <api-key>' \
--data '
{
"linkedin_account_sid": "<string>",
"subject": "<string>",
"text": "<string>",
"ln_id": "<string>",
"sn_id": "<string>",
"recruiter_id": "<string>",
"ln_member_id": "<string>",
"public_identifier": "<string>",
"attachments": [
{
"file_base64": "<string>",
"file_url": "<string>",
"file_name": "<string>",
"file_type": "<string>",
"file_byte_size": 2
}
],
"stop_if_replied_after": "2023-11-07T05:31:56Z",
"client_reference": "<string>",
"confirmed_not_sent": "<string>",
"confirmed_sent": "<string>"
}
'import requests
url = "https://app.gtm-api.com/linkedin/v4/api/linkedin-messages/send-inmail"
payload = {
"linkedin_account_sid": "<string>",
"subject": "<string>",
"text": "<string>",
"ln_id": "<string>",
"sn_id": "<string>",
"recruiter_id": "<string>",
"ln_member_id": "<string>",
"public_identifier": "<string>",
"attachments": [
{
"file_base64": "<string>",
"file_url": "<string>",
"file_name": "<string>",
"file_type": "<string>",
"file_byte_size": 2
}
],
"stop_if_replied_after": "2023-11-07T05:31:56Z",
"client_reference": "<string>",
"confirmed_not_sent": "<string>",
"confirmed_sent": "<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({
linkedin_account_sid: '<string>',
subject: '<string>',
text: '<string>',
ln_id: '<string>',
sn_id: '<string>',
recruiter_id: '<string>',
ln_member_id: '<string>',
public_identifier: '<string>',
attachments: [
{
file_base64: '<string>',
file_url: '<string>',
file_name: '<string>',
file_type: '<string>',
file_byte_size: 2
}
],
stop_if_replied_after: '2023-11-07T05:31:56Z',
client_reference: '<string>',
confirmed_not_sent: '<string>',
confirmed_sent: '<string>'
})
};
fetch('https://app.gtm-api.com/linkedin/v4/api/linkedin-messages/send-inmail', 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/linkedin/v4/api/linkedin-messages/send-inmail",
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([
'linkedin_account_sid' => '<string>',
'subject' => '<string>',
'text' => '<string>',
'ln_id' => '<string>',
'sn_id' => '<string>',
'recruiter_id' => '<string>',
'ln_member_id' => '<string>',
'public_identifier' => '<string>',
'attachments' => [
[
'file_base64' => '<string>',
'file_url' => '<string>',
'file_name' => '<string>',
'file_type' => '<string>',
'file_byte_size' => 2
]
],
'stop_if_replied_after' => '2023-11-07T05:31:56Z',
'client_reference' => '<string>',
'confirmed_not_sent' => '<string>',
'confirmed_sent' => '<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/linkedin/v4/api/linkedin-messages/send-inmail"
payload := strings.NewReader("{\n \"linkedin_account_sid\": \"<string>\",\n \"subject\": \"<string>\",\n \"text\": \"<string>\",\n \"ln_id\": \"<string>\",\n \"sn_id\": \"<string>\",\n \"recruiter_id\": \"<string>\",\n \"ln_member_id\": \"<string>\",\n \"public_identifier\": \"<string>\",\n \"attachments\": [\n {\n \"file_base64\": \"<string>\",\n \"file_url\": \"<string>\",\n \"file_name\": \"<string>\",\n \"file_type\": \"<string>\",\n \"file_byte_size\": 2\n }\n ],\n \"stop_if_replied_after\": \"2023-11-07T05:31:56Z\",\n \"client_reference\": \"<string>\",\n \"confirmed_not_sent\": \"<string>\",\n \"confirmed_sent\": \"<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/linkedin/v4/api/linkedin-messages/send-inmail")
.header("Authorization", "Bearer <token>")
.header("Team-SID", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"linkedin_account_sid\": \"<string>\",\n \"subject\": \"<string>\",\n \"text\": \"<string>\",\n \"ln_id\": \"<string>\",\n \"sn_id\": \"<string>\",\n \"recruiter_id\": \"<string>\",\n \"ln_member_id\": \"<string>\",\n \"public_identifier\": \"<string>\",\n \"attachments\": [\n {\n \"file_base64\": \"<string>\",\n \"file_url\": \"<string>\",\n \"file_name\": \"<string>\",\n \"file_type\": \"<string>\",\n \"file_byte_size\": 2\n }\n ],\n \"stop_if_replied_after\": \"2023-11-07T05:31:56Z\",\n \"client_reference\": \"<string>\",\n \"confirmed_not_sent\": \"<string>\",\n \"confirmed_sent\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.gtm-api.com/linkedin/v4/api/linkedin-messages/send-inmail")
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 \"linkedin_account_sid\": \"<string>\",\n \"subject\": \"<string>\",\n \"text\": \"<string>\",\n \"ln_id\": \"<string>\",\n \"sn_id\": \"<string>\",\n \"recruiter_id\": \"<string>\",\n \"ln_member_id\": \"<string>\",\n \"public_identifier\": \"<string>\",\n \"attachments\": [\n {\n \"file_base64\": \"<string>\",\n \"file_url\": \"<string>\",\n \"file_name\": \"<string>\",\n \"file_type\": \"<string>\",\n \"file_byte_size\": 2\n }\n ],\n \"stop_if_replied_after\": \"2023-11-07T05:31:56Z\",\n \"client_reference\": \"<string>\",\n \"confirmed_not_sent\": \"<string>\",\n \"confirmed_sent\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"operation": "action",
"action": "<string>",
"item": {
"sid": "<string>",
"team_sid": "<string>",
"linkedin_account_sid": "<string>",
"linkedin_conversation_sid": "<string>",
"messenger_type": "linkedin",
"linkedin_type": "message",
"type": "inbox",
"automation": "auto",
"ln_member_id": "<string>",
"ln_id": "<string>",
"sn_id": "<string>",
"recruiter_id": "<string>",
"nickname": "<string>",
"sender_ln_id": "<string>",
"sender_ln_member_id": "<string>",
"subject": "<string>",
"text": "<string>",
"client_reference": "<string>",
"attachments": [
{
"id": "<string>",
"urn": "<string>",
"name": "<string>",
"content_type": "<string>",
"content_url": "<string>",
"file_byte_size": 123,
"file_name": "<string>",
"file_type": "<string>"
}
],
"reactions": [
{
"emoji": "<string>",
"count": 123,
"is_viewer_reacted": true,
"first_reacted_at": "<string>"
}
],
"is_deleted": true,
"reply_to": {
"linkedin_message_sid": "<string>",
"message_hash": "<string>",
"sender_ln_id": "<string>",
"sender_ln_member_id": "<string>",
"text": "<string>",
"sent_at": "<string>"
},
"message_hash": "<string>",
"sent_at": "<string>",
"custom_content": {},
"created_at": "<string>",
"updated_at": "<string>",
"deleted_at": "<string>"
},
"result": {},
"meta": {
"trace_id": "<string>",
"span_id": "<string>",
"timestamp": "<string>",
"duration_ms": 1,
"team_sid": "<string>",
"actor_type": "<string>"
},
"pacing": {
"linkedin_account_sid": "<string>",
"limit_type": "<string>",
"next_call_after": "<string>",
"remaining_today": 1
}
}Send LinkedIn InMail
Send one premium InMail to a person. Person-addressed only via ln_id / sn_id, subject required (≤ 200), body ≤ 1900. Sends once per client_reference and person: a repeat is answered, never sent twice; on a 409 read error.context.send_outcome, never resend under a new key. Routed by has_sn: with a Sales Navigator seat it goes out through SN (SN thread, reply in the SN inbox) and spends inmail_credits; without one through linkedin.com, spending premium_inmail_credits. No fallback. Guards: send_inmails daily cap, Premium guard, InMail-credits guard (422 no_inmail_credits when that pool is known empty; a balance never read does not block). Fire-on-success; inmail_credits_remaining is written back to that pool, and LinkedIn’s NOT_ENOUGH_INMAIL_CREDIT answers 422 no_inmail_credits and zeroes it (not a block of the target). When NOT: 1st-degree connection → send_linkedin_message (free); no Premium / zero credits → the guards 422; SN thread continuation → send_linkedin_sales_nav_message.
Contract:
- MCP tool
send_linkedin_inmail, registry packagemcp.linkedin/linkedin_messages, mountlinkedin.messaging. - Operation
action, response envelopeaction. - Flags: dangerous: the MCP layer gates it behind a preview/commit token, and the effect cannot be undone through this API; paced: a call spends the
send_inmailssmart-limit bucket of the account it runs on, and calls of one bucket are spaced per account. A short wait is slept by the server; a longer one answers 429rate_limitedwithcontext.retry_after, and the same call succeeds from that moment. Parallel calls on one account queue behind each other.
curl --request POST \
--url https://app.gtm-api.com/linkedin/v4/api/linkedin-messages/send-inmail \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Team-SID: <api-key>' \
--data '
{
"linkedin_account_sid": "<string>",
"subject": "<string>",
"text": "<string>",
"ln_id": "<string>",
"sn_id": "<string>",
"recruiter_id": "<string>",
"ln_member_id": "<string>",
"public_identifier": "<string>",
"attachments": [
{
"file_base64": "<string>",
"file_url": "<string>",
"file_name": "<string>",
"file_type": "<string>",
"file_byte_size": 2
}
],
"stop_if_replied_after": "2023-11-07T05:31:56Z",
"client_reference": "<string>",
"confirmed_not_sent": "<string>",
"confirmed_sent": "<string>"
}
'import requests
url = "https://app.gtm-api.com/linkedin/v4/api/linkedin-messages/send-inmail"
payload = {
"linkedin_account_sid": "<string>",
"subject": "<string>",
"text": "<string>",
"ln_id": "<string>",
"sn_id": "<string>",
"recruiter_id": "<string>",
"ln_member_id": "<string>",
"public_identifier": "<string>",
"attachments": [
{
"file_base64": "<string>",
"file_url": "<string>",
"file_name": "<string>",
"file_type": "<string>",
"file_byte_size": 2
}
],
"stop_if_replied_after": "2023-11-07T05:31:56Z",
"client_reference": "<string>",
"confirmed_not_sent": "<string>",
"confirmed_sent": "<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({
linkedin_account_sid: '<string>',
subject: '<string>',
text: '<string>',
ln_id: '<string>',
sn_id: '<string>',
recruiter_id: '<string>',
ln_member_id: '<string>',
public_identifier: '<string>',
attachments: [
{
file_base64: '<string>',
file_url: '<string>',
file_name: '<string>',
file_type: '<string>',
file_byte_size: 2
}
],
stop_if_replied_after: '2023-11-07T05:31:56Z',
client_reference: '<string>',
confirmed_not_sent: '<string>',
confirmed_sent: '<string>'
})
};
fetch('https://app.gtm-api.com/linkedin/v4/api/linkedin-messages/send-inmail', 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/linkedin/v4/api/linkedin-messages/send-inmail",
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([
'linkedin_account_sid' => '<string>',
'subject' => '<string>',
'text' => '<string>',
'ln_id' => '<string>',
'sn_id' => '<string>',
'recruiter_id' => '<string>',
'ln_member_id' => '<string>',
'public_identifier' => '<string>',
'attachments' => [
[
'file_base64' => '<string>',
'file_url' => '<string>',
'file_name' => '<string>',
'file_type' => '<string>',
'file_byte_size' => 2
]
],
'stop_if_replied_after' => '2023-11-07T05:31:56Z',
'client_reference' => '<string>',
'confirmed_not_sent' => '<string>',
'confirmed_sent' => '<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/linkedin/v4/api/linkedin-messages/send-inmail"
payload := strings.NewReader("{\n \"linkedin_account_sid\": \"<string>\",\n \"subject\": \"<string>\",\n \"text\": \"<string>\",\n \"ln_id\": \"<string>\",\n \"sn_id\": \"<string>\",\n \"recruiter_id\": \"<string>\",\n \"ln_member_id\": \"<string>\",\n \"public_identifier\": \"<string>\",\n \"attachments\": [\n {\n \"file_base64\": \"<string>\",\n \"file_url\": \"<string>\",\n \"file_name\": \"<string>\",\n \"file_type\": \"<string>\",\n \"file_byte_size\": 2\n }\n ],\n \"stop_if_replied_after\": \"2023-11-07T05:31:56Z\",\n \"client_reference\": \"<string>\",\n \"confirmed_not_sent\": \"<string>\",\n \"confirmed_sent\": \"<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/linkedin/v4/api/linkedin-messages/send-inmail")
.header("Authorization", "Bearer <token>")
.header("Team-SID", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"linkedin_account_sid\": \"<string>\",\n \"subject\": \"<string>\",\n \"text\": \"<string>\",\n \"ln_id\": \"<string>\",\n \"sn_id\": \"<string>\",\n \"recruiter_id\": \"<string>\",\n \"ln_member_id\": \"<string>\",\n \"public_identifier\": \"<string>\",\n \"attachments\": [\n {\n \"file_base64\": \"<string>\",\n \"file_url\": \"<string>\",\n \"file_name\": \"<string>\",\n \"file_type\": \"<string>\",\n \"file_byte_size\": 2\n }\n ],\n \"stop_if_replied_after\": \"2023-11-07T05:31:56Z\",\n \"client_reference\": \"<string>\",\n \"confirmed_not_sent\": \"<string>\",\n \"confirmed_sent\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.gtm-api.com/linkedin/v4/api/linkedin-messages/send-inmail")
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 \"linkedin_account_sid\": \"<string>\",\n \"subject\": \"<string>\",\n \"text\": \"<string>\",\n \"ln_id\": \"<string>\",\n \"sn_id\": \"<string>\",\n \"recruiter_id\": \"<string>\",\n \"ln_member_id\": \"<string>\",\n \"public_identifier\": \"<string>\",\n \"attachments\": [\n {\n \"file_base64\": \"<string>\",\n \"file_url\": \"<string>\",\n \"file_name\": \"<string>\",\n \"file_type\": \"<string>\",\n \"file_byte_size\": 2\n }\n ],\n \"stop_if_replied_after\": \"2023-11-07T05:31:56Z\",\n \"client_reference\": \"<string>\",\n \"confirmed_not_sent\": \"<string>\",\n \"confirmed_sent\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"operation": "action",
"action": "<string>",
"item": {
"sid": "<string>",
"team_sid": "<string>",
"linkedin_account_sid": "<string>",
"linkedin_conversation_sid": "<string>",
"messenger_type": "linkedin",
"linkedin_type": "message",
"type": "inbox",
"automation": "auto",
"ln_member_id": "<string>",
"ln_id": "<string>",
"sn_id": "<string>",
"recruiter_id": "<string>",
"nickname": "<string>",
"sender_ln_id": "<string>",
"sender_ln_member_id": "<string>",
"subject": "<string>",
"text": "<string>",
"client_reference": "<string>",
"attachments": [
{
"id": "<string>",
"urn": "<string>",
"name": "<string>",
"content_type": "<string>",
"content_url": "<string>",
"file_byte_size": 123,
"file_name": "<string>",
"file_type": "<string>"
}
],
"reactions": [
{
"emoji": "<string>",
"count": 123,
"is_viewer_reacted": true,
"first_reacted_at": "<string>"
}
],
"is_deleted": true,
"reply_to": {
"linkedin_message_sid": "<string>",
"message_hash": "<string>",
"sender_ln_id": "<string>",
"sender_ln_member_id": "<string>",
"text": "<string>",
"sent_at": "<string>"
},
"message_hash": "<string>",
"sent_at": "<string>",
"custom_content": {},
"created_at": "<string>",
"updated_at": "<string>",
"deleted_at": "<string>"
},
"result": {},
"meta": {
"trace_id": "<string>",
"span_id": "<string>",
"timestamp": "<string>",
"duration_ms": 1,
"team_sid": "<string>",
"actor_type": "<string>"
},
"pacing": {
"linkedin_account_sid": "<string>",
"limit_type": "<string>",
"next_call_after": "<string>",
"remaining_today": 1
}
}Authorizations
Body
Request body of send_linkedin_inmail.
InMail body; 1..1900 chars. Sent verbatim: the platform renders no merge fields, a {{first_name}} goes out as those braces.
1 - 1900A vanity slug, any profile link or any id, read by its shape. Whatever names the person resolves server-side to the URN the send dispatches on: your team's own rows, then the stored corpus, then ONE lite profile read on the sender (it spends self_account_sync, never the send's bucket; keyed by your client_reference and the person, so one reference serves many people). result.target_resolved_via says which: "ledger", "corpus", "browser", or null when a URN was given. A slug LinkedIn does not know is 422 public_identifier_unresolved.
2048ISO 8601 UTC moment. When given, the thread is read from LinkedIn before the send and the send is refused with 409 replied if the person wrote after this moment (context.linkedin_message_sid names their message: read it before you send again); 409 reply_check_unavailable when that read fails, nothing sent, retry after retry_after. Omit or null to send regardless.
Your key for this ONE message (max 255, byte for byte): one key per message, the same key on every repeat of it. The key and its place (the thread, else the person) are one message whatever it says, and a repeat never goes out twice: it answers 200 with the row the first send stored (result.idempotent_replay, result.content_differs when this request says something else) or 409 naming error.context.send_outcome (in_flight, unknown with retry_after and send_decisive_at, or sent; not_sent with blocking_activity_log_sid when another message holds the place). The same key at another place is another message. Without a key the same words to the same place count as a repeat for an hour after they went out. Stored on the row and searchable; check_linkedin_message_sent asks by it.
255A person's word that an earlier attempt of THIS message is not on LinkedIn: its activity_log_sid (ln_al_...), from the 409 or check_linkedin_message_sent, given only after someone looked at the conversation. Taken once the attempt can no longer land (before that: 409 send_outcome_unknown, waiting_for may_still_land, retry_after and send_decisive_at that moment): it settles that attempt not_sent and this request goes out. Moot when the attempt is no longer in doubt; another message's sid is 422 not_this_message.
18^ln_al_A person's word that an earlier attempt of THIS message IS on LinkedIn: its activity_log_sid, as for confirmed_not_sent (never both). Taken at once; it settles the attempt sent and sends nothing: the answer is 409 concurrent_send_in_flight with send_outcome sent, or 200 with the row once it is stored. Another message's sid is 422 not_this_message; an attempt already proved not sent is 409 confirmed_sent_contradicts.
18^ln_al_Response
action success envelope.