GET https://inbound.new/api/v2/mail/{id}
{
"id": "email_123",
"emailId": "ses_456",
"messageId": "<message@example.com>",
"subject": "Important Update",
"from": "sender@example.com",
"fromName": "John Doe",
"to": "recipient@yourdomain.com",
"cc": "cc@example.com",
"bcc": null,
"replyTo": "reply@example.com",
"recipient": "recipient@yourdomain.com",
"receivedAt": "2024-01-15T10:30:00Z",
"isRead": true,
"readAt": "2024-01-15T12:00:00Z",
"content": {
"textBody": "This is the plain text version of the email...",
"htmlBody": "<html><body><p>This is the HTML version...</p></body></html>",
"rawContent": "Received: from mail.example.com...",
"attachments": [
{
"filename": "document.pdf",
"contentType": "application/pdf",
"size": 102400,
"contentId": "att_123"
}
],
"headers": {
"received": ["from mail.example.com..."],
"x-mailer": "Example Mailer 1.0",
"content-type": "multipart/mixed"
}
},
"addresses": {
"from": {
"text": "John Doe <sender@example.com>",
"addresses": [
{
"address": "sender@example.com",
"name": "John Doe"
}
]
},
"to": {
"text": "recipient@yourdomain.com",
"addresses": [
{
"address": "recipient@yourdomain.com",
"name": null
}
]
},
"cc": {
"text": "cc@example.com",
"addresses": [
{
"address": "cc@example.com",
"name": null
}
]
},
"bcc": null,
"replyTo": {
"text": "reply@example.com",
"addresses": [
{
"address": "reply@example.com",
"name": null
}
]
}
},
"metadata": {
"inReplyTo": "<previous@example.com>",
"references": [
"<ref1@example.com>",
"<ref2@example.com>"
],
"priority": "normal",
"parseSuccess": true,
"parseError": null,
"hasAttachments": true,
"attachmentCount": 1,
"hasTextBody": true,
"hasHtmlBody": true
},
"security": {
"spf": "PASS",
"dkim": "PASS",
"dmarc": "PASS",
"spam": "PASS",
"virus": "PASS"
},
"processing": {
"processingTimeMs": 245,
"timestamp": "2024-01-15T10:30:00Z",
"receiptTimestamp": "2024-01-15T10:30:00Z",
"actionType": "SNS",
"s3Info": {
"bucketName": "inbound-emails",
"objectKey": "emails/2024/01/15/email_123.eml",
"contentFetched": true,
"contentSize": 51200,
"error": null
},
"commonHeaders": {
"from": ["sender@example.com"],
"to": ["recipient@yourdomain.com"],
"messageId": "<message@example.com>",
"subject": "Important Update"
}
},
"createdAt": "2024-01-15T10:30:00Z",
"updatedAt": "2024-01-15T12:00:00Z"
}
Retrieve complete email content including headers, attachments, and metadata
GET https://inbound.new/api/v2/mail/{id}
{
"id": "email_123",
"emailId": "ses_456",
"messageId": "<message@example.com>",
"subject": "Important Update",
"from": "sender@example.com",
"fromName": "John Doe",
"to": "recipient@yourdomain.com",
"cc": "cc@example.com",
"bcc": null,
"replyTo": "reply@example.com",
"recipient": "recipient@yourdomain.com",
"receivedAt": "2024-01-15T10:30:00Z",
"isRead": true,
"readAt": "2024-01-15T12:00:00Z",
"content": {
"textBody": "This is the plain text version of the email...",
"htmlBody": "<html><body><p>This is the HTML version...</p></body></html>",
"rawContent": "Received: from mail.example.com...",
"attachments": [
{
"filename": "document.pdf",
"contentType": "application/pdf",
"size": 102400,
"contentId": "att_123"
}
],
"headers": {
"received": ["from mail.example.com..."],
"x-mailer": "Example Mailer 1.0",
"content-type": "multipart/mixed"
}
},
"addresses": {
"from": {
"text": "John Doe <sender@example.com>",
"addresses": [
{
"address": "sender@example.com",
"name": "John Doe"
}
]
},
"to": {
"text": "recipient@yourdomain.com",
"addresses": [
{
"address": "recipient@yourdomain.com",
"name": null
}
]
},
"cc": {
"text": "cc@example.com",
"addresses": [
{
"address": "cc@example.com",
"name": null
}
]
},
"bcc": null,
"replyTo": {
"text": "reply@example.com",
"addresses": [
{
"address": "reply@example.com",
"name": null
}
]
}
},
"metadata": {
"inReplyTo": "<previous@example.com>",
"references": [
"<ref1@example.com>",
"<ref2@example.com>"
],
"priority": "normal",
"parseSuccess": true,
"parseError": null,
"hasAttachments": true,
"attachmentCount": 1,
"hasTextBody": true,
"hasHtmlBody": true
},
"security": {
"spf": "PASS",
"dkim": "PASS",
"dmarc": "PASS",
"spam": "PASS",
"virus": "PASS"
},
"processing": {
"processingTimeMs": 245,
"timestamp": "2024-01-15T10:30:00Z",
"receiptTimestamp": "2024-01-15T10:30:00Z",
"actionType": "SNS",
"s3Info": {
"bucketName": "inbound-emails",
"objectKey": "emails/2024/01/15/email_123.eml",
"contentFetched": true,
"contentSize": 51200,
"error": null
},
"commonHeaders": {
"from": ["sender@example.com"],
"to": ["recipient@yourdomain.com"],
"messageId": "<message@example.com>",
"subject": "Important Update"
}
},
"createdAt": "2024-01-15T10:30:00Z",
"updatedAt": "2024-01-15T12:00:00Z"
}
GET https://inbound.new/api/v2/mail/{id}
Bearer YOUR_API_KEY
curl -X GET https://inbound.new/api/v2/mail/email_123 \
-H "Authorization: Bearer your_api_key_here"
{
"id": "email_123",
"emailId": "ses_456",
"messageId": "<message@example.com>",
"subject": "Important Update",
"from": "sender@example.com",
"fromName": "John Doe",
"to": "recipient@yourdomain.com",
"cc": "cc@example.com",
"bcc": null,
"replyTo": "reply@example.com",
"recipient": "recipient@yourdomain.com",
"receivedAt": "2024-01-15T10:30:00Z",
"isRead": true,
"readAt": "2024-01-15T12:00:00Z",
"content": {
"textBody": "This is the plain text version of the email...",
"htmlBody": "<html><body><p>This is the HTML version...</p></body></html>",
"rawContent": "Received: from mail.example.com...",
"attachments": [
{
"filename": "document.pdf",
"contentType": "application/pdf",
"size": 102400,
"contentId": "att_123"
}
],
"headers": {
"received": ["from mail.example.com..."],
"x-mailer": "Example Mailer 1.0",
"content-type": "multipart/mixed"
}
},
"addresses": {
"from": {
"text": "John Doe <sender@example.com>",
"addresses": [
{
"address": "sender@example.com",
"name": "John Doe"
}
]
},
"to": {
"text": "recipient@yourdomain.com",
"addresses": [
{
"address": "recipient@yourdomain.com",
"name": null
}
]
},
"cc": {
"text": "cc@example.com",
"addresses": [
{
"address": "cc@example.com",
"name": null
}
]
},
"bcc": null,
"replyTo": {
"text": "reply@example.com",
"addresses": [
{
"address": "reply@example.com",
"name": null
}
]
}
},
"metadata": {
"inReplyTo": "<previous@example.com>",
"references": [
"<ref1@example.com>",
"<ref2@example.com>"
],
"priority": "normal",
"parseSuccess": true,
"parseError": null,
"hasAttachments": true,
"attachmentCount": 1,
"hasTextBody": true,
"hasHtmlBody": true
},
"security": {
"spf": "PASS",
"dkim": "PASS",
"dmarc": "PASS",
"spam": "PASS",
"virus": "PASS"
},
"processing": {
"processingTimeMs": 245,
"timestamp": "2024-01-15T10:30:00Z",
"receiptTimestamp": "2024-01-15T10:30:00Z",
"actionType": "SNS",
"s3Info": {
"bucketName": "inbound-emails",
"objectKey": "emails/2024/01/15/email_123.eml",
"contentFetched": true,
"contentSize": 51200,
"error": null
},
"commonHeaders": {
"from": ["sender@example.com"],
"to": ["recipient@yourdomain.com"],
"messageId": "<message@example.com>",
"subject": "Important Update"
}
},
"createdAt": "2024-01-15T10:30:00Z",
"updatedAt": "2024-01-15T12:00:00Z"
}
Show Content Properties
Show Address Properties
Show Metadata Properties
Show Security Properties
Show Processing Properties
Show S3 Info Properties
400 Bad Request - Invalid ID
{
"error": "Valid email ID is required"
}
401 Unauthorized
{
"error": "Invalid or missing API key"
}
404 Not Found
{
"error": "Email not found"
}
500 Internal Server Error
{
"error": "Failed to fetch email"
}
const getEmailDetails = async (emailId) => {
const response = await fetch(`https://inbound.new/api/v2/mail/${emailId}`, {
headers: {
'Authorization': `Bearer ${process.env.INBOUND_API_KEY}`
}
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
return await response.json();
};
// Usage
const email = await getEmailDetails('email_123');
console.log(email.subject);
console.log(email.content.textBody);
const processEmailAttachments = async (emailId) => {
const email = await getEmailDetails(emailId);
if (email.metadata.hasAttachments) {
email.content.attachments.forEach(attachment => {
console.log(`Attachment: ${attachment.filename}`);
console.log(`Type: ${attachment.contentType}`);
console.log(`Size: ${attachment.size} bytes`);
});
}
};
const checkEmailSecurity = async (emailId) => {
const email = await getEmailDetails(emailId);
const securityPassed =
email.security.spf === 'PASS' &&
email.security.dkim === 'PASS' &&
email.security.dmarc === 'PASS' &&
email.security.spam === 'PASS' &&
email.security.virus === 'PASS';
return {
emailId,
securityPassed,
details: email.security
};
};
readAt
timestamp is updated.metadata.parseSuccess
field to check if the email was parsed correctly. If parseSuccess
is false, check the parseError
field for details.