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.
https://mail.sendcorex.com/v3.0/sendNot 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
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
Receive 403
The response is 403 Forbidden with code SPAM_DETECTED, a detectionId and a quarantine_id.
- 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
errorstringHuman-readable message explaining that the content was flagged as spam.
e.g.
"Email content flagged as spam."codestringMachine-readable error code. Always SPAM_DETECTED for flagged emails.
e.g.
"SPAM_DETECTED"detectionIdstringUnique ID of the spam detection. Include it when contacting support.
e.g.
"det_8c1e5a92b7d04f36"quarantine_idstring | nullUnique 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 | nullA 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 | nullHow 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 → Errors return a JSON object with error and code.
- 401
MISSING_AUTH_HEADERNo Authorization header present.
- 401
INVALID_API_KEYThe API key is invalid or revoked.
- 401
ACCOUNT_BLOCKEDAccount has been blocked.
- 401
NO_CREDITS_LEFTNo email credits remaining.
- 401
USER_NOT_FOUNDUser not found.
- 401
MISSING_USER_PRIVILEGESMissing user privileges.
- 401
EMAIL_CREDITS_NOT_FOUNDError fetching email credits.
- 429
CREDENTIAL_TEMPORARILY_BLOCKEDAPI key temporarily blocked due to repeated policy violations.
- 429
IP_TEMPORARILY_BLOCKEDRequesting IP temporarily blocked due to repeated policy violations.
- 400
MISSING_QUARANTINE_IDquarantine_id is required.
- 403
RELEASE_LIMIT_REACHEDToo many quarantine releases (limit: 10 / 3h). Account under review.
- 403
QUARANTINE_FORBIDDENThe quarantine record belongs to another account.
- 404
QUARANTINE_NOT_FOUNDQuarantine record not found or already processed.
- 410
QUARANTINE_EXPIREDQuarantine record has expired. Please resend the email.
- 500
INTERNAL_SERVER_ERRORUnexpected server error. Try again.
- 500
QUARANTINE_CORRUPTCorrupt quarantine payload.