POST
/
api
/
v2
/
mail
POST https://inbound.new/api/v2/mail
{
  "message": "Reply functionality is not yet implemented",
  "originalEmailId": "email_123",
  "replyData": {
    "to": "sender@example.com",
    "subject": "Re: Your inquiry",
    "hasTextBody": true,
    "hasHtmlBody": false,
    "attachmentCount": 0
  },
  "status": "pending_implementation"
}
This endpoint is currently in development and returns a placeholder response. The functionality will be fully implemented in a future release.
POST https://inbound.new/api/v2/mail

Authentication

Authorization
string
required
Bearer token for API authentication. Format: Bearer YOUR_API_KEY
Content-Type
string
required
Must be set to application/json

Request Body

emailId
string
required
ID of the original email to reply to. Must be a valid email ID that belongs to your account.
to
string
required
Recipient’s email address. Must be a valid email format.
subject
string
required
Subject line for the reply email.
textBody
string
Plain text body of the reply. Either textBody or htmlBody must be provided.
htmlBody
string
HTML body of the reply. Either textBody or htmlBody must be provided.
attachments
array
Array of attachment objects to include in the reply.

Request Examples

curl -X POST https://inbound.new/api/v2/mail \
  -H "Authorization: Bearer your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "emailId": "email_123",
    "to": "sender@example.com",
    "subject": "Re: Your inquiry",
    "textBody": "Thank you for your message. I will get back to you soon."
  }'

Response

{
  "message": "Reply functionality is not yet implemented",
  "originalEmailId": "email_123",
  "replyData": {
    "to": "sender@example.com",
    "subject": "Re: Your inquiry",
    "hasTextBody": true,
    "hasHtmlBody": false,
    "attachmentCount": 0
  },
  "status": "pending_implementation"
}
{
  "id": "reply_456",
  "originalEmailId": "email_123",
  "messageId": "<reply-message@inbound.new>",
  "to": "sender@example.com",
  "subject": "Re: Your inquiry",
  "sentAt": "2024-01-15T14:30:00Z",
  "status": "sent",
  "deliveryStatus": "pending",
  "headers": {
    "inReplyTo": "<original-message@example.com>",
    "references": "<original-message@example.com>"
  },
  "content": {
    "textBody": "Thank you for your message. I will get back to you soon.",
    "htmlBody": null,
    "attachments": []
  },
  "createdAt": "2024-01-15T14:30:00Z"
}

Response Fields

message
string
Current status message indicating development state.
originalEmailId
string
ID of the original email being replied to.
replyData
object
Summary of the reply data that was processed.
status
string
Current implementation status: “pending_implementation”.

Error Responses

Request Validation

The API performs several validation checks on the request:

Required Fields

  • emailId - Must be a valid email ID
  • to - Must be a valid email address
  • subject - Must be provided
  • At least one of textBody or htmlBody must be provided

Email Format Validation

The to field is validated using a regex pattern to ensure it’s a valid email address format.

Content Requirements

Either textBody or htmlBody (or both) must be provided. The reply cannot be sent without content.

Usage Examples

Basic Reply Function

const sendReply = async (originalEmailId, recipientEmail, subject, message) => {
  try {
    const response = await fetch('https://inbound.new/api/v2/mail', {
      method: 'POST',
      headers: {
        'Authorization': `Bearer ${process.env.INBOUND_API_KEY}`,
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        emailId: originalEmailId,
        to: recipientEmail,
        subject: subject,
        textBody: message
      })
    });
    
    if (!response.ok) {
      throw new Error(`HTTP error! status: ${response.status}`);
    }
    
    return await response.json();
  } catch (error) {
    console.error('Error sending reply:', error);
    throw error;
  }
};

Reply with Template

const replyWithTemplate = async (originalEmail, templateType) => {
  const templates = {
    acknowledgment: {
      subject: `Re: ${originalEmail.subject}`,
      body: `Thank you for your email. We have received your message and will respond within 24 hours.`
    },
    followup: {
      subject: `Re: ${originalEmail.subject}`,
      body: `Following up on your previous email. Do you need any additional information?`
    }
  };
  
  const template = templates[templateType];
  
  return await sendReply(
    originalEmail.id,
    originalEmail.from,
    template.subject,
    template.body
  );
};

Reply with Attachment

const replyWithAttachment = async (emailId, recipientEmail, subject, message, filePath) => {
  // Read file and convert to base64
  const fs = require('fs');
  const fileContent = fs.readFileSync(filePath);
  const base64Content = fileContent.toString('base64');
  
  const fileName = filePath.split('/').pop();
  const contentType = getContentType(fileName); // Your content type detection logic
  
  return await fetch('https://inbound.new/api/v2/mail', {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${process.env.INBOUND_API_KEY}`,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      emailId,
      to: recipientEmail,
      subject,
      textBody: message,
      attachments: [{
        filename: fileName,
        contentType: contentType,
        content: base64Content
      }]
    })
  });
};

Future Implementation

When fully implemented, this endpoint will:
  1. Send actual emails using SMTP or email service provider
  2. Set proper threading headers (In-Reply-To, References)
  3. Track delivery status and provide delivery confirmations
  4. Log sent emails in a separate table for audit trails
  5. Support email templates and advanced formatting
  6. Handle bounce notifications and delivery failures
  7. Provide real-time status updates via webhooks
The reply functionality is currently in development. The endpoint validates input and returns a placeholder response. Monitor our changelog for updates on when this feature will be fully available.
While waiting for the full implementation, you can use the validation features of this endpoint to test your integration and ensure your request format is correct.