3.3 Retrieving scan history

Request

Value

Method

GET

URL

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

Summary

Look up the scan history of a hash by MD5, SHA1, or SHA256. The scan history is paginated for easy consumption because some scan histories have hundreds of entries.

Request

URL Parameters

 

Description

Example

:hash

MD5, SHA1, or SHA256 of a file

6A5C19D9FFE8804586E8F4C0DFCC66DE

Header Parameters

 

Description

Allowed Values

Required

apikey

gives rights to use the endpoint (token authentication) (API Authentication Mechanisms)

apikey

YES

Query Parameters

 

Description

Allowed Values

Default

Required

limit

Pagination - How many entries to return

Number

0

NO

offset

Pagination - How many entries to skip (sorted chronologically)

Number

0

NO

Response

HTTP Status Codes

Please refer to Status Codes for more information.

Body

Example of a successful request (offset = 0, limit = 3:

{
"md5": "6A5C19D9FFE8804586E8F4C0DFCC66DE",
"sha1": "016CD548A5BA78015F85E2591BF6189658ACA066",
"sha256": "BE41E36233DD8DB2B28A109E7FC7C409E1353BF2D1710158BBE267280E163353",
"scan_result_history": [
{
"total_detected_avs": 15,
"total_avs": 37,
"scan_all_result_i": 1,
"start_time": "2019-02-26T21:53:32.770Z",
"data_id": "ZTE3MDgyMkh5UmZGTl94cV9aUzFsSWU3aGtVNA"
},
{
"total_detected_avs": 15,
"total_avs": 37,
"scan_all_result_i": 1,
"start_time": "2019-02-25T23:05:26.628Z",
"data_id": "ZTE3MDgyMkh5UmZGTl94cV9aQnlPR2RaUFJIRQ"
},
{
"total_detected_avs": 15,
"total_avs": 37,
"scan_all_result_i": 1,
"start_time": "2019-02-24T09:10:11.792Z",
"data_id": "ZTE3MDgyMkh5UmZGTl94cV9aSHlneFNneHphQlY"
}
]
}

Example of a failed request:

{
"error": {
"code": 404003,
"messages": [
"The hash was not found"
]
}
}

Descriptions of response:

scan_result_history.scan_all_result_i

The scan returned code. Please refer to Description on scan result codes for more information.

scan_result_history.start_time

The time when the scan has started

scan_result_history.total_avs

The total number of AVs returned in the result

scan_result_history.total_detected_avs

The total number of AVs reporting this file as infected

scan_result_history.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": "GET",
"hostname": [
"api",
"metadefender",
"com"
],
"path": [
"v4",
"hash",
"6A5C19D9FFE8804586E8F4C0DFCC66DE",
"scanhistory"
],
"headers": {
"apikey": process.env.APIKEY
}
};
 
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.end();

Sample code (cURL)

curl -X GET \
https://api.metadefender.com/v4/hash/6A5C19D9FFE8804586E8F4C0DFCC66DE/scanhistory \
-H "apikey: ${APIKEY}"