> For the complete documentation index, see [llms.txt](https://docs.sitebot.com/api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sitebot.com/api/antivirus.md).

# Antivirus

A file to be scanned can be uploaded in the API call or referenced by URL.\
\
This API is billed based on the amount of data scanned.  You may want to lookup the md5 prior to running a scan to optimize costs.

## Perform an antivirus scan on the file located at the url provided.

<mark style="color:blue;">`GET`</mark> `https://api.sitebot.com/api/v1/av/scan-url`

#### Query Parameters

| Name                                  | Type | Description                       |
| ------------------------------------- | ---- | --------------------------------- |
| url<mark style="color:red;">\*</mark> | URL  | The URL of a file to scan.        |
| callback                              | URL  | Send the scan result to this URL. |

#### Headers

| Name                                    | Type   | Description   |
| --------------------------------------- | ------ | ------------- |
| x-key<mark style="color:red;">\*</mark> | String | Your API Key. |

{% tabs %}
{% tab title="200: OK File was successfully downloaded from the URL and scan was initiated." %}

```
{
   size: 11,
   md5: "5eb63bbbe01eeed093cb22bb8f5acdc3"
}
```

{% endtab %}

{% tab title="400: Bad Request See "message" in json response." %}

{% endtab %}
{% endtabs %}

## Perform an antivirus scan on the file uploaded.

<mark style="color:green;">`POST`</mark> `https://api-upload.sitebot.com/api/v1/av/scan-upload`

**Note**: There is a unique hostname for this API endpoint.

#### Headers

| Name                                    | Type   | Description                       |
| --------------------------------------- | ------ | --------------------------------- |
| x-callback                              | URL    | Send the scan result to this URL. |
| x-key<mark style="color:red;">\*</mark> | String | Your API Key.                     |

{% tabs %}
{% tab title="200: OK File was successfully uploaded the scan was initiated." %}

```
{
   size: 11,
   md5: "5eb63bbbe01eeed093cb22bb8f5acdc3"
}
```

{% endtab %}

{% tab title="400: Bad Request See "message" in json response." %}

{% endtab %}
{% endtabs %}

## Lookup the antivirus summary of a md5 checksum.

<mark style="color:blue;">`GET`</mark> `https://api.sitebot.com/api/v1/av/lookup`

A successful lookup will have one of the following status values: "working", "pass", "fail", "error".

#### Query Parameters

| Name                                  | Type   | Description                 |
| ------------------------------------- | ------ | --------------------------- |
| md5<mark style="color:red;">\*</mark> | String | The md5 checksum of a file. |

#### Headers

| Name                                    | Type   | Description   |
| --------------------------------------- | ------ | ------------- |
| x-key<mark style="color:red;">\*</mark> | String | Your API Key. |

{% tabs %}
{% tab title="200: OK Lookup result in json response." %}

```
{
        "md5":"5eb63bbbe01eeed093cb22bb8f5acdc3",
        "size":11,
        "status":3,
        "status_display":"Fail",
        "fail":1,
        "pass":0
}
```

{% endtab %}

{% tab title="400: Bad Request See "message" in json response." %}

{% endtab %}
{% endtabs %}

## Callback URL

An optional callback URL can be provided in the scan-url and scan-upload methods.  When the scan completes the json body of the lookup method will be posted to the callback URL.

## Example URL

```
curl --header "x-key: [YOUR-API-KEY]" \
"https://api.sitebot.com/api/v1/av/scan-url.json?url=[URL-TO-SCAN]&callback=[CALLBACK-URL]"
```

## Example Upload

```
curl --header "x-key: [YOUR-API-KEY]" \
--header "content-type: application/octet-stream" \
--header "x-callback: https://www.mywebsite/rpc/sitebot-callback" \
--data-binary "@/path/to/file" \
"https://api-upload.sitebot.com/api/v1/av/scan-upload"
```
