3.4 File Badge

Request

Value

Method

GET

URL

https://api.metadefender.com/v4/hash/:hash/badge?size&type

Feature release date

22 Nov 2018

Summary

API for retrieving scan result images, called "badges", which reflect the scan result status of a particular hash. If the hash was scanned by MetaDefender Cloud and there was no threat detected, the "No threat detected" badge will be returned (see a preview below in the "Response" "Body" section). If the hash was detected as infected, the "Threat detected" badge will be returned. If the hash was never scanned by MetaDefender Cloud, the "No information available" badge is displayed.

The point of these badges is to integrate them in your website or application in order to increase the confidence of files provided. For example, a website that offers a software installer package will show this badge with the scan results of the installer saying (ideally) that the file is clean. Here is an html sample code showing the recommended way of integrating this functionality:

Endpoint integration
<a href="https://metadefender.opswat.com/results#!/file/<:your hash>/hash/overview" target="_blank" rel="noopener">
<img src="https://api.metadefender.com/v4/hash/<:your hash>/badge?size=medium&type=svg"/>
</a>

Obtaining the badge is straightforward, just compose the URL with the hash of the file, and specify badge type (size and image format). In order for the site visitors to be able to get more information about the scan results of the file, insert the image into an <a> link tag which will open the scan results page on our website.

The "small" badge size can be used in markdown readme files from code repositories.

Request

URL Parameters

 

Description

Allowed Values

Required

size

Select the image size. Default: small

small | medium

NO

type

Select image type. Default: svg

svg | png | jpg

NO

Response

HTTP Status Codes

Please refer to Status Codes for more information.

Body

"No threat detected" badge (small and medium):

images/download/attachments/26169970/image2018-11-22_18-58-40.png

"Threat detected" badge (small and medium):

"No information available" badge (small and medium):

images/download/thumbnails/26169970/image2018-11-22_17-24-40.png

images/download/attachments/26169970/image2018-11-22_17-53-0.png

Example of error response:

{
"success": false,
"error": {
"code": 400004,
"messages": [
"The query params are not valid"
]
}
}

Errors

Please refer to Errors for more information.

Sample code (cURL)

curl -X GET https://api.metadefender.com/v4/hash/0FCB49E9AA886B072AB50192276BCA010F7AC1D557A82396C9967ECFCE910705/badge?size=medium&type=svg