6.1 Data Sanitization Request
Request |
Value |
Method |
POST |
URL |
https://api.metadefender.com/v4/file |
Throttled |
Yes |
Summary
Retrieve scan status and data sanitization results after uploading a file.
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 /v4/file and add additional header rule and value sanitize: Scanning a file by file upload.
When using private scanning, users have 24h to download the sanitized version of the file before it is permanently deleted.
Response
Body
Example of successful scan request with data sanitization
{
"data_id"
:
"bzIwMDExN1NreHhiOG9RSmJVU2tXeFdJc1FKWjg"
,
"status"
:
"inqueue"
,
"in_queue"
:
1
,
"queue_priority"
:
"normal"
,
"sha1"
:
"068AE4D07A7F4FE2BF955CBA0FD05AB0A5A8A6FE"
,
"sha256"
:
"67C6BCEE6FFCEFA887E415CBF0247C2788696169B58EB66319F558DDB6822D9D"
}
Errors
Please refer to Errors for more information.
Sample code (Node.js)
var http = require(
"https"
);
var options = {
"method"
:
"POST"
,
"hostname"
: [
"api"
,
"metadefender"
,
"com"
],
"path"
: [
"v4"
,
"file"
],
"headers"
: {
"content-type"
:
"multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW"
,
"apikey"
: process.env.APIKEY,
"Content-Type"
:
"multipart/form-data"
,
"rule"
:
"sanitize"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on(
"data"
, function (chunk) {
chunks.push(chunk);
});
res.on(
"end"
, function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(
"------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"\"; filename=\"C:\\Users\\user_name\\Documents\\test_doc.doc\"\r\nContent-Type: application/msword\r\n\r\n\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW--"
);
req.end();
Sample code (cURL)
curl -X POST \
https:
//api.metadefender.com/v4/file \
-H
'Content-Type: multipart/form-data'
\
-H
"apikey: ${APIKEY}"
\
-H
'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW'
\
-H
'rule: sanitize'
\
-F
'=@C:\Users\user_name\Documents\test_doc.doc'