---
agent:
  instructions: "Use this search API to find relevant content across this site with keywords or natural-language queries, instead of crawling individual pages. Results are returned in Markdown."
  endpoint: "https://docs.sendcorex.com/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://docs.sendcorex.com/llms.txt"
---

Source: https://docs.sendcorex.com/api-reference/email/quarantine

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.

POST `https://mail.sendcorex.com/v3.0/send`

**Not delivered:** a quarantined email is not sent. Use [/quarantine/release](https://docs.sendcorex.com/api-reference/email/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

- `error` string
Human-readable message explaining that the content was flagged as spam.
e.g. `"Email content flagged as spam."`
- `code` string
Machine-readable error code. Always SPAM_DETECTED for flagged emails.
e.g. `"SPAM_DETECTED"`
- `detectionId` string
Unique ID of the spam detection. Include it when contacting support.
e.g. `"det_8c1e5a92b7d04f36"`
- `quarantine_id` string | 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_instructions` string | 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_in` string | 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

[All error codes →](https://docs.sendcorex.com/api-reference/errors)

Errors return a JSON object with `error` and `code`.

- 401`MISSING_AUTH_HEADER`
No Authorization header present.
- 401`INVALID_API_KEY`
The API key is invalid or revoked.
- 401`ACCOUNT_BLOCKED`
Account has been blocked.
- 401`NO_CREDITS_LEFT`
Not enough email credits for every recipient. Each to, cc and bcc address uses 1 credit.
- 401`USER_NOT_FOUND`
User not found.
- 401`MISSING_USER_PRIVILEGES`
Missing user privileges.
- 401`EMAIL_CREDITS_NOT_FOUND`
Error fetching email credits.
- 401`EMAIL_NOT_VALIDATED`
Account email address has not been verified yet.
- 429`CREDENTIAL_TEMPORARILY_BLOCKED`
API key temporarily blocked due to repeated policy violations.
- 429`IP_TEMPORARILY_BLOCKED`
Requesting IP temporarily blocked due to repeated policy violations.
- 429`TOO_MANY_CONCURRENT_CONNECTIONS`
Too many concurrent requests from this IP. Try again shortly.
- 400`MISSING_QUARANTINE_ID`
quarantine_id is required.
- 403`RELEASE_LIMIT_REACHED`
Too many quarantine releases (limit: 10 / 3h). Account under review.
- 403`QUARANTINE_FORBIDDEN`
The quarantine record belongs to another account.
- 404`QUARANTINE_NOT_FOUND`
Quarantine record not found or already processed.
- 410`QUARANTINE_EXPIRED`
Quarantine record has expired. Please resend the email.
- 409`QUARANTINE_ALREADY_APPROVED`
This email was already approved by our team and is being delivered. No action needed.
- 409`QUARANTINE_IN_PROGRESS`
This email is already being released (another request got there first). No action needed.
- 500`INTERNAL_SERVER_ERROR`
Unexpected server error. Try again.
- 500`QUARANTINE_CORRUPT`
Corrupt quarantine payload.
- 503`AUTH_UNAVAILABLE`
Could not validate the API key right now. Try again.
