API (self-hosted on AWS): API Definition

ActionHTTP MethodHTTP Resource / Path
Scan URL and return scan resultPOST/api/v1/scan/sync/download
Scan file and return scan resultPOST/api/v1/scan/sync/binary
Scan file and return scan resultPOST/api/v1/scan/sync/form
Scan S3 object and return scan resultPOST/api/v1/scan/sync/s3

Authentication (#)

Accessing the API requires an API key. Pass the API key via an Authorization HTTP header.

The following snippet shows the HTTP header. Replace <API_KEY_PLACEHOLDER> with one of the API keys from the ApiKeys configuration parameter.

Authorization: Bearer <API_KEY_PLACEHOLDER>

Domain name (#)

To get the domain name of your attachmentAV API installation:

  • If the DnsConfiguration configuration parameter is set to AUTO_ROUTE_53, check the DomainName configuration parameter.
  • If the DnsConfiguration configuration parameter is set to MANUAL, check your manual DNS configuration.

Actions (#)

POST /api/v1/scan/sync/download (#)

Download a file from a remote location (HTTP/HTTPS), scan the file, and return the scan result.

The request body is JSON formatted with these properties:

  • download_url (string): URL to download and scan via HTTP(S) GET.
  • download_headers: (object, optional): Headers to send when downloading the file.

The response status code is 200, and the body is JSON formatted with these properties:

  • status (string (clean, infected, no)): The scan result.
  • finding (string, optional): For infected files, the type of virus/malware that was detected.
  • size (number, optional): The file size in bytes.
  • realfiletype (string, optional): The Real File Type detected by the Sophos engine (requires version >= 1.2.0).

Example:

Replace <API_KEY_PLACEHOLDER> with one of the API keys from the ApiKeys configuration parameter. Replace attachmentav.yourcompany.com with the domain name of your attachmentAV API installation.

curl \
  -X POST \
  -H 'Authorization: Bearer <API_KEY_PLACEHOLDER>' \
  -H 'Content-Type: application/json' \
  -d '{"download_url": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"}' \
  'https://attachmentav.yourcompany.com/api/v1/scan/sync/download'

{"status":"clean","size":2903045,"realfiletype":"Adobe Portable Document Format (PDF)"}

Find the latest version of the virus-scan-sdk on Maven Central and add it to the dependencies of your project.

<dependency>
  <groupId>com.attachmentav</groupId>
  <artifactId>virus-scan-sdk</artifactId>
  <version>0.5.0</version>
</dependency>

Replace <API_KEY_PLACEHOLDER> with one of the API keys from the ApiKeys configuration parameter. Replace attachmentav.yourcompany.com with the domain name of your attachmentAV API installation.

import com.attachmentav.api.AttachmentAvApi;
import com.attachmentav.client.ApiClient;
import com.attachmentav.client.ApiException;
import com.attachmentav.client.Configuration;
import com.attachmentav.model.ScanResult;
import com.attachmentav.model.SyncDownloadScanRequest;

// ...

ApiClient client = Configuration.getDefaultApiClient();
client.setBearerToken("<API_KEY_PLACEHOLDER>");
client.setBasePath("https://attachmentav.yourcompany.com/api/v1");
AttachmentAvApi api = new AttachmentAvApi();
SyncDownloadScanRequest request = new SyncDownloadScanRequest();
request.setDownloadUrl("https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf");
ScanResult result = api.scanSyncDownloadPost(request);
System.out.println("Scan Result: " + result.getStatus());

Source: GitHub

Find the latest version of the attachmentav-virus-malware-scan-sdk on PyPI and add it to the dependencies of your project.

pip install attachmentav-virus-malware-scan-sdk

Replace <API_KEY_PLACEHOLDER> with one of the API keys from the ApiKeys configuration parameter. Replace attachmentav.yourcompany.com with the domain name of your attachmentAV API installation.

import attachmentav

configuration = attachmentav.Configuration()
configuration.access_token = "<API_KEY_PLACEHOLDER>"
configuration.host = "https://attachmentav.yourcompany.com/api/v1"

with attachmentav.ApiClient(configuration) as api_client:
  api_instance = attachmentav.AttachmentAVApi(api_client)

sync_download_scan_request = attachmentav.SyncDownloadScanRequest(
  download_url = "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
)
scan_result = api_instance.scan_sync_download_post(sync_download_scan_request)
print(scan_result)

Source: GitHub

Find the latest version of the virus-scan-sdk-ts on npm and add it to the dependencies of your project.

npm i @attachmentav/virus-scan-sdk-ts

Replace <API_KEY_PLACEHOLDER> with one of the API keys from the ApiKeys configuration parameter. Replace attachmentav.yourcompany.com with the domain name of your attachmentAV API installation.

ESM

import { AttachmentAVApi, Configuration } from '@attachmentav/virus-scan-sdk-ts';

const config = new Configuration({
  accessToken: '<API_KEY_PLACEHOLDER>',
  basePath: 'https://attachmentav.yourcompany.com/api/v1'
});

const api = new AttachmentAVApi(config);

const scanResult = await api.scanSyncDownloadPost({
  syncDownloadScanRequest: {
    downloadUrl: 'https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf'
  }
});
console.log('Sync download scan result:', scanResult);

Source: GitHub

CommonJs

const { AttachmentAVApi, Configuration } = require('@attachmentav/virus-scan-sdk-ts');

const config = new Configuration({
  accessToken: '<API_KEY_PLACEHOLDER>',
  basePath: 'https://attachmentav.yourcompany.com/api/v1'
});

const api = new AttachmentAVApi(config);

api.scanSyncDownloadPost({
  syncDownloadScanRequest: {
    downloadUrl: 'https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf'
  }
}).then(scanResult => {
  console.log('Sync download scan result:', scanResult);
});

Source: GitHub

Find the latest version of the virus-scan-sdk-ts on npm and add it to the dependencies of your project.

npm i @attachmentav/virus-scan-sdk-ts

Replace <API_KEY_PLACEHOLDER> with one of the API keys from the ApiKeys configuration parameter. Replace attachmentav.yourcompany.com with the domain name of your attachmentAV API installation.

import { AttachmentAVApi, Configuration } from '@attachmentav/virus-scan-sdk-ts';

const config = new Configuration({
  accessToken: '<API_KEY_PLACEHOLDER>',
  basePath: 'https://attachmentav.yourcompany.com/api/v1'
});

const api = new AttachmentAVApi(config);

const scanResult = await api.scanSyncDownloadPost({
  syncDownloadScanRequest: {
    downloadUrl: 'https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf'
  }
});
console.log('Sync download scan result:', scanResult);

Source: GitHub

POST /api/v1/scan/sync/binary (#)

Upload a file, scan the file, and return the scan result.

The request body contains the binary data (application/octet-stream).

The response status code is 200, and the body is JSON formatted with these properties:

  • status (string (clean, infected, no)): The scan result.
  • finding (string, optional): For infected files, the type of virus/malware that was detected.
  • size (number, optional): The file size in bytes.
  • realfiletype (string, optional): The Real File Type detected by the Sophos engine (requires version >= 1.2.0).

Example:

Replace <API_KEY_PLACEHOLDER> with one of the API keys from the ApiKeys configuration parameter. Replace attachmentav.yourcompany.com with the domain name of your attachmentAV API installation.

curl \
  -X POST \
  -H 'Authorization: Bearer <API_KEY_PLACEHOLDER>' \
  -H 'Content-Type: application/octet-stream' \
  -d '@path/to/file' \
  https://attachmentav.yourcompany.com/api/v1/scan/sync/binary

{"status":"clean","size":73928372,"realfiletype":"Adobe Portable Document Format (PDF)"}

Find the latest version of the virus-scan-sdk on Maven Central and add it to the dependencies of your project.

<dependency>
  <groupId>com.attachmentav</groupId>
  <artifactId>virus-scan-sdk</artifactId>
  <version>0.5.0</version>
</dependency>

Replace <API_KEY_PLACEHOLDER> with one of the API keys from the ApiKeys configuration parameter. Replace attachmentav.yourcompany.com with the domain name of your attachmentAV API installation.

import com.attachmentav.api.AttachmentAvApi;
import com.attachmentav.client.ApiClient;
import com.attachmentav.client.ApiException;
import com.attachmentav.client.Configuration;
import com.attachmentav.model.ScanResult;
import java.io.File;

// ...

ApiClient client = Configuration.getDefaultApiClient();
client.setBearerToken("<API_KEY_PLACEHOLDER>");
client.setBasePath("https://attachmentav.yourcompany.com/api/v1");
AttachmentAvApi api = new AttachmentAvApi();
ScanResult result = api.scanSyncBinaryPost(new File("/path/to/file"));
System.out.println("Scan Result: " + result.getStatus());

Source: GitHub

Find the latest version of the attachmentav-virus-malware-scan-sdk on PyPI and add it to the dependencies of your project.

pip install attachmentav-virus-malware-scan-sdk

Replace <API_KEY_PLACEHOLDER> with one of the API keys from the ApiKeys configuration parameter. Replace attachmentav.yourcompany.com with the domain name of your attachmentAV API installation.

import attachmentav

configuration = attachmentav.Configuration()
configuration.access_token = "<API_KEY_PLACEHOLDER>"
configuration.host = "https://attachmentav.yourcompany.com/api/v1"

with attachmentav.ApiClient(configuration) as api_client:
  api_instance = attachmentav.AttachmentAVApi(api_client)

with open("/path/to/file", "rb") as file:
    file_content = file.read()
    scan_result = api_instance.scan_sync_binary_post(file_content)
    print(scan_result)

Source: GitHub

Find the latest version of the virus-scan-sdk-ts on npm and add it to the dependencies of your project.

npm i @attachmentav/virus-scan-sdk-ts

Replace <API_KEY_PLACEHOLDER> with one of the API keys from the ApiKeys configuration parameter. Replace attachmentav.yourcompany.com with the domain name of your attachmentAV API installation.

ESM

import { AttachmentAVApi, Configuration } from '@attachmentav/virus-scan-sdk-ts';
import { readFileSync } from 'node:fs';
import { Blob } from 'node:buffer';

const config = new Configuration({
  accessToken: '<API_KEY_PLACEHOLDER>',
  basePath: 'https://attachmentav.yourcompany.com/api/v1'
});

const api = new AttachmentAVApi(config);

const scanResult = await api.scanSyncBinaryPost({
  body: new Blob([readFileSync('/path/to/file')])
});
console.log('Sync binary scan result:', scanResult);

Source: GitHub

CommonJs

const { AttachmentAVApi, Configuration } = require('@attachmentav/virus-scan-sdk-ts');
const { readFileSync } = require('node:fs');
const { Blob } = require('node:buffer');

const config = new Configuration({
  accessToken: '<API_KEY_PLACEHOLDER>',
  basePath: 'https://attachmentav.yourcompany.com/api/v1'
});

const api = new AttachmentAVApi(config);

api.scanSyncBinaryPost({
  body: new Blob([readFileSync('/path/to/file')])
}).then(scanResult => {
  console.log('Sync binary scan result:', scanResult);
});

Source: GitHub

Find the latest version of the virus-scan-sdk-ts on npm and add it to the dependencies of your project.

npm i @attachmentav/virus-scan-sdk-ts

Replace <API_KEY_PLACEHOLDER> with one of the API keys from the ApiKeys configuration parameter. Replace attachmentav.yourcompany.com with the domain name of your attachmentAV API installation.

import { AttachmentAVApi, Configuration } from '@attachmentav/virus-scan-sdk-ts';
import { readFileSync } from 'node:fs';
import { Blob } from 'node:buffer';

const config = new Configuration({
  accessToken: '<API_KEY_PLACEHOLDER>',
  basePath: 'https://attachmentav.yourcompany.com/api/v1'
});

const api = new AttachmentAVApi(config);

const scanResult = await api.scanSyncBinaryPost({
  body: new Blob([readFileSync('/path/to/file')])
});
console.log('Sync binary scan result:', scanResult);

Source: GitHub

POST /api/v1/scan/sync/form (#)

Upload a file, scan the file, and return the scan result.

The request body is multipart/form-data formatted and contains one file.

The response status code is 200, and the body is JSON formatted with these properties:

  • status (string (clean, infected, no)): The scan result.
  • finding (string, optional): For infected files, the type of virus/malware that was detected.
  • size (number, optional): The file size in bytes.
  • realfiletype (string, optional): The Real File Type detected by the Sophos engine (requires version >= 1.2.0).

Example:

Replace <API_KEY_PLACEHOLDER> with one of the API keys from the ApiKeys configuration parameter. Replace attachmentav.yourcompany.com with the domain name of your attachmentAV API installation.

curl \
  -H 'Authorization: Bearer <API_KEY_PLACEHOLDER>' \
  -F file=@path/to/file \
  https://attachmentav.yourcompany.com/api/v1/scan/sync/form

{"status":"clean","size":73928372,"realfiletype":"Adobe Portable Document Format (PDF)"}

POST /api/v1/scan/sync/s3 (#)

Download a file from S3, scan the file, and return the scan result.

The request body is JSON formatted with these properties:

  • bucket (string): The bucket name.
  • key (string): The object key.
  • version (string, optional): If versioning is turned on, the object version.

The response status code is 200, and the body is JSON formatted with these properties:

  • status (string (clean, infected, no)): The scan result.
  • finding (string, optional): For infected files, the type of virus/malware that was detected.
  • size (number, optional): The file size in bytes.
  • realfiletype (string, optional): The Real File Type detected by the Sophos engine (requires version >= 1.2.0).

Example:

Replace <API_KEY_PLACEHOLDER> with one of the API keys from the ApiKeys configuration parameter. Replace attachmentav.yourcompany.com with the domain name of your attachmentAV API installation.

curl \
  -X POST \
  -H 'Authorization: Bearer <API_KEY_PLACEHOLDER>' \
  -H 'Content-Type: application/json' \
  -d '{"bucket": "you-bucket", "key": "path/to/file.pdf"}' \
  'https://attachmentav.yourcompany.com/api/v1/scan/sync/s3'

{"status":"clean","size":105255200,"realfiletype":"Adobe Portable Document Format (PDF)"}

Find the latest version of the virus-scan-sdk on Maven Central and add it to the dependencies of your project.

<dependency>
  <groupId>com.attachmentav</groupId>
  <artifactId>virus-scan-sdk</artifactId>
  <version>0.5.0</version>
</dependency>

Replace <API_KEY_PLACEHOLDER> with one of the API keys from the ApiKeys configuration parameter. Replace attachmentav.yourcompany.com with the domain name of your attachmentAV API installation.

import com.attachmentav.api.AttachmentAvApi;
import com.attachmentav.client.ApiClient;
import com.attachmentav.client.ApiException;
import com.attachmentav.client.Configuration;
import com.attachmentav.model.ScanResult;
import com.attachmentav.model.SyncS3ScanRequest;

// ...

ApiClient client = Configuration.getDefaultApiClient();
client.setBearerToken("<API_KEY_PLACEHOLDER>");
client.setBasePath("https://attachmentav.yourcompany.com/api/v1");
AttachmentAvApi api = new AttachmentAvApi();
SyncS3ScanRequest request = new SyncS3ScanRequest();
request.setBucket("<BUCKET_NAME_PLACEHOLDER>");
request.setKey("<OBJECT_KEY_PLACEHOLDER>");
//request.setVersion("<OBJECT_VERSION_PLACEHOLDER>"); // for versioned buckets only
ScanResult result = api.scanSyncS3Post(request);
System.out.println("Scan Result: " + result.getStatus());n

Source: GitHub

Find the latest version of the attachmentav-virus-malware-scan-sdk on PyPI and add it to the dependencies of your project.

pip install attachmentav-virus-malware-scan-sdk

Replace <API_KEY_PLACEHOLDER> with one of the API keys from the ApiKeys configuration parameter. Replace attachmentav.yourcompany.com with the domain name of your attachmentAV API installation.

import attachmentav

configuration = attachmentav.Configuration()
configuration.access_token = "<API_KEY_PLACEHOLDER>"
configuration.host = "https://attachmentav.yourcompany.com/api/v1"

with attachmentav.ApiClient(configuration) as api_client:
  api_instance = attachmentav.AttachmentAVApi(api_client)

sync_s3_scan_request = attachmentav.SyncS3ScanRequest(
  bucket = "<BUCKET_NAME_PLACEHOLDER>",
  key = "<OBJECT_KEY_PLACEHOLDER>"
)
scan_result = api_instance.scan_sync_s3_post(sync_s3_scan_request)
print(scan_result)

Source: GitHub

Find the latest version of the virus-scan-sdk-ts on npm and add it to the dependencies of your project.

npm i @attachmentav/virus-scan-sdk-ts

Replace <API_KEY_PLACEHOLDER> with one of the API keys from the ApiKeys configuration parameter. Replace attachmentav.yourcompany.com with the domain name of your attachmentAV API installation.

ESM

import { AttachmentAVApi, Configuration } from '@attachmentav/virus-scan-sdk-ts';

const config = new Configuration({
  accessToken: '<API_KEY_PLACEHOLDER>',
  basePath: 'https://attachmentav.yourcompany.com/api/v1'
});

const api = new AttachmentAVApi(config);

const scanResult = await api.scanSyncS3Post({
  syncS3ScanRequest: {
    bucket: '<BUCKET_NAME_PLACEHOLDER>',
    key: '<OBJECT_KEY_PLACEHOLDER>'
  }
});
console.log('Sync S3 scan result:', scanResult);

Source: GitHub

CommonJs

const { AttachmentAVApi, Configuration } = require('@attachmentav/virus-scan-sdk-ts');

const config = new Configuration({
  accessToken: '<API_KEY_PLACEHOLDER>',
  basePath: 'https://attachmentav.yourcompany.com/api/v1'
});

const api = new AttachmentAVApi(config);

api.scanSyncS3Post({
  syncS3ScanRequest: {
    bucket: '<BUCKET_NAME_PLACEHOLDER>',
    key: '<OBJECT_KEY_PLACEHOLDER>'
  }
}).then(scanResult => {
  console.log('Sync S3 scan result:', scanResult);
});

Source: GitHub

Find the latest version of the virus-scan-sdk-ts on npm and add it to the dependencies of your project.

npm i @attachmentav/virus-scan-sdk-ts

Replace <API_KEY_PLACEHOLDER> with one of the API keys from the ApiKeys configuration parameter. Replace attachmentav.yourcompany.com with the domain name of your attachmentAV API installation.

import { AttachmentAVApi, Configuration } from '@attachmentav/virus-scan-sdk-ts';

const config = new Configuration({
  accessToken: '<API_KEY_PLACEHOLDER>',
  basePath: 'https://attachmentav.yourcompany.com/api/v1'
});

const api = new AttachmentAVApi(config);

const scanResult = await api.scanSyncS3Post({
  syncS3ScanRequest: {
    bucket: '<BUCKET_NAME_PLACEHOLDER>',
    key: '<OBJECT_KEY_PLACEHOLDER>'
  }
});
console.log('Sync S3 scan result:', scanResult);

Source: GitHub

Need more help?

Write us, and we'll get back to you as soon as we can.

Send us an email