3.2 Retrieving scan reports for multiple data hashes

Request

Value

Method

POST

URL

https://api.metadefender.com/v4/hash

Throttled

Yes

Summary

Bulk lookup of scan results based on MD5, SHA1, or SHA256.

Request

Header Parameters

 

Description

Allowed Values

Required

apikey

Gives rights to use the endpoint (API Authentication Mechanisms)

apikey

YES

Content-Type

Specify the http content type

application/json

NO

includescandetails

Include scan details.

Default value: 0

0 - get only hashes

1 - get hash details also

NO

Body (payload)

The maximum number of hashes to be retrieved in 1 request is 1000.

 

Format

Required

Example

HTTP Body

json

YES

{
"hash": ["8F7920DA1D52B06A61D7A41C51D595AC", "AA73B43084E93E741552E5B9C8DEE457", "3433B43084EABC741552E52AD8DEE457"]
}

Response

HTTP Status Codes

Please refer to Status Codes for more information.

Body

Example of a successful request:

{
"data": [
{
"data_id": "ZDE3MTEyOEJrUW9fVTljeEdIa1ZpX0k1OWd6",
"scan_result_i": 0,
"hash": "8F7920DA1D52B06A61D7A41C51D595AC",
"total_detected_avs": 0
},
{
"data_id": "bzE3MTAyMEJ5R3hKbG13dmFiQkpmZU5NdjdTU0U",
"scan_result_i": 1,
"hash": "AA73B43084E93E741552E5B9C8DEE457",
"total_detected_avs": 33
},
{
"data_id": null,
"hash": "3433B43084EABC741552E52AD8DEE457",
"scan_result_i": 5,
"total_detected_avs": -1
}
]
}

A "scan_result_i" value of "5" means the hash is not found, or it is invalid.

Example of a successful request:

include_scan_details = 1

{
"data": [
{
"data_id": "ZDE3MTEyOEJrUW9fVTljeEdIa1ZpX0k1OWd6",
"scan_result_i": 0,
"hash": "8F7920DA1D52B06A61D7A41C51D595AC",
"scan_details": {
"Vir_IT eXplorer": {
"wait_time": 1189,
"threat_found": "",
"scan_time": 539,
"scan_result_i": 0,
"def_time": "2017-11-27T13:28:00.000Z"
},
"nProtect": {
"wait_time": 1403,
"threat_found": "",
"scan_time": 324,
"scan_result_i": 0,
"def_time": "2017-11-28T05:00:00.000Z"
},
"Zoner": {
"wait_time": 1336,
"threat_found": "",
"scan_time": 392,
"scan_result_i": 0,
"def_time": "2017-11-28T00:00:00.000Z"
},
"Zillya!": {
"wait_time": 62,
"threat_found": "",
"scan_time": 270,
"scan_result_i": 0,
"def_time": "2017-11-24T12:16:00.000Z"
},
"Avira": {
"scan_result_i": 0,
"threat_found": "",
"def_time": "2015-11-11T08:00:00.000Z",
"scan_time": 172,
"scan_result": "Clean"
},
...
}
]

Example of input body being empty:

{
"error": {
"code": 400062,
"messages": [
"The `hash` field is empty"
]
}
}

Descriptions of response:

scan_result

The newest final scan result of hash.

data_id

Unique identifier for this particular scan of the file.

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",
"hash"
],
"headers": {
"apikey": process.env.APIKEY,
"includescandetails": "1"
}
};
 
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("{\n \"hash\": [\"8F7920DA1D52B06A61D7A41C51D595AC\", \"AA73B43084E93E741552E5B9C8DEE457\", \"3433B43084EABC741552E52AD8DEE457\"]\n}");
req.end();

Sample code (cURL)

curl -X POST \
https://api.metadefender.com/v4/hash \
-H "apikey: ${APIKEY}"
-H 'includescandetails: 1' \
-d '{
"hash": ["8F7920DA1D52B06A61D7A41C51D595AC", "AA73B43084E93E741552E5B9C8DEE457", "3433B43084EABC741552E52AD8DEE457"]
}'