Data Types

Antivirus API

Antivirus REST API to scan files and detect viruses, trojans, and other malware in both uploaded and external files.

https://upcdn.io
Account
/W142hJk/
API
antivirus
File Path
/example.jpg

1 Upload your file

Firstly, your file must be uploaded or accessible to Bytescale:

Icon

Use the Bytescale Dashboard to upload a file manually.

Icon

Use the Upload Widget, Bytescale SDKs or Bytescale API to upload a file programmatically.

Icon

Use our external storage options to process external files.

2 Build your file URL

To build a URL to scan a file for viruses:

2a

Get the raw URL for your file:

https://upcdn.io/W142hJk/raw/example.jpg

2b

Replace "raw" with "antivirus":

https://upcdn.io/W142hJk/antivirus/example.jpg

3 Get the antivirus report

The Antivirus API initially returns a status of "Pending":

https://upcdn.io/W142hJk/antivirus/example.jpg
{
"jobUrl": "https://api.bytescale.com/v2/accounts/W142hJk/jobs/AntivirusJob/01HGB4G3R466T9EBDVK015JMXS",
"jobDocs": "https://www.bytescale.com/docs/job-api/GetJob",
"jobId": "01HGB4G3R466T9EBDVK015JMXS",
"jobType": "AntivirusJob",
"accountId": "W142hJk",
"created": 1700179632246,
"lastUpdated": 1700179633360,
"status": "Pending",
"summary": {}
}

After a few seconds, the status progresses to "Succeeded" and your antivirus report will appear in the summary.result field.

Example #1: Healthy file

{
"jobUrl": "https://api.bytescale.com/v2/accounts/W142hJk/jobs/AntivirusJob/01HGB4G3R466T9EBDVK015JMXS",
"jobDocs": "https://www.bytescale.com/docs/job-api/GetJob",
"jobId": "01HGB4G3R466T9EBDVK015JMXS",
"jobType": "AntivirusJob",
"accountId": "W142hJk",
"created": 1700179632246,
"lastUpdated": 1700179633360,
"status": "Succeeded",
"summary": {
"result": {
"files": [
{
"filePath": "/example.jpg",
"fileHashSha1": "a2ffa2f45721a6fc050696c169146cf87b227f70",
"viruses": [],
"status": "Healthy"
}
],
"database": {
"databaseAge": "10 minutes",
"databaseLastChecked": 1700179032353,
"databaseLastUpdated": 1700124000000
},
"scanStartTime": 1700179632353,
"scanEndTime": 1700179633348
}
}
}

See AntivirusReport for more details.

Example #2: Infected file

{
"jobUrl": "https://api.bytescale.com/v2/accounts/W142hJk/jobs/AntivirusJob/01HGB4G3R466T9EBDVK015JMXS",
"jobDocs": "https://www.bytescale.com/docs/job-api/GetJob",
"jobId": "01HGB4G3R466T9EBDVK015JMXS",
"jobType": "AntivirusJob",
"accountId": "W142hJk",
"created": 1700179632246,
"lastUpdated": 1700179633360,
"status": "Succeeded",
"summary": {
"result": {
"files": [
{
"filePath": "/example.jpg",
"fileHashSha1": "a2ffa2f45721a6fc050696c169146cf87b227f70",
"viruses": [
"Win.Ransomware.Example-7013612-0"
],
"status": "Infected"
}
],
"database": {
"databaseAge": "10 minutes",
"databaseLastChecked": 1700179032353,
"databaseLastUpdated": 1700124000000
},
"scanStartTime": 1700179632353,
"scanEndTime": 1700179633348
}
}
}

See AntivirusReport for more details.

Example #3: Skipped file

{
"jobUrl": "https://api.bytescale.com/v2/accounts/W142hJk/jobs/AntivirusJob/01HGB4G3R466T9EBDVK015JMXS",
"jobDocs": "https://www.bytescale.com/docs/job-api/GetJob",
"jobId": "01HGB4G3R466T9EBDVK015JMXS",
"jobType": "AntivirusJob",
"accountId": "W142hJk",
"created": 1700179632246,
"lastUpdated": 1700179633360,
"status": "Succeeded",
"summary": {
"result": {
"files": [
{
"filePath": "/example.jpg",
"viruses": [],
"skippedReason": "FileTooLarge",
"status": "Skipped"
}
],
"database": {
"databaseAge": "10 minutes",
"databaseLastChecked": 1700179032353,
"databaseLastUpdated": 1700124000000
},
"scanStartTime": 1700179632353,
"scanEndTime": 1700179633348
}
}
}

See AntivirusReport for more details.

Files may be skipped for the following reasons:

  • FileTooLarge: File size exceeds the 2GB limit for virus scans.

  • ContentTooLarge: Uncompressed content exceeds the 4GB limit for virus scans. (This applies to any file format that uses compression.)

  • Timeout: Scan duration exceeds the 240-second limit.

  • ArchiveFileCountTooHigh: File is an archive (e.g. ZIP) that contains over 10,000 files.

  • ArchiveRecursionTooHigh: File is an archive (e.g. ZIP) that contains other archives (e.g. other ZIPs) over 10 levels deep.

  • Other: File was skipped due to other internal limits. (For more information on this status code, please contact support.)

Security recommendation: You should always enforce a file size limit on your uploads (< 2GB). After your files have finished uploading, you should check each file's status using the Antivirus API. When status != "Healthy" you should discard the file. You can optionally delete the file and inform the user.

Was this section helpful? Yes No

You are using an outdated browser.

This website requires a modern web browser -- the latest versions of these browsers are supported: