Skip to main content
POST
/
api
/
v1
/
emails
/
{id}
/
reply
curl -X POST "https://api.jasni.ai/api/v1/emails/12345/[email protected]" \
  -H "Authorization: Bearer jsk_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Thanks for your email! I will review and get back to you.",
    "replyAll": false,
    "includeOriginal": true
  }'
{
  "success": true,
  "data": {
    "messageId": "<[email protected]>",
    "from": "[email protected]",
    "to": ["[email protected]"],
    "subject": "Re: Project Update",
    "inReplyTo": "<[email protected]>",
    "references": "<[email protected]>",
    "savedToSent": true
  }
}

Request

id
integer
required
UID of the email to reply to
account
string
required
Email account to send from
folder
string
default:"INBOX"
Folder where the original email is located

Body

text
string
Plain text reply body
html
string
HTML reply body
replyAll
boolean
default:"false"
Whether to reply to all recipients (Reply All)
includeOriginal
boolean
default:"true"
Whether to include the original message in the reply
At least one of text or html is required.

Response

success
boolean
Indicates if the reply was sent successfully
data
object
curl -X POST "https://api.jasni.ai/api/v1/emails/12345/[email protected]" \
  -H "Authorization: Bearer jsk_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Thanks for your email! I will review and get back to you.",
    "replyAll": false,
    "includeOriginal": true
  }'
{
  "success": true,
  "data": {
    "messageId": "<[email protected]>",
    "from": "[email protected]",
    "to": ["[email protected]"],
    "subject": "Re: Project Update",
    "inReplyTo": "<[email protected]>",
    "references": "<[email protected]>",
    "savedToSent": true
  }
}

How It Works

When you reply to an email, Jasni automatically:
  1. Determines recipients: Extracts the correct reply-to address from the original email
  2. Handles Reply All: When replyAll: true, includes all original recipients in To/CC
  3. Sets threading headers:
    • In-Reply-To: Points to the original email’s Message-ID
    • References: Full thread chain for email client threading
  4. Formats subject: Adds Re: prefix if not already present
  5. Quotes original: When includeOriginal: true, adds the original message with proper formatting
  6. Saves to Sent: Stores a copy in your Sent folder

Example with HTML

const response = await fetch(
  'https://api.jasni.ai/api/v1/emails/12345/[email protected]',
  {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer jsk_your_api_key',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      html: `
        <p>Thanks for your email!</p>
        <p>I'll review the proposal and get back to you by <strong>Friday</strong>.</p>
        <p>Best regards,<br>Your Name</p>
      `,
      replyAll: true,
      includeOriginal: true,
    }),
  }
);