Search quarantine¶
POST/
Email Management API · Quarantine
Summary of all the quarantined messages matching your search and filter conditions.
Parameters¶
| Name | In | Type | Required | Description |
|---|---|---|---|---|
X-Tenant-ID | header | string (uuid) | Yes | Tenant ID. |
Request body¶
Content type: application/json
Request body fields
beginDatestring (date-time)requiredMessages quarantined on or after this date. Used with endDate.
endDatestring (date-time)requiredMessages quarantined on or after this date. Used with beginDate.
fieldsarray of stringThe fields to return in a partial response.
pageFromKeystringFrom where to start searching the records.
pageSizeintegerThe size of the page requested.
Must be ≤ 100.
Must be ≤ 100.
sortarray of stringDefines how to sort the data. Supported fields are from, forRecipient, quarantinedAt.
filterobjectFiltering conditions.
Show child attributesHide child attributes
idstring (uuid)ID from 'X-Sophos-Email-ID' header.
fromContainsstringReturn all rows which contains the provided text in from field.
toContainsstringReturn all rows which contains the provided text in to field.
subjectContainsstringReturn all rows which contains the provided text in subject field.
attachmentNameContainsstringReturn all rows which contains the provided text in attachment names.
sizeInMBGreaterThannumberReturn all rows where the message size in MB is greater than the provided value.
sizeInMBLowerThannumberReturn all rows where the message size in MB is less than the provided value.
directionstringMust be one of:
inbound, outbound.productTypestringEmail product.
Must be one of:
Must be one of:
mailflow, gateway, ems.reasonarray of stringReturn all rows which has the reason provided in the list.
Each item must be one of:
Each item must be one of:
bulk, dataControl, dkim, dmarc, headerAnomaly, domainAnomaly, impersonation, intelixMalicious, intelixSuspicious, intelixUnscannable, maliciousUrl, malware, s/mime, spam, spf, suspectedSpam, unscannable, countrySpam, languageSpam, batvSpam, nrdSpam.hasAnyAttachmentbooleanReturn all rows where email has at least one attachment.
Request samples¶
curl -X POST "https://api-<data-region>.central.sophos.com/email/v1/quarantine/messages/search" -H "Authorization: Bearer <access-token>" -H "X-Tenant-ID: <tenant-id>" -H "Content-Type: application/json" -d "{
\"beginDate\": \"2012-06-26T11:55:36.100Z\",
\"endDate\": \"2012-06-26T11:55:36.100Z\",
\"fields\": [
\"reason\"
],
\"pageFromKey\": \"string\",
\"pageSize\": 50,
\"sort\": [
\"quarantinedAt:DESC\"
],
\"filter\": {
\"id\": \"15a7f8ea-691c-4f03-862e-3cefb102818e\",
\"fromContains\": \"some text\",
\"toContains\": \"some text\",
\"subjectContains\": \"some text\",
\"attachmentNameContains\": \"some text\",
\"sizeInMBGreaterThan\": 1,
\"sizeInMBLowerThan\": 2,
\"direction\": \"inbound\",
\"productType\": \"mailflow\",
\"reason\": [
\"impersonation\"
],
\"hasAnyAttachment\": false
}
}"
import requests
response = requests.post(
"https://api-<data-region>.central.sophos.com/email/v1/quarantine/messages/search",
headers={
"Authorization": "Bearer <access-token>",
"X-Tenant-ID": "<tenant-id>",
"Content-Type": "application/json",
},
json={ 'beginDate': '2012-06-26T11:55:36.100Z',
'endDate': '2012-06-26T11:55:36.100Z',
'fields': ['reason'],
'pageFromKey': 'string',
'pageSize': 50,
'sort': ['quarantinedAt:DESC'],
'filter': { 'id': '15a7f8ea-691c-4f03-862e-3cefb102818e',
'fromContains': 'some text',
'toContains': 'some text',
'subjectContains': 'some text',
'attachmentNameContains': 'some text',
'sizeInMBGreaterThan': 1,
'sizeInMBLowerThan': 2,
'direction': 'inbound',
'productType': 'mailflow',
'reason': ['impersonation'],
'hasAnyAttachment': False}},
)
print(response.json())
$headers = @{
"Authorization" = "Bearer <access-token>"
"X-Tenant-ID" = "<tenant-id>"
"Content-Type" = "application/json"
}
$body = '{
"beginDate": "2012-06-26T11:55:36.100Z",
"endDate": "2012-06-26T11:55:36.100Z",
"fields": [
"reason"
],
"pageFromKey": "string",
"pageSize": 50,
"sort": [
"quarantinedAt:DESC"
],
"filter": {
"id": "15a7f8ea-691c-4f03-862e-3cefb102818e",
"fromContains": "some text",
"toContains": "some text",
"subjectContains": "some text",
"attachmentNameContains": "some text",
"sizeInMBGreaterThan": 1,
"sizeInMBLowerThan": 2,
"direction": "inbound",
"productType": "mailflow",
"reason": [
"impersonation"
],
"hasAnyAttachment": false
}
}'
Invoke-RestMethod -Method POST -Uri "https://api-<data-region>.central.sophos.com/email/v1/quarantine/messages/search" -Headers $headers -Body $body -ContentType "application/json"
package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
req, err := http.NewRequest("POST", "https://api-<data-region>.central.sophos.com/email/v1/quarantine/messages/search", strings.NewReader(`{
"beginDate": "2012-06-26T11:55:36.100Z",
"endDate": "2012-06-26T11:55:36.100Z",
"fields": [
"reason"
],
"pageFromKey": "string",
"pageSize": 50,
"sort": [
"quarantinedAt:DESC"
],
"filter": {
"id": "15a7f8ea-691c-4f03-862e-3cefb102818e",
"fromContains": "some text",
"toContains": "some text",
"subjectContains": "some text",
"attachmentNameContains": "some text",
"sizeInMBGreaterThan": 1,
"sizeInMBLowerThan": 2,
"direction": "inbound",
"productType": "mailflow",
"reason": [
"impersonation"
],
"hasAnyAttachment": false
}
}`))
if err != nil {
panic(err)
}
req.Header.Set("Authorization", "Bearer <access-token>")
req.Header.Set("X-Tenant-ID", "<tenant-id>")
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}
const response = await fetch("https://api-<data-region>.central.sophos.com/email/v1/quarantine/messages/search", {
method: "POST",
headers: {
"Authorization": "Bearer <access-token>",
"X-Tenant-ID": "<tenant-id>",
"Content-Type": "application/json",
},
body: JSON.stringify({
"beginDate": "2012-06-26T11:55:36.100Z",
"endDate": "2012-06-26T11:55:36.100Z",
"fields": [
"reason"
],
"pageFromKey": "string",
"pageSize": 50,
"sort": [
"quarantinedAt:DESC"
],
"filter": {
"id": "15a7f8ea-691c-4f03-862e-3cefb102818e",
"fromContains": "some text",
"toContains": "some text",
"subjectContains": "some text",
"attachmentNameContains": "some text",
"sizeInMBGreaterThan": 1,
"sizeInMBLowerThan": 2,
"direction": "inbound",
"productType": "mailflow",
"reason": [
"impersonation"
],
"hasAnyAttachment": false
}
}),
});
const data = await response.json();
console.log(data);
Responses¶
200 — Quarantined messages.¶
Response fields
pagesobjectrequiredShow child attributesHide child attributes
fromKeystringThe key of the first item in the returned page.
nextKeystringThe key to use when fetching the next page.
sizeintegerrequiredThe size of the page being returned.
totalinteger(Optional) The total number of pages that exist, if pageTotal=true in the request.
itemsinteger(Optional) The total number of items on all the pages, if pageTotal=true was passed into the request.
maxSizeintegerrequiredThe maximum page size that can be requested.
itemsarray of objectrequiredList of quarantined messages.
Must contain at most 100 items.
Must contain at most 100 items.
Why the message was quarantined.
Show child attributesHide child attributes
idstring (uuid)requiredID from 'X-Sophos-Email-ID' MIME header.
mimeMessageIdstringID from 'message-id' MIME header.
envelopeSenderobjectEmail address and optional display name.
Show child attributesHide child attributes
namestringName of the sender or recipient.
localAddressstringrequiredLocal part of the mail address of the sender or recipient.
domainAddressstringrequiredDomain part of the mail address of the sender or recipient.
envelopeRecipientsarray of objectList of envelope email addresses.
Email address and optional display name.
Show child attributesHide child attributes
namestringName of the sender or recipient.
localAddressstringrequiredLocal part of the mail address of the sender or recipient.
domainAddressstringrequiredDomain part of the mail address of the sender or recipient.
fromobjectEmail address and optional display name.
Show child attributesHide child attributes
namestringName of the sender or recipient.
localAddressstringrequiredLocal part of the mail address of the sender or recipient.
domainAddressstringrequiredDomain part of the mail address of the sender or recipient.
toarray of objectList of email addresses listed in 'To' MIME header.
Email address and optional display name.
Show child attributesHide child attributes
namestringName of the sender or recipient.
localAddressstringrequiredLocal part of the mail address of the sender or recipient.
domainAddressstringrequiredDomain part of the mail address of the sender or recipient.
ccarray of objectList of email addresses listed in 'Cc' MIME header.
Email address and optional display name.
Show child attributesHide child attributes
namestringName of the sender or recipient.
localAddressstringrequiredLocal part of the mail address of the sender or recipient.
domainAddressstringrequiredDomain part of the mail address of the sender or recipient.
subjectstringMessage subject.
directionstringrequiredMust be one of:
inbound, outbound.sizeInBytesnumberMessage size, in bytes.
clientIpstringIP address from where the message was sent.
sentAtstring (date-time)Time from 'Date' MIME header.
receivedAtstring (date-time)Time the message was received by Sophos Email.
quarantinedAtstring (date-time)Time the message was quarantined.
productTypestringEmail product.
Must be one of:
Must be one of:
mailflow, gateway, ems.attachmentsobjectShow child attributesHide child attributes
totalintegerrequiredTotal number of attachments found in the message.
sizeintegerrequiredNumber of attachments.
itemsarray of objectrequiredMust contain at most 100 items.
Attachment details.
Show child attributesHide child attributes
namestringAttachment name.
sizeInBytesnumberAttachment size, in bytes.
fileTypestringAttachment type.
strippedbooleanWhether the attachment has been stripped from the message.
forRecipientstringrequiredEmail address for the quarantined message.
reasonstringrequiredReason for action.
Must be one of:
Must be one of:
bulk, dataControl, dkim, dmarc, headerAnomaly, domainAnomaly, impersonation, intelixMalicious, intelixSuspicious, intelixUnscannable, maliciousUrl, malware, s/mime, spam, spf, suspectedSpam, unscannable, countrySpam, languageSpam, batvSpam, nrdSpam.reasonDetailstringMore information about the cause.
Errors¶
| Status | Meaning |
|---|---|
400 | Bad request. |
500 | Unexpected error. |
All error responses share the same shape — see the error response object.
Response examples¶
200¶
{
"pages": {
"fromKey": "string",
"nextKey": "string",
"size": 0,
"total": 0,
"items": 0,
"maxSize": 0
},
"items": [
{
"id": "15a7f8ea-691c-4f03-862e-3cefb102818e",
"mimeMessageId": "<15a7f8ea-691c-4f03-862e-3cefb102818e>",
"envelopeSender": {
"name": "Alice",
"localAddress": "user_alice",
"domainAddress": "example.com"
},
"envelopeRecipients": [
{
"name": "Alice",
"localAddress": "user_alice",
"domainAddress": "example.com"
}
],
"from": {
"name": "Alice",
"localAddress": "user_alice",
"domainAddress": "example.com"
},
"to": [
{
"name": "Alice",
"localAddress": "user_alice",
"domainAddress": "example.com"
}
],
"cc": [
{
"name": "Alice",
"localAddress": "user_alice",
"domainAddress": "example.com"
}
],
"subject": "This is the subject of the email",
"direction": "inbound",
"sizeInBytes": "4134",
"clientIp": "10.223.0.45",
"sentAt": "2012-05-26T11:55:36.100Z",
"receivedAt": "2012-05-26T11:55:36.100Z",
"quarantinedAt": "2012-05-26T11:55:36.100Z",
"productType": "mailflow",
"attachments": {
"total": 50,
"size": 25,
"items": [
{
"name": "photo.png",
"sizeInBytes": 374427,
"fileType": "image",
"stripped": false
}
]
},
"forRecipient": "user_alice@domain.com",
"reason": "impersonation",
"reasonDetail": "{\"impersonationType\" : \"BRAND\"}"
}
]
}
See the guide for a narrative walkthrough of this API.