Quarantine

Flagged Email

When a sent email is flagged as potential spam, the API returns a 403 instead of queuing the message. A quarantine_id is returned so you can review and release the email later.

POSThttps://mail.sendcorex.com/v3.0/send
!

Not delivered: a quarantined email is not sent. Use /quarantine/release to deliver it after review. The record expires after 3 hours.

How it works

  1. 1

    Send

    You call /send normally. If the body or subject triggers the spam filter, the API stores the raw payload in quarantine instead of queuing the email.

  2. 2

    Receive 403

    The response is 403 Forbidden with code SPAM_DETECTED, a detectionId and a quarantine_id.

  3. 3

    Review

    Inspect the flagged content. If the email is legitimate, call /quarantine/release with the quarantine_id within 3 hours. The body and subject are sanitized before delivery.

403 payload

  • errorstring

    Human-readable message explaining that the content was flagged as spam.

    e.g. "Email content flagged as spam."

  • codestring

    Machine-readable error code. Always SPAM_DETECTED for flagged emails.

    e.g. "SPAM_DETECTED"

  • detectionIdstring

    Unique ID of the spam detection. Include it when contacting support.

    e.g. "det_8c1e5a92b7d04f36"

  • quarantine_idstring | null

    Unique ID of the quarantined message. Pass it to /quarantine/release to deliver the email. It is null when the message could not be stored for release.

    e.g. "qtn_3f2a1b4c8e9d4f7a"

  • release_instructionsstring | null

    A short hint on how to release the email. null when there is no quarantine_id.

    e.g. "POST /v3.0/quarantine/release with { quarantine_id }"

  • expires_instring | null

    How long the quarantine record stays available for release.

    e.g. "3 hours"

Quick start

import axios from 'axios';

try {
  const response = await axios.post(
    'https://mail.sendcorex.com/v3.0/send',
    {
      to: 'user@example.com',
      from: 'noreply@yourdomain.com',
      senderName: 'My App',
      subject: 'Hello!',
      body: '<p>Your message here.</p>',
    },
    { headers: { Authorization: process.env.SENDCOREX_API_KEY } }
  );
  console.log('Queued:', response.data.id);
} catch (err) {
  if (err.response?.status === 403 && err.response.data.code === 'SPAM_DETECTED') {
    // Email flagged as spam: save quarantine_id to release it later
    const { quarantine_id, detectionId, expires_in } = err.response.data;
    console.log('Quarantined:', quarantine_id, '| detection:', detectionId, '| expires in', expires_in);
  } else {
    throw err;
  }
}

Response

{
  "error": "Email content flagged as spam.",
  "code": "SPAM_DETECTED",
  "detectionId": "det_8c1e5a92b7d04f36",
  "quarantine_id": "qtn_3f2a1b4c8e9d4f7a",
  "release_instructions": "POST /v3.0/quarantine/release with { quarantine_id }",
  "expires_in": "3 hours"
}

Errors return a JSON object with error and code.

  • 401MISSING_AUTH_HEADER

    No Authorization header present.

  • 401INVALID_API_KEY

    The API key is invalid or revoked.

  • 401ACCOUNT_BLOCKED

    Account has been blocked.

  • 401NO_CREDITS_LEFT

    No email credits remaining.

  • 401USER_NOT_FOUND

    User not found.

  • 401MISSING_USER_PRIVILEGES

    Missing user privileges.

  • 401EMAIL_CREDITS_NOT_FOUND

    Error fetching email credits.

  • 429CREDENTIAL_TEMPORARILY_BLOCKED

    API key temporarily blocked due to repeated policy violations.

  • 429IP_TEMPORARILY_BLOCKED

    Requesting IP temporarily blocked due to repeated policy violations.

  • 400MISSING_QUARANTINE_ID

    quarantine_id is required.

  • 403RELEASE_LIMIT_REACHED

    Too many quarantine releases (limit: 10 / 3h). Account under review.

  • 403QUARANTINE_FORBIDDEN

    The quarantine record belongs to another account.

  • 404QUARANTINE_NOT_FOUND

    Quarantine record not found or already processed.

  • 410QUARANTINE_EXPIRED

    Quarantine record has expired. Please resend the email.

  • 500INTERNAL_SERVER_ERROR

    Unexpected server error. Try again.

  • 500QUARANTINE_CORRUPT

    Corrupt quarantine payload.