MisarMisar Docs
MisarMailMisar.BlogMisarReachMisarPostMisar.DevMisarSEOMisar PlatformMisar SSO
API Reference

AI Features

AI-powered email generation, subject line optimization, reply suggestions, and segment building

MisarMail's AI layer covers the full email workflow — from generating subject lines and full email bodies to scoring drafts, suggesting replies, and building audience segments from plain language.

Subject Lines

POST/mail/v1/ai/subject-lines

Generate up to 10 subject line ideas for any topic. Authenticated with an API key (Authorization: Bearer msk_...).

Request body

topicstring (5–500 chars)bodyrequired

The email topic or campaign brief.

tonestringbodydefault: professional

One of professional, casual, urgent, playful, informative.

audiencestring (max 200 chars)body

Audience description to improve relevance.

countinteger (1–10)bodydefault: 5

How many suggestions to return.

brandstring (max 100 chars)body

Brand name for brand-voice alignment.

Response fields

successboolean

true when the request succeeded.

dataobject

Wraps subjects — an array of suggestion objects. Each has text (the subject line), score (0–100 quality estimate), reason (why it works), and an optional emoji_version.

Rate limit: 10 requests per minute per API key.

curl -X POST https://api.misar.io/mail/v1/ai/subject-lines \
  -H "Authorization: Bearer msk_..." \
  -H "Content-Type: application/json" \
  -d '{ "topic": "email deliverability tips", "tone": "informative", "count": 5 }'
{
  "success": true,
  "data": {
    "subjects": [
      {
        "text": "5 things you didn't know about email deliverability",
        "score": 82,
        "reason": "Specific number + curiosity gap",
        "emoji_version": "📬 5 things you didn't know about email deliverability"
      },
      {
        "text": "The subject line formula that actually works",
        "score": 76,
        "reason": "Promises a concrete, proven method"
      }
    ]
  }
}

Subject line generation requires an AI-enabled plan (Pro or higher) and counts against your monthly AI generation limit. The system prompt instructs the model to avoid spammy phrasing and ALL-CAPS; when AI is not configured, a deterministic fallback set is returned instead.

Email Generation

POST/mail/ai/generate-email

Generate full email content, sequences, A/B variants, or score an existing subject line. Requires an active dashboard session and a Pro or higher plan.

Request body

typestringbodyrequired

Generation type: subject, body, full, sequence, score-subject, or ab-variants.

promptstring (10–500 chars)bodyrequired

What the email should be about.

tonestringbodydefault: professional

One of professional, friendly, urgent, casual.

includeVariablesbooleanbodydefault: true

Inject merge tags like {{first_name}}.

currentSubjectstring (max 200 chars)body

For score-subject: the subject line to evaluate. Falls back to prompt if omitted.

sequenceLengthinteger (2–5)bodydefault: 3

Number of emails in sequence.

Response fields

successboolean

true when generation succeeded.

datastring | object | array

Generated content. Shape depends on type — see the example responses. For sequence, each email's purpose is one of awareness, consideration, conversion, follow_up, re_engagement.

{ "success": true, "data": "Your account is ready — here's what to do next" }
{ "success": true, "data": "<p>Hi {{first_name}},</p>..." }
{
  "success": true,
  "data": {
    "subject": "Welcome to MisarMail",
    "html": "<p>Hi {{first_name}},</p>...",
    "preheader": "Everything you need to send your first campaign"
  }
}
{
  "success": true,
  "data": [
    {
      "subject": "Welcome — let's get you started",
      "html": "...",
      "preheader": "Your first step to better email",
      "send_delay_days": 0,
      "purpose": "awareness"
    },
    {
      "subject": "Have you tried campaigns yet?",
      "html": "...",
      "preheader": "Send your first campaign in 5 minutes",
      "send_delay_days": 3,
      "purpose": "consideration"
    },
    {
      "subject": "Upgrade and unlock AI — limited offer",
      "html": "...",
      "preheader": "50 % off Pro for the next 48 hours",
      "send_delay_days": 7,
      "purpose": "conversion"
    }
  ]
}
{
  "success": true,
  "data": {
    "score": 6,
    "issues": ["Too generic", "No urgency or benefit"],
    "alternatives": [
      { "subject": "Double your open rates in 7 days", "score": 9, "rationale": "Clear benefit + timeframe" },
      { "subject": "The open rate trick your competitors use", "score": 8, "rationale": "Curiosity + competitive framing" }
    ]
  }
}
{
  "success": true,
  "data": {
    "variants": [
      {
        "label": "A",
        "hypothesis": "Benefit-led subject drives higher opens",
        "subject": "Get 30 % more replies with this template",
        "html": "...",
        "preheader": "Used by 12,000 sales teams"
      },
      {
        "label": "B",
        "hypothesis": "Curiosity-gap subject outperforms direct benefit",
        "subject": "Why your reply rate is lower than it should be",
        "html": "...",
        "preheader": "The fix takes under 2 minutes"
      }
    ]
  }
}

Plan limits

FeatureFreeProMaxEnterprise
generate-email endpoint
Subject line API (/v1/ai/subject-lines)
Monthly AI generations01001,000Unlimited

Both AI endpoints enforce the ai_features gate first (plan must include AI), then decrement the monthly ai_generations allowance. Requests over the monthly limit return 403.

Suggest Reply

POST/mail/inbox/ai/reply

Get an AI-drafted reply to an inbox email. Requires an active dashboard session.

Request body

emailIdstring (uuid)bodyrequired

UUID of the inbox email to reply to.

Response fields

successboolean

true when the reply was generated.

replystring

The AI-drafted reply text.

{ "emailId": "3a7d5e10-9c2b-4f81-b6d2-7e0f1a4c8b9d" }
{
  "success": true,
  "reply": "Thanks for reaching out — happy to help with that. Could you share a bit more about..."
}

Build Segment

POST/mail/ai/build-segment

Describe an audience in plain language; get back a criteria object ready to pass to POST /v1/segments. Requires an active dashboard session.

Request body

promptstring (5–500 chars)bodyrequired

Plain-language description of the audience.

Response fields

successboolean

true when the criteria were generated.

criteriaobject

Segment criteria with a top-level operator (AND / OR) and a rules array. Each rule is { field, operator, value }.

Supported fields: status, score, tag, email_opened_count, email_clicked_count, location_country, days_since_signup, days_since_activity, source.

Supported operators: equals, not_equals, greater_than, greater_than_or_equal, less_than, less_than_or_equal, contains.

{ "prompt": "contacts who opened emails in the last 30 days and haven't clicked any link" }
{
  "success": true,
  "criteria": {
    "operator": "AND",
    "rules": [
      { "field": "email_opened_count", "operator": "greater_than", "value": 0 },
      { "field": "email_clicked_count", "operator": "equals", "value": 0 }
    ]
  }
}