Download attachments¶
POST/
Email Management API · Post-Delivery Quarantine
Download one ore more attachments.
Parameters¶
| Name | In | Type | Required | Description |
|---|---|---|---|---|
X-Tenant-ID | header | string (uuid) | Yes | Tenant ID. |
id | path | string (uuid) | Yes | ID from 'X-Sophos-Email-ID' header. |
Request body¶
Content type: application/json
Request body fields
attachmentsarray of stringList of attachments to download. If you don't specify which to download, all the attachments in the message are downloaded.
Request samples¶
curl -X POST "https://api-<data-region>.central.sophos.com/email/v1/post-delivery-quarantine/messages/<id>/attachments/download" -H "Authorization: Bearer <access-token>" -H "X-Tenant-ID: <tenant-id>" -H "Content-Type: application/json" -d "{
\"attachments\": [
\"employee.xslx\"
]
}"
import requests
response = requests.post(
"https://api-<data-region>.central.sophos.com/email/v1/post-delivery-quarantine/messages/<id>/attachments/download",
headers={
"Authorization": "Bearer <access-token>",
"X-Tenant-ID": "<tenant-id>",
"Content-Type": "application/json",
},
json={'attachments': ['employee.xslx']},
)
print(response.json())
$headers = @{
"Authorization" = "Bearer <access-token>"
"X-Tenant-ID" = "<tenant-id>"
"Content-Type" = "application/json"
}
$body = '{
"attachments": [
"employee.xslx"
]
}'
Invoke-RestMethod -Method POST -Uri "https://api-<data-region>.central.sophos.com/email/v1/post-delivery-quarantine/messages/<id>/attachments/download" -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/post-delivery-quarantine/messages/<id>/attachments/download", strings.NewReader(`{
"attachments": [
"employee.xslx"
]
}`))
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/post-delivery-quarantine/messages/<id>/attachments/download", {
method: "POST",
headers: {
"Authorization": "Bearer <access-token>",
"X-Tenant-ID": "<tenant-id>",
"Content-Type": "application/json",
},
body: JSON.stringify({
"attachments": [
"employee.xslx"
]
}),
});
const data = await response.json();
console.log(data);
Responses¶
200 — Download job created.¶
Response fields
idstring (uuid)requiredDownload job ID.
statusstringrequiredStatus of download request.
Must be one of:
Must be one of:
processing, completed, failed.attachmentsarray of stringList of attachments in the download job. Available when status is completed.
urlstringLocation where the requested files are available for download. Available when status is completed.
passwordstringDownloaded zip file is password protected.
errorstringFailure reason.
Errors¶
| Status | Meaning |
|---|---|
400 | Bad request. |
404 | Not found. |
500 | Unexpected error. |
All error responses share the same shape — see the error response object.
Response examples¶
200¶
{
"id": "15a7f8ea-691c-4f03-862e-3cefb102818e",
"status": "processing",
"attachments": [
"employee.xslx"
],
"url": "https://sample-bucket.s3.eu-west-1.amazonaws.com/messages/0000/61b0588b939b8a0edced1fa7.zip",
"password": "ba9b5812800048548195c3616da998e0",
"error": "attachmentNotFound"
}
See the guide for a narrative walkthrough of this API.