Antivirus REST API to scan files and detect viruses, trojans, and other malware in both uploaded and external files.
Firstly, your file must be uploaded or accessible to Bytescale:
Use the Bytescale Dashboard to upload a file manually.
Use the Upload Widget, Bytescale SDKs or Bytescale API to upload a file programmatically.
Use our external storage options to process external files.
To build a URL to scan a file for viruses:
Get the raw URL for your file:
https://upcdn.io/W142hJk/raw/example.jpg
Replace "raw" with "antivirus":
https://upcdn.io/W142hJk/antivirus/example.jpg
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.
This website uses cookies. By continuing you are consenting to the use of cookies per our Cookie Policy. Our legal policies were last updated August 16 2024.
This website requires a modern web browser -- the latest versions of these browsers are supported: