> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://uploadcare.com/docs/llms.txt.

# Execute ClamAV

POST https://api.uploadcare.com/addons/uc_clamav_virus_scan/execute/
Content-Type: application/json

Execute [ClamAV](https://www.clamav.net/) virus checking Add-On for a given target.

Reference: https://uploadcare.com/docs/api/rest/add-ons/uc-clamav-virus-scan-execute

## Authentication

- `Authorization` header (required) — Every request made to `https://api.uploadcare.com/` MUST be signed. HTTPS SHOULD be used with any authorization scheme. Requests MUST contain the `Authorization` header defining `auth-scheme` and `auth-param`: `Authorization: auth-scheme auth-param`. Every request MUST contain the `Accept` header identifying the REST API version: `Accept: application/vnd.uploadcare-v0.7+json`. There are two available authorization schemes: * For production: `Uploadcare`, a scheme where a `signature`, not your Secret API Key MUST be specified. Signatures SHOULD be generated on backend. * For quick tests: `Uploadcare.Simple`, a simple scheme where your [Secret API Key](https://app.uploadcare.com/projects/-/api-keys/) MUST be specified in every request's `auth-param`.

## Request

### Headers

- `Accept` (string, required) — Version header.

### Body (application/json)

This endpoint expects an object.

- `target` (string, required) — Unique ID of the file to process
- `params` (AddonsUcClamavVirusScanExecutePostRequestBodyContentApplicationJsonSchemaParams, optional, default: {}) — Optional object with Add-On specific parameters

## Response

### 200

Add-On execution response.

- `request_id` (string, optional) — Request ID.

## Errors

### 400 Bad Request Error

Simple authentication over HTTP is forbidden. Please, use HTTPS or signed requests instead.

- `detail` (string, optional, default: Simple authentication over HTTP is forbidden. Please, use HTTPS or signed requests instead.)

### 401 Unauthorized Error

Authorization errors.

- `detail` (enum, optional)
  - Allowed values: `Incorrect authentication credentials.`, `Public key {public_key} not found.`, `Secret key not found.`, `Invalid signature. Please check your Secret key.`

### 406 Not Acceptable Error

Invalid version header `Accept` for this endpoint.

- `detail` (string, optional, default: Incorrect Accept header provided. Make sure to specify API version. Refer to REST API docs for details.)

### 409 Conflict Error

Add-On concurrent call attempt.

- `detail` (string, optional, default: Concurrent call attempted)

### 429 Too Many Requests Error

Request was throttled.

- `detail` (string, optional)

## Types

### AddonsUcClamavVirusScanExecutePostRequestBodyContentApplicationJsonSchemaParams

Optional object with Add-On specific parameters

- `purge_infected` (boolean, optional) — Purge infected file.

## Examples

**Request**

```json
{
  "target": "21975c81-7f57-4c7a-aef9-acfe28779f78"
}
```

**Response**

```json
{
  "request_id": "8db3c8b4-2dea-4146-bcdb-63387e2b33c1"
}
```

**SDK Code**

```javascript JS
import {
  executeAddon,
  AddonName,
  UploadcareSimpleAuthSchema,
} from '@uploadcare/rest-client';

const uploadcareSimpleAuthSchema = new UploadcareSimpleAuthSchema({
  publicKey: 'YOUR_PUBLIC_KEY',
  secretKey: 'YOUR_SECRET_KEY',
});

const result = await executeAddon(
  {
    addonName: AddonName.UC_CLAMAV_VIRUS_SCAN,
    target: '1bac376c-aa7e-4356-861b-dd2657b5bfd2',
  },
  { authSchema: uploadcareSimpleAuthSchema }
)

```

```php PHP
<?php
$configuration = Uploadcare\Configuration::create((string) $_ENV['UPLOADCARE_PUBLIC_KEY'], (string) $_ENV['UPLOADCARE_SECRET_KEY']);

$api = (new Uploadcare\Api($configuration))->addons();
$resultKey = $api->requestAntivirusScan('21975c81-7f57-4c7a-aef9-acfe28779f78');
echo \sprintf('Antivirus scan requested. Key is \'%s\'', $resultKey);

```

```python Python
from pyuploadcare import Uploadcare
uploadcare = Uploadcare(public_key='YOUR_PUBLIC_KEY', secret_key='YOUR_SECRET_KEY')

clamav_params = AddonClamAVExecutionParams(purge_infected=True)
target_file = uploadcare.file("1bac376c-aa7e-4356-861b-dd2657b5bfd2")
clamav_result = uploadcare.addons_api.execute(
    target_file.uuid,
    AddonLabels.CLAM_AV,
    clamav_params
)

```

```ruby Ruby
require 'uploadcare'
Uploadcare.config.public_key = 'YOUR_PUBLIC_KEY'
Uploadcare.config.secret_key = 'YOUR_SECRET_KEY'

uuid = '1bac376c-aa7e-4356-861b-dd2657b5bfd2'
Uploadcare::Addons.uc_clamav_virus_scan(uuid, purge_infected: true)

```

```swift Swift
import Uploadcare

let uploadcare = Uploadcare(withPublicKey: "YOUR_PUBLIC_KEY", secretKey: "YOUR_SECRET_KEY")

let parameters = ClamAVAddonExecutionParams(purgeInfected: true)
let response = try await uploadcare.executeClamav(fileUUID: "1bac376c-aa7e-4356-861b-dd2657b5bfd2", parameters: parameters)
print(response) // contains requestID

// Execute and wait for completion:
let status = try await uploadcare.performClamav(fileUUID: "1bac376c-aa7e-4356-861b-dd2657b5bfd2", parameters: parameters)
print(status)

```

```kotlin Kotlin
import com.uploadcare.android.library.api.UploadcareClient

val uploadcare = UploadcareClient(publicKey = "YOUR_PUBLIC_KEY", secretKey = "YOUR_SECRET_KEY")

val addOn = ClamAVAddOn(uploadcare)
val response = addOn.execute(fileId = "1bac376c-aa7e-4356-861b-dd2657b5bfd2")
Log.d("TAG", response.toString())

```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.uploadcare.com/addons/uc_clamav_virus_scan/execute/"

	payload := strings.NewReader("{\n  \"target\": \"21975c81-7f57-4c7a-aef9-acfe28779f78\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Accept", "application/vnd.uploadcare-v0.7+json")
	req.Header.Add("Authorization", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.uploadcare.com/addons/uc_clamav_virus_scan/execute/")
  .header("Accept", "application/vnd.uploadcare-v0.7+json")
  .header("Authorization", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"target\": \"21975c81-7f57-4c7a-aef9-acfe28779f78\"\n}")
  .asString();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.uploadcare.com/addons/uc_clamav_virus_scan/execute/");
var request = new RestRequest(Method.POST);
request.AddHeader("Accept", "application/vnd.uploadcare-v0.7+json");
request.AddHeader("Authorization", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"target\": \"21975c81-7f57-4c7a-aef9-acfe28779f78\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```