Receive inbound email
curl --request POST \
--url http://localhost:3001/api/v1/mail/inbound \
--header 'Content-Type: application/json' \
--cookie nut-session= \
--data '
{
"type": "email.received",
"data": {
"email_id": "<string>",
"created_at": "<string>",
"from": "<string>",
"to": [
"<string>"
],
"cc": [
"<string>"
],
"bcc": [
"<string>"
],
"subject": "<string>",
"message_id": "<string>",
"body": "<string>",
"text": "<string>",
"html": "<string>",
"attachments": [
{
"id": "<string>",
"filename": "<string>",
"content_type": "<string>",
"content_disposition": "<string>",
"content_id": "<string>"
}
]
},
"created_at": "2023-11-07T05:31:56Z"
}
'import requests
url = "http://localhost:3001/api/v1/mail/inbound"
payload = {
"type": "email.received",
"data": {
"email_id": "<string>",
"created_at": "<string>",
"from": "<string>",
"to": ["<string>"],
"cc": ["<string>"],
"bcc": ["<string>"],
"subject": "<string>",
"message_id": "<string>",
"body": "<string>",
"text": "<string>",
"html": "<string>",
"attachments": [
{
"id": "<string>",
"filename": "<string>",
"content_type": "<string>",
"content_disposition": "<string>",
"content_id": "<string>"
}
]
},
"created_at": "2023-11-07T05:31:56Z"
}
headers = {
"cookie": "nut-session=",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {cookie: 'nut-session=', 'Content-Type': 'application/json'},
body: JSON.stringify({
type: 'email.received',
data: {
email_id: '<string>',
created_at: '<string>',
from: '<string>',
to: ['<string>'],
cc: ['<string>'],
bcc: ['<string>'],
subject: '<string>',
message_id: '<string>',
body: JSON.stringify('<string>'),
text: '<string>',
html: '<string>',
attachments: [
{
id: '<string>',
filename: '<string>',
content_type: '<string>',
content_disposition: '<string>',
content_id: '<string>'
}
]
},
created_at: '2023-11-07T05:31:56Z'
})
};
fetch('http://localhost:3001/api/v1/mail/inbound', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "3001",
CURLOPT_URL => "http://localhost:3001/api/v1/mail/inbound",
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([
'type' => 'email.received',
'data' => [
'email_id' => '<string>',
'created_at' => '<string>',
'from' => '<string>',
'to' => [
'<string>'
],
'cc' => [
'<string>'
],
'bcc' => [
'<string>'
],
'subject' => '<string>',
'message_id' => '<string>',
'body' => '<string>',
'text' => '<string>',
'html' => '<string>',
'attachments' => [
[
'id' => '<string>',
'filename' => '<string>',
'content_type' => '<string>',
'content_disposition' => '<string>',
'content_id' => '<string>'
]
]
],
'created_at' => '2023-11-07T05:31:56Z'
]),
CURLOPT_COOKIE => "nut-session=",
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$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 := "http://localhost:3001/api/v1/mail/inbound"
payload := strings.NewReader("{\n \"type\": \"email.received\",\n \"data\": {\n \"email_id\": \"<string>\",\n \"created_at\": \"<string>\",\n \"from\": \"<string>\",\n \"to\": [\n \"<string>\"\n ],\n \"cc\": [\n \"<string>\"\n ],\n \"bcc\": [\n \"<string>\"\n ],\n \"subject\": \"<string>\",\n \"message_id\": \"<string>\",\n \"body\": \"<string>\",\n \"text\": \"<string>\",\n \"html\": \"<string>\",\n \"attachments\": [\n {\n \"id\": \"<string>\",\n \"filename\": \"<string>\",\n \"content_type\": \"<string>\",\n \"content_disposition\": \"<string>\",\n \"content_id\": \"<string>\"\n }\n ]\n },\n \"created_at\": \"2023-11-07T05:31:56Z\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("cookie", "nut-session=")
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("http://localhost:3001/api/v1/mail/inbound")
.header("cookie", "nut-session=")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"email.received\",\n \"data\": {\n \"email_id\": \"<string>\",\n \"created_at\": \"<string>\",\n \"from\": \"<string>\",\n \"to\": [\n \"<string>\"\n ],\n \"cc\": [\n \"<string>\"\n ],\n \"bcc\": [\n \"<string>\"\n ],\n \"subject\": \"<string>\",\n \"message_id\": \"<string>\",\n \"body\": \"<string>\",\n \"text\": \"<string>\",\n \"html\": \"<string>\",\n \"attachments\": [\n {\n \"id\": \"<string>\",\n \"filename\": \"<string>\",\n \"content_type\": \"<string>\",\n \"content_disposition\": \"<string>\",\n \"content_id\": \"<string>\"\n }\n ]\n },\n \"created_at\": \"2023-11-07T05:31:56Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:3001/api/v1/mail/inbound")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["cookie"] = 'nut-session='
request["Content-Type"] = 'application/json'
request.body = "{\n \"type\": \"email.received\",\n \"data\": {\n \"email_id\": \"<string>\",\n \"created_at\": \"<string>\",\n \"from\": \"<string>\",\n \"to\": [\n \"<string>\"\n ],\n \"cc\": [\n \"<string>\"\n ],\n \"bcc\": [\n \"<string>\"\n ],\n \"subject\": \"<string>\",\n \"message_id\": \"<string>\",\n \"body\": \"<string>\",\n \"text\": \"<string>\",\n \"html\": \"<string>\",\n \"attachments\": [\n {\n \"id\": \"<string>\",\n \"filename\": \"<string>\",\n \"content_type\": \"<string>\",\n \"content_disposition\": \"<string>\",\n \"content_id\": \"<string>\"\n }\n ]\n },\n \"created_at\": \"2023-11-07T05:31:56Z\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"message": {
"id": "<string>",
"emailId": "<string>",
"from": "Acme <hello@acme.com>",
"to": [
"<string>"
],
"subject": "<string>",
"cc": [
"<string>"
],
"bcc": [
"<string>"
],
"messageId": "<string>",
"attachments": [
{
"id": "<string>",
"filename": "<string>",
"contentType": "<string>",
"contentDisposition": "<string>",
"contentId": "<string>"
}
],
"receivedAt": "2023-11-07T05:31:56Z",
"content": "<string>"
}
}
}{
"success": true,
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"success": true,
"error": {
"code": "<string>",
"message": "<string>"
}
}Mail
Receive inbound email
Webhook endpoint for receiving inbound emails from Resend.
Expects the Resend email.received webhook payload format.
POST
/
api
/
v1
/
mail
/
inbound
Receive inbound email
curl --request POST \
--url http://localhost:3001/api/v1/mail/inbound \
--header 'Content-Type: application/json' \
--cookie nut-session= \
--data '
{
"type": "email.received",
"data": {
"email_id": "<string>",
"created_at": "<string>",
"from": "<string>",
"to": [
"<string>"
],
"cc": [
"<string>"
],
"bcc": [
"<string>"
],
"subject": "<string>",
"message_id": "<string>",
"body": "<string>",
"text": "<string>",
"html": "<string>",
"attachments": [
{
"id": "<string>",
"filename": "<string>",
"content_type": "<string>",
"content_disposition": "<string>",
"content_id": "<string>"
}
]
},
"created_at": "2023-11-07T05:31:56Z"
}
'import requests
url = "http://localhost:3001/api/v1/mail/inbound"
payload = {
"type": "email.received",
"data": {
"email_id": "<string>",
"created_at": "<string>",
"from": "<string>",
"to": ["<string>"],
"cc": ["<string>"],
"bcc": ["<string>"],
"subject": "<string>",
"message_id": "<string>",
"body": "<string>",
"text": "<string>",
"html": "<string>",
"attachments": [
{
"id": "<string>",
"filename": "<string>",
"content_type": "<string>",
"content_disposition": "<string>",
"content_id": "<string>"
}
]
},
"created_at": "2023-11-07T05:31:56Z"
}
headers = {
"cookie": "nut-session=",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {cookie: 'nut-session=', 'Content-Type': 'application/json'},
body: JSON.stringify({
type: 'email.received',
data: {
email_id: '<string>',
created_at: '<string>',
from: '<string>',
to: ['<string>'],
cc: ['<string>'],
bcc: ['<string>'],
subject: '<string>',
message_id: '<string>',
body: JSON.stringify('<string>'),
text: '<string>',
html: '<string>',
attachments: [
{
id: '<string>',
filename: '<string>',
content_type: '<string>',
content_disposition: '<string>',
content_id: '<string>'
}
]
},
created_at: '2023-11-07T05:31:56Z'
})
};
fetch('http://localhost:3001/api/v1/mail/inbound', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "3001",
CURLOPT_URL => "http://localhost:3001/api/v1/mail/inbound",
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([
'type' => 'email.received',
'data' => [
'email_id' => '<string>',
'created_at' => '<string>',
'from' => '<string>',
'to' => [
'<string>'
],
'cc' => [
'<string>'
],
'bcc' => [
'<string>'
],
'subject' => '<string>',
'message_id' => '<string>',
'body' => '<string>',
'text' => '<string>',
'html' => '<string>',
'attachments' => [
[
'id' => '<string>',
'filename' => '<string>',
'content_type' => '<string>',
'content_disposition' => '<string>',
'content_id' => '<string>'
]
]
],
'created_at' => '2023-11-07T05:31:56Z'
]),
CURLOPT_COOKIE => "nut-session=",
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$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 := "http://localhost:3001/api/v1/mail/inbound"
payload := strings.NewReader("{\n \"type\": \"email.received\",\n \"data\": {\n \"email_id\": \"<string>\",\n \"created_at\": \"<string>\",\n \"from\": \"<string>\",\n \"to\": [\n \"<string>\"\n ],\n \"cc\": [\n \"<string>\"\n ],\n \"bcc\": [\n \"<string>\"\n ],\n \"subject\": \"<string>\",\n \"message_id\": \"<string>\",\n \"body\": \"<string>\",\n \"text\": \"<string>\",\n \"html\": \"<string>\",\n \"attachments\": [\n {\n \"id\": \"<string>\",\n \"filename\": \"<string>\",\n \"content_type\": \"<string>\",\n \"content_disposition\": \"<string>\",\n \"content_id\": \"<string>\"\n }\n ]\n },\n \"created_at\": \"2023-11-07T05:31:56Z\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("cookie", "nut-session=")
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("http://localhost:3001/api/v1/mail/inbound")
.header("cookie", "nut-session=")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"email.received\",\n \"data\": {\n \"email_id\": \"<string>\",\n \"created_at\": \"<string>\",\n \"from\": \"<string>\",\n \"to\": [\n \"<string>\"\n ],\n \"cc\": [\n \"<string>\"\n ],\n \"bcc\": [\n \"<string>\"\n ],\n \"subject\": \"<string>\",\n \"message_id\": \"<string>\",\n \"body\": \"<string>\",\n \"text\": \"<string>\",\n \"html\": \"<string>\",\n \"attachments\": [\n {\n \"id\": \"<string>\",\n \"filename\": \"<string>\",\n \"content_type\": \"<string>\",\n \"content_disposition\": \"<string>\",\n \"content_id\": \"<string>\"\n }\n ]\n },\n \"created_at\": \"2023-11-07T05:31:56Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:3001/api/v1/mail/inbound")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["cookie"] = 'nut-session='
request["Content-Type"] = 'application/json'
request.body = "{\n \"type\": \"email.received\",\n \"data\": {\n \"email_id\": \"<string>\",\n \"created_at\": \"<string>\",\n \"from\": \"<string>\",\n \"to\": [\n \"<string>\"\n ],\n \"cc\": [\n \"<string>\"\n ],\n \"bcc\": [\n \"<string>\"\n ],\n \"subject\": \"<string>\",\n \"message_id\": \"<string>\",\n \"body\": \"<string>\",\n \"text\": \"<string>\",\n \"html\": \"<string>\",\n \"attachments\": [\n {\n \"id\": \"<string>\",\n \"filename\": \"<string>\",\n \"content_type\": \"<string>\",\n \"content_disposition\": \"<string>\",\n \"content_id\": \"<string>\"\n }\n ]\n },\n \"created_at\": \"2023-11-07T05:31:56Z\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"message": {
"id": "<string>",
"emailId": "<string>",
"from": "Acme <hello@acme.com>",
"to": [
"<string>"
],
"subject": "<string>",
"cc": [
"<string>"
],
"bcc": [
"<string>"
],
"messageId": "<string>",
"attachments": [
{
"id": "<string>",
"filename": "<string>",
"contentType": "<string>",
"contentDisposition": "<string>",
"contentId": "<string>"
}
],
"receivedAt": "2023-11-07T05:31:56Z",
"content": "<string>"
}
}
}{
"success": true,
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"success": true,
"error": {
"code": "<string>",
"message": "<string>"
}
}Authorizations
sessionCookiebearerAuthapiKey
Session cookie authentication
Body
application/json
⌘I