Inbound Emails
Reply to Message
Sends a reply to an inbound email message. The reply is threaded into the original conversation via In-Reply-To and References headers, and queued through the standard sending pipeline. The from domain must be a verified sending domain on the project.
POST
/
inbound
/
messages
/
{id}
/
reply
curl --request POST \
--url https://api.autosend.com/v1/inbound/messages/60d5ec49f1b2c72d9c8b1234/reply \
--header 'Authorization: Bearer as_your-api-key' \
--header 'Content-Type: application/json' \
--data '{
"from": { "email": "[email protected]", "name": "Support Team" },
"subject": "Re: Question about my order",
"html": "<p>Hi Jane, your order #4821 shipped today.</p>",
"text": "Hi Jane, your order #4821 shipped today."
}'
import requests
url = "https://api.autosend.com/v1/inbound/messages/60d5ec49f1b2c72d9c8b1234/reply"
headers = {
"Authorization": "Bearer as_your-api-key",
"Content-Type": "application/json"
}
payload = {
"from": {"email": "[email protected]", "name": "Support Team"},
"subject": "Re: Question about my order",
"html": "<p>Hi Jane, your order #4821 shipped today.</p>",
"text": "Hi Jane, your order #4821 shipped today."
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
fetch('https://api.autosend.com/v1/inbound/messages/60d5ec49f1b2c72d9c8b1234/reply', {
method: 'POST',
headers: {
'Authorization': 'Bearer as_your-api-key',
'Content-Type': 'application/json'
},
body: JSON.stringify({
from: { email: '[email protected]', name: 'Support Team' },
subject: 'Re: Question about my order',
html: '<p>Hi Jane, your order #4821 shipped today.</p>',
text: 'Hi Jane, your order #4821 shipped today.'
})
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
<?php
$messageId = '60d5ec49f1b2c72d9c8b1234';
$url = "https://api.autosend.com/v1/inbound/messages/{$messageId}/reply";
$data = [
'from' => ['email' => '[email protected]', 'name' => 'Support Team'],
'subject' => 'Re: Question about my order',
'html' => '<p>Hi Jane, your order #4821 shipped today.</p>',
'text' => 'Hi Jane, your order #4821 shipped today.'
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer as_your-api-key',
'Content-Type: application/json'
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
url := "https://api.autosend.com/v1/inbound/messages/60d5ec49f1b2c72d9c8b1234/reply"
payload := map[string]interface{}{
"from": map[string]string{"email": "[email protected]", "name": "Support Team"},
"subject": "Re: Question about my order",
"html": "<p>Hi Jane, your order #4821 shipped today.</p>",
"text": "Hi Jane, your order #4821 shipped today.",
}
jsonData, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
req.Header.Set("Authorization", "Bearer as_your-api-key")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
fmt.Println("Error:", err)
return
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
public class ReplyToMessage {
public static void main(String[] args) {
try {
URL url = new URL("https://api.autosend.com/v1/inbound/messages/60d5ec49f1b2c72d9c8b1234/reply");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Authorization", "Bearer as_your-api-key");
con.setRequestProperty("Content-Type", "application/json");
con.setDoOutput(true);
String jsonInputString = "{\n" +
" \"from\": { \"email\": \"[email protected]\", \"name\": \"Support Team\" },\n" +
" \"subject\": \"Re: Question about my order\",\n" +
" \"html\": \"<p>Hi Jane, your order #4821 shipped today.</p>\",\n" +
" \"text\": \"Hi Jane, your order #4821 shipped today.\"\n" +
"}";
try (OutputStream os = con.getOutputStream()) {
byte[] input = jsonInputString.getBytes(StandardCharsets.UTF_8);
os.write(input, 0, input.length);
}
int status = con.getResponseCode();
System.out.println("Response Status: " + status);
} catch (Exception e) {
e.printStackTrace();
}
}
}
require 'net/http'
require 'json'
require 'uri'
uri = URI('https://api.autosend.com/v1/inbound/messages/60d5ec49f1b2c72d9c8b1234/reply')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri.path)
request['Authorization'] = 'Bearer as_your-api-key'
request['Content-Type'] = 'application/json'
request.body = {
from: { email: '[email protected]', name: 'Support Team' },
subject: 'Re: Question about my order',
html: '<p>Hi Jane, your order #4821 shipped today.</p>',
text: 'Hi Jane, your order #4821 shipped today.'
}.to_json
response = http.request(request)
puts response.body
{
"success": true,
"message": "Reply queued",
"data": {
"emailId": "0102018f-0000-0000-0000-000000000000",
"message": "Email queued successfully.",
"status": "QUEUED",
"totalRecipients": 1
}
}
This endpoint uses a standard project API key (
AS_ prefix). The reply is threaded into the original conversation (via In-Reply-To and References) and queued through the standard sending pipeline. The response returns 202 Accepted.The
from.email domain must be a verified sending domain on the project.curl --request POST \
--url https://api.autosend.com/v1/inbound/messages/60d5ec49f1b2c72d9c8b1234/reply \
--header 'Authorization: Bearer as_your-api-key' \
--header 'Content-Type: application/json' \
--data '{
"from": { "email": "[email protected]", "name": "Support Team" },
"subject": "Re: Question about my order",
"html": "<p>Hi Jane, your order #4821 shipped today.</p>",
"text": "Hi Jane, your order #4821 shipped today."
}'
import requests
url = "https://api.autosend.com/v1/inbound/messages/60d5ec49f1b2c72d9c8b1234/reply"
headers = {
"Authorization": "Bearer as_your-api-key",
"Content-Type": "application/json"
}
payload = {
"from": {"email": "[email protected]", "name": "Support Team"},
"subject": "Re: Question about my order",
"html": "<p>Hi Jane, your order #4821 shipped today.</p>",
"text": "Hi Jane, your order #4821 shipped today."
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
fetch('https://api.autosend.com/v1/inbound/messages/60d5ec49f1b2c72d9c8b1234/reply', {
method: 'POST',
headers: {
'Authorization': 'Bearer as_your-api-key',
'Content-Type': 'application/json'
},
body: JSON.stringify({
from: { email: '[email protected]', name: 'Support Team' },
subject: 'Re: Question about my order',
html: '<p>Hi Jane, your order #4821 shipped today.</p>',
text: 'Hi Jane, your order #4821 shipped today.'
})
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
<?php
$messageId = '60d5ec49f1b2c72d9c8b1234';
$url = "https://api.autosend.com/v1/inbound/messages/{$messageId}/reply";
$data = [
'from' => ['email' => '[email protected]', 'name' => 'Support Team'],
'subject' => 'Re: Question about my order',
'html' => '<p>Hi Jane, your order #4821 shipped today.</p>',
'text' => 'Hi Jane, your order #4821 shipped today.'
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer as_your-api-key',
'Content-Type: application/json'
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
url := "https://api.autosend.com/v1/inbound/messages/60d5ec49f1b2c72d9c8b1234/reply"
payload := map[string]interface{}{
"from": map[string]string{"email": "[email protected]", "name": "Support Team"},
"subject": "Re: Question about my order",
"html": "<p>Hi Jane, your order #4821 shipped today.</p>",
"text": "Hi Jane, your order #4821 shipped today.",
}
jsonData, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
req.Header.Set("Authorization", "Bearer as_your-api-key")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
fmt.Println("Error:", err)
return
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
public class ReplyToMessage {
public static void main(String[] args) {
try {
URL url = new URL("https://api.autosend.com/v1/inbound/messages/60d5ec49f1b2c72d9c8b1234/reply");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Authorization", "Bearer as_your-api-key");
con.setRequestProperty("Content-Type", "application/json");
con.setDoOutput(true);
String jsonInputString = "{\n" +
" \"from\": { \"email\": \"[email protected]\", \"name\": \"Support Team\" },\n" +
" \"subject\": \"Re: Question about my order\",\n" +
" \"html\": \"<p>Hi Jane, your order #4821 shipped today.</p>\",\n" +
" \"text\": \"Hi Jane, your order #4821 shipped today.\"\n" +
"}";
try (OutputStream os = con.getOutputStream()) {
byte[] input = jsonInputString.getBytes(StandardCharsets.UTF_8);
os.write(input, 0, input.length);
}
int status = con.getResponseCode();
System.out.println("Response Status: " + status);
} catch (Exception e) {
e.printStackTrace();
}
}
}
require 'net/http'
require 'json'
require 'uri'
uri = URI('https://api.autosend.com/v1/inbound/messages/60d5ec49f1b2c72d9c8b1234/reply')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri.path)
request['Authorization'] = 'Bearer as_your-api-key'
request['Content-Type'] = 'application/json'
request.body = {
from: { email: '[email protected]', name: 'Support Team' },
subject: 'Re: Question about my order',
html: '<p>Hi Jane, your order #4821 shipped today.</p>',
text: 'Hi Jane, your order #4821 shipped today.'
}.to_json
response = http.request(request)
puts response.body
{
"success": true,
"message": "Reply queued",
"data": {
"emailId": "0102018f-0000-0000-0000-000000000000",
"message": "Email queued successfully.",
"status": "QUEUED",
"totalRecipients": 1
}
}
Authorizations
Project API key header of the form Bearer
as_<key>. You can also pass the key via the x-api-key header.Path Parameters
The unique identifier of the inbound message to reply to. The message must belong to the authenticated project.Example:
"60d5ec49f1b2c72d9c8b1234"Body
The sender address for the reply. The email’s domain must be a verified sending domain on the project.
Show child attributes
Show child attributes
Sender email address.Example:
"[email protected]"Sender display name. Falls back to the project’s sender name when omitted.Maximum length:
256Example: "Support Team"Subject line for the reply. When omitted, defaults to the original subject prefixed with
Re: (no double prefixing).Minimum length: 1Maximum length: 998Example: "Re: Question about my order"HTML body of the reply.
Plain-text body of the reply.
CC recipients. Each entry has a required
email and optional name.Maximum items: 50BCC recipients. Each entry has a required
email and optional name.Maximum items: 50Attachments to include on the reply. Provide each attachment either inline (base64
content) or by fileUrl.Maximum items: 20Show child attributes
Show child attributes
Attachment file name.Minimum length:
1Maximum length: 256Public URL to fetch the attachment content from (alternative to
content).Base64-encoded attachment content (alternative to
fileUrl).MIME type of the attachment (e.g.
application/pdf).Size of the attachment in bytes.Minimum:
1Content-ID for inline attachments referenced from the HTML body.Maximum length:
128Optional description of the attachment.Maximum length:
256Response
Reply queued successfully (202)Indicates if the request was successfulExample:
trueConfirmation messageExample:
"Reply queued"Result of queuing the reply through the sending pipeline.
Show child attributes
Show child attributes
Unique identifier of the queued outbound email (email activity ID).
Queue confirmation message.Example:
"Email queued successfully."Initial status of the queued email. Always
QUEUED on success.Total number of recipients the reply was queued for (TO + CC + BCC).
Error Responses
Returned when
from.email is missing.{
"success": false,
"error": {
"message": "A `from` address is required to reply"
}
}
Returned when the
from domain is not a verified sending domain on the project.{
"success": false,
"error": {
"message": "Reply `from` address must use the same domain that received the message"
}
}
Returned when the inbound message does not exist or does not belong to the authenticated project, or when it has no usable reply target address.
{
"success": false,
"error": {
"message": "Inbound email not found"
}
}
Was this page helpful?
⌘I
curl --request POST \
--url https://api.autosend.com/v1/inbound/messages/60d5ec49f1b2c72d9c8b1234/reply \
--header 'Authorization: Bearer as_your-api-key' \
--header 'Content-Type: application/json' \
--data '{
"from": { "email": "[email protected]", "name": "Support Team" },
"subject": "Re: Question about my order",
"html": "<p>Hi Jane, your order #4821 shipped today.</p>",
"text": "Hi Jane, your order #4821 shipped today."
}'
import requests
url = "https://api.autosend.com/v1/inbound/messages/60d5ec49f1b2c72d9c8b1234/reply"
headers = {
"Authorization": "Bearer as_your-api-key",
"Content-Type": "application/json"
}
payload = {
"from": {"email": "[email protected]", "name": "Support Team"},
"subject": "Re: Question about my order",
"html": "<p>Hi Jane, your order #4821 shipped today.</p>",
"text": "Hi Jane, your order #4821 shipped today."
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
fetch('https://api.autosend.com/v1/inbound/messages/60d5ec49f1b2c72d9c8b1234/reply', {
method: 'POST',
headers: {
'Authorization': 'Bearer as_your-api-key',
'Content-Type': 'application/json'
},
body: JSON.stringify({
from: { email: '[email protected]', name: 'Support Team' },
subject: 'Re: Question about my order',
html: '<p>Hi Jane, your order #4821 shipped today.</p>',
text: 'Hi Jane, your order #4821 shipped today.'
})
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
<?php
$messageId = '60d5ec49f1b2c72d9c8b1234';
$url = "https://api.autosend.com/v1/inbound/messages/{$messageId}/reply";
$data = [
'from' => ['email' => '[email protected]', 'name' => 'Support Team'],
'subject' => 'Re: Question about my order',
'html' => '<p>Hi Jane, your order #4821 shipped today.</p>',
'text' => 'Hi Jane, your order #4821 shipped today.'
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer as_your-api-key',
'Content-Type: application/json'
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
url := "https://api.autosend.com/v1/inbound/messages/60d5ec49f1b2c72d9c8b1234/reply"
payload := map[string]interface{}{
"from": map[string]string{"email": "[email protected]", "name": "Support Team"},
"subject": "Re: Question about my order",
"html": "<p>Hi Jane, your order #4821 shipped today.</p>",
"text": "Hi Jane, your order #4821 shipped today.",
}
jsonData, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
req.Header.Set("Authorization", "Bearer as_your-api-key")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
fmt.Println("Error:", err)
return
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
public class ReplyToMessage {
public static void main(String[] args) {
try {
URL url = new URL("https://api.autosend.com/v1/inbound/messages/60d5ec49f1b2c72d9c8b1234/reply");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Authorization", "Bearer as_your-api-key");
con.setRequestProperty("Content-Type", "application/json");
con.setDoOutput(true);
String jsonInputString = "{\n" +
" \"from\": { \"email\": \"[email protected]\", \"name\": \"Support Team\" },\n" +
" \"subject\": \"Re: Question about my order\",\n" +
" \"html\": \"<p>Hi Jane, your order #4821 shipped today.</p>\",\n" +
" \"text\": \"Hi Jane, your order #4821 shipped today.\"\n" +
"}";
try (OutputStream os = con.getOutputStream()) {
byte[] input = jsonInputString.getBytes(StandardCharsets.UTF_8);
os.write(input, 0, input.length);
}
int status = con.getResponseCode();
System.out.println("Response Status: " + status);
} catch (Exception e) {
e.printStackTrace();
}
}
}
require 'net/http'
require 'json'
require 'uri'
uri = URI('https://api.autosend.com/v1/inbound/messages/60d5ec49f1b2c72d9c8b1234/reply')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri.path)
request['Authorization'] = 'Bearer as_your-api-key'
request['Content-Type'] = 'application/json'
request.body = {
from: { email: '[email protected]', name: 'Support Team' },
subject: 'Re: Question about my order',
html: '<p>Hi Jane, your order #4821 shipped today.</p>',
text: 'Hi Jane, your order #4821 shipped today.'
}.to_json
response = http.request(request)
puts response.body
{
"success": true,
"message": "Reply queued",
"data": {
"emailId": "0102018f-0000-0000-0000-000000000000",
"message": "Email queued successfully.",
"status": "QUEUED",
"totalRecipients": 1
}
}