6.1 Data Sanitization Request

Request

Value

Method

POST

URL

https://api.metadefender.com/v2/file

Throttled

Yes

Summary

Retrieve scan status and data sanitization results after uploading a file.

Data sanitization is supported for the following file types: PDF, DOC(X/M), DOT(X/M), XLS(B/X/M), PPT(X/M), PPSX, RTF, BMP, PNG, JPG/JPEG, EPS, GIF, SVG, TIF(F), HTM/HTML, XML, HWP, JTD, OTD, DWG.

Initiate Data Sanitization Request

On MetaDefender Cloud, scans and data sanitization requests are performed asynchronously, and each scan request is tracked by a data ID. For initiating data sanitization, use the same endpoint that is used for File scan: POST /v2/file and add additional header user_agent and value mcl-metadefender-rest-sanitize-disabled-unarchive: Scanning a file by file upload.

Private scanning does not work with sanitization. When sanitizing a file, even if the file is uploaded with "samplesharing: 0" header, we will keep a copy of the sanitized version of the file for the user to download.

Response

Body

Example of successful scan request with data sanitization

{
"file_id":"ZzE2MTEyMnIxY2xHaGtWek14",
"data_id":"ZzE2MTEyMnIxY2xHaGtWek14UzFzbHpuMUV6Zmc",
"sanitized":{
"file_path":"https://s3-us-west-2.amazonaws.com/g.files.metadefender.com/dt%3D161122/r1clGhkVzMx.sanitized?AWSAccessKeyId=AKIAJATVWRQL5FM5ZFNQ&Expires=1479850861&Signature=OaQI5T8PshJh6iTESFj%2FZUfXNHk%3D&response-content-disposition=attachment%3B%20filename%3DScreenshot%20from%202016-11-22%20125042.png",
"data_id":"ZzE2MTEyMnIxY2xHaGtWek14cjEyaHlFR01n",
"result":"Allowed"
},
"scan_results":{
"scan_details":{
"Ahnlab":{
"threat_found":"",
"scan_result_i":0,
"def_time":"2016-11-22T00:00:00Z",
"scan_time":78
},
"Antiy":{
"threat_found":"",
"scan_result_i":3,
"def_time":"2016-11-07T00:00:00Z",
"scan_time":0
},
"Avira":{
"threat_found":"",
"scan_result_i":0,
"def_time":"2016-11-22T00:00:00Z",
"scan_time":63
},
"Fortinet":{
"threat_found":"",
"scan_result_i":0,
"def_time":"2016-11-22T00:00:00Z",
"scan_time":735
},
"F-prot":{
"threat_found":"",
"scan_result_i":0,
"def_time":"2016-11-22T00:00:00Z",
"scan_time":750
},
"Ikarus":{
"threat_found":"",
"scan_result_i":0,
"def_time":"2016-11-22T00:00:00Z",
"scan_time":344
},
"K7":{
"threat_found":"",
"scan_result_i":0,
"def_time":"2016-11-22T00:00:00Z",
"scan_time":63
},
"McAfee":{
"threat_found":"",
"scan_result_i":0,
"def_time":"2016-11-22T00:00:00Z",
"scan_time":735
},
"nProtect":{
"threat_found":"",
"scan_result_i":0,
"def_time":"2016-11-22T00:00:00Z",
"scan_time":782
},
"Preventon":{
"threat_found":"",
"scan_result_i":0,
"def_time":"2016-11-22T00:00:00Z",
"scan_time":735
},
"QuickHeal":{
"threat_found":"",
"scan_result_i":0,
"def_time":"2016-11-22T00:00:00Z",
"scan_time":63
},
"Sophos":{
"threat_found":"",
"scan_result_i":0,
"def_time":"2016-11-22T00:00:00Z",
"scan_time":78
},
"TotalDefense":{
"threat_found":"",
"scan_result_i":0,
"def_time":"2016-11-22T00:00:00Z",
"scan_time":47
},
"Zillya!":{
"threat_found":"",
"scan_result_i":0,
"def_time":"2016-11-22T00:00:00Z",
"scan_time":266
},
"Zoner":{
"threat_found":"",
"scan_result_i":0,
"def_time":"2016-11-21T00:00:00Z",
"scan_time":782
},
"AegisLab":{
"threat_found":"",
"scan_result_i":0,
"def_time":"2016-11-22T00:00:00Z",
"scan_time":1516
},
"Agnitum":{
"threat_found":"",
"scan_result_i":0,
"def_time":"2016-11-22T00:00:00Z",
"scan_time":844
},
"AVG":{
"threat_found":"",
"scan_result_i":0,
"def_time":"2016-11-22T00:00:00Z",
"scan_time":938
},
"Baidu":{
"threat_found":"",
"scan_result_i":0,
"def_time":"2016-11-22T00:00:00Z",
"scan_time":1531
},
"BitDefender":{
"threat_found":"",
"scan_result_i":0,
"def_time":"2016-11-22T00:00:00Z",
"scan_time":938
},
"ByteHero":{
"threat_found":"",
"scan_result_i":0,
"def_time":"2016-11-22T00:00:00Z",
"scan_time":844
},
"ClamAV":{
"threat_found":"",
"scan_result_i":0,
"def_time":"2016-11-22T00:00:00Z",
"scan_time":985
},
"CYREN":{
"threat_found":"",
"scan_result_i":0,
"def_time":"2016-11-22T00:00:00Z",
"scan_time":891
},
"DrWebGateway":{
"threat_found":"",
"scan_result_i":0,
"def_time":"2016-11-22T00:00:00Z",
"scan_time":844
},
"Emsisoft":{
"threat_found":"",
"scan_result_i":0,
"def_time":"2016-11-22T00:00:00Z",
"scan_time":453
},
"ESET":{
"threat_found":"",
"scan_result_i":0,
"def_time":"2016-11-22T00:00:00Z",
"scan_time":750
},
"Filseclab":{
"threat_found":"",
"scan_result_i":0,
"def_time":"2016-11-05T00:00:00Z",
"scan_time":1063
},
"F-secure":{
"threat_found":"",
"scan_result_i":0,
"def_time":"2016-11-22T00:00:00Z",
"scan_time":1360
},
"Hauri":{
"threat_found":"",
"scan_result_i":0,
"def_time":"2016-11-22T00:00:00Z",
"scan_time":844
},
"Jiangmin":{
"threat_found":"",
"scan_result_i":0,
"def_time":"2016-11-22T00:00:00Z",
"scan_time":1766
},
"Microsoft":{
"threat_found":"",
"scan_result_i":0,
"def_time":"2016-11-21T00:00:00Z",
"scan_time":985
},
"NANOAV":{
"threat_found":"",
"scan_result_i":0,
"def_time":"2016-11-22T00:00:00Z",
"scan_time":985
},
"SUPERAntiSpyware":{
"threat_found":"",
"scan_result_i":0,
"def_time":"2016-11-22T00:00:00Z",
"scan_time":1797
},
"Symantec":{
"threat_found":"",
"scan_result_i":0,
"def_time":"2016-11-22T00:00:00Z",
"scan_time":797
},
"ThreatTrack":{
"threat_found":"",
"scan_result_i":0,
"def_time":"2016-11-22T00:00:00Z",
"scan_time":922
},
"TrendMicro":{
"threat_found":"",
"scan_result_i":0,
"def_time":"2016-11-22T00:00:00Z",
"scan_time":1078
},
"TrendMicroHouseCall":{
"threat_found":"",
"scan_result_i":0,
"def_time":"2016-11-21T00:00:00Z",
"scan_time":1438
},
"VirITeXplorer":{
"threat_found":"",
"scan_result_i":0,
"def_time":"2016-11-22T00:00:00Z",
"scan_time":844
},
"VirusBlokAda":{
"threat_found":"",
"scan_result_i":0,
"def_time":"2016-11-22T00:00:00Z",
"scan_time":922
},
"Xvirus":{
"threat_found":"",
"scan_result_i":0,
"def_time":"2016-11-16T00:00:00Z",
"scan_time":1016
},
"Lavasoft":{
"threat_found":"",
"scan_result_i":0,
"def_time":"2016-11-22T00:00:00Z",
"scan_time":4016
},
"STOPzilla":{
"threat_found":"",
"scan_result_i":0,
"def_time":"2016-11-21T00:00:00Z",
"scan_time":4969
}
},
"rescan_available":true,
"data_id":"ZzE2MTEyMnIxY2xHaGtWek14UzFzbHpuMUV6Zmc",
"scan_all_result_i":0,
"start_time":"2016-11-22T20:50:49.751Z",
"total_time":4969,
"total_avs":42,
"total_detected_avs":0,
"progress_percentage":100,
"in_queue":0,
"scan_all_result_a":"Clean"
},
"file_info":{
"file_size":568086,
"upload_timestamp":"2016-11-22T20:50:49.751Z",
"md5":"86E434EB0D2528F597080903BDDB076B",
"sha1":"D59C0A38DA1FD246ABAC51887B67EA41CCF448E3",
"sha256":"BCE92B0054542C1A0B2DAD22BD9FC044ABCF5F232FFCAFA33950E5AC652DF2E6",
"file_type_category":"G",
"file_type_description":"Portable Network Graphics",
"file_type_extension":"png",
"display_name":"Screenshot from 2016-11-22 125042.png"
},
"top_threat":-1
}

Errors

Please refer to Errors for more information.

Sample code (Node.js)

var request = require('request');
var fs = require("fs");
 
var formData = {
file: fs.createReadStream(__dirname + '/file')
};
 
request.post({
url: 'https://scan.metadefender.com/v2/file',
formData: formData,
headers: {
apikey: process.env.APIKEY,
user_agent: 'mcl-metadefender-rest-sanitize-disabled-unarchive'
}
},
function(err, httpResponse, body) {
if (err) {
return console.error('upload failed:', err);
}
console.log(body);
}
);

Sample code (cURL)

curl -X POST --data-binary "@my_file.dat" \
https://api.metadefender.com/v2/file \
-H 'apikey: ${APIKEY}' \
-H 'user_agent: mcl-metadefender-rest-sanitize-disabled-unarchive'