Developer Guide


This is the API documentation for MetaDefender Cluster API Gateway Public API. If you would like to evaluate or have any questions about this documentation, please contact us via our Contact Us form.


How to Interact with MetaDefender Cluster API Gateway using REST API

MetaDefender Cluster API Gateway is used to submit files for analysis, retrieve scan results, manage file processing, download processed files, and manage file batches. OPSWAT recommends using the JSON-based REST API. The available methods are documented below.

Note: MetaDefender Cluster API doesn't support chunk upload, however is recommended to stream the files to MetaDefender Cluster API Gateway as part of the upload process.


File Analysis Process

MetaDefender Cluster is a system with multiple components that work together to utilize the power of multiple MetaDefender Core instances. The system is designed to handle large volumes of files and provide high throughput for file analysis. The system can be deployed in a distributed manner, allowing for horizontal scaling and load balancing across multiple MetaDefender Core instances.

Below is a brief description of the API integration flow:

  1. Upload a file for analysis to MetaDefender Cluster API Gateway (POST /file), which returns the data_id: File Analysis.

  2. The following method can be used to retrieve the analysis report:

    • Polling: Fetch the result with previously received data_id (GET /file/{data_id} resource) until scan result belonging to data_id doesn't reach the 100 percent progress_percentage: (Fetch analysis result)

    Note: Too many data_id requests can reduce performance. It is enough to just check every few hundred milliseconds.

  3. Retrieve the analysis results anytime after the analysis is completed with hash for files (md5, sha1, sha256, sha512) by calling Fetch analysis result by hash.

    • The hash can be found in the scan results
  4. Retrieve processed file (sanitized, redacted, watermarked, etc.) after the analysis is complete.

    Note: Based on the configured retention policy, the files might be available for retrieval at a later time.


OPSWAT provides some sample codes on GitHub to make it easier to understand how the MetaDefender REST API works.

Server
http://localhost:8899
Server Variables
apiKey apikey

Generated session_id from Login call can be used as an apikey for API calls that require authentication.

Fields
KeyIn
apikeyHeader

Auth

Authentication APIs

User authentication is done via username & password.

Login

Initiate a new session. Required for using protected REST APIs.

Auth
Request Body
objectobject
userstring

Username

passwordstring

User's password

POST /login
curl --request POST \
--url 'http://localhost:8899/login' \
--data '{
"user": "admin",
"password": "admin"
}'
Copy
Responses
200

OK

objectobject
oms-csrf-tokenstring

The randomly generated token used to prevent CSRF attacks

session_idstring

The apikey used to make API calls which requires authentication

403

Invalid credentials

500

Unexpected event on server.

Response
{
"oms-csrf-token": "ZWU3NDJkNDcwMzQ4NWNlNGUzOTFjMGJiNDFkZDQ4ZWM=",
"session_id": "a5dd6114dbd14a3b8f4577b7b54e6b0a"
}
Copy

Logout

Destroy session for not using protected REST APIs.

Auth
Headers
apikeystring

Generated session_id from Login call can be used as an apikey for API calls that require authentication.

POST /logout
curl --request POST \
--url 'http://localhost:8899/logout' \
--header 'apikey: {apikey}'
Copy
Responses
200

OK

objectobject
responsestring
400

Bad Request.

403

Invalid user information.

500

Unexpected event on server.

Response
{
"response": "Logout success"
}
Copy

Analysis

File analysis APIs

Submit each file to MetaDefender Cluster API Gateway individually or group them in batches. Each file submission will return a data_id which will be the unique identifier used to retrieve the analysis results.

Note: MetaDefender API doesn't support chunk upload. You shouldn't load the file in memory, is recommended to stream the files to MetaDefender Cluster API Gateway as part of the upload process.

Analyze File (Asynchronous mode)

Scanning a file using a specified workflow. Scan is done asynchronously and each scan request is tracked by data id of which result can be retrieved by API Fetch Scan Result.

Note: Chunked transfer encoding (applying header Transfer-Encoding: Chunked) is not supported on /file API. API Gateway only accepts file uploads with a known content length and a content type of application/octet-stream

Auth
Headers
apikeystring

Generated session_id from Login call can be used as an apikey for API calls that require authentication.

filenamestring

The name of the submitted file

user_agentstring

user_agent header used to identify (and limit) access to a particular rule. For rule selection, rule header should be used.

rulestring

Select rule for the analysis, if no header given the default rule will be selected (URL encoded UTF-8 string of rule name)

batchstring

Batch id to scan with, coming from Initiate Batch (If it is not given, it will be a single file scan.)

archivepwdstring

Password for archive ( URL encoded UTF-8 string) Multiple passwords is also supported, format: archivepwdX

  • X: Could be empty
  • When having value, X must be a number >= 1

For example:

  • archivepwd1: "fox"
  • archivepwd2: "cow"
  • archivepwd3: "bear"
content-encodingstring

Content encoding of the file. This header is used to specify the encoding of the file content. The value should be a valid content encoding type, such as "base64", "gzip". This header is optional and can be omitted if the encoding is not applicable.

metadatastring

Could be utilized for:

  • Additional parameter for pre-defined post actions and external scanners (as a part of STDIN input).

  • Customized macro variable for watermarking text (Proactive DLP engine feature).

  • Additional context / verbose information for each file submission (appended into JSON response scan result).

It is strongly recommended to apply URL encoding before sending metadata to Metadefender Core to prevent unexpected issues related to encoding errors or unsafe characters.

engines-metadatastring

Since MetaDefender Core 5.0.0, preferred context / verbose information can be sent to the engines.

Please see the below pages for the details:

callbackurlstring

Client's URL where MetaDefender Cluster Callback Service will notify scan result back to whenever scan is finished (webhook model). * Format: protocol://<ip | domain>: * Example: http://10.0.1.100:8081/listenback * Supported protocol: HTTP / HTTPS * Supported host types: domain name, IPv4 (IPv6 not supported) * Method: POST

Note: The Callback URL is only supported when MetaDefender Cluster Callback Service is deployed, and MetaDefender Core version must be 5.16.1 or higher.

downloadfromstring

Format: <protocol://><ip | domain>:<port></path>

Scan a file from a download link, instead of uploading the file in the request body. MetaDefender Cluster Download Service downloads the file from the link, then sends it for scanning.

Note: To use this header, you need:

  • MetaDefender Cluster Download Service deployed.
  • MetaDefender Cluster version 2.10.0 or later.
  • MetaDefender Core version 5.23.0 or later.

If no Download Service instance is available, the request fails with HTTP 503.

How it works:

  • Do not send a request body. Content-Length must be 0 or not set. If you send a body, the request fails with HTTP 400.
  • The response returns a data_id right away. The download continues in the background.
  • To see the download progress and result, check download_info in Fetch Analysis Result.
  • If you do not set the filename header, the file name is the last part of the link path.

Supported:

  • Protocols: HTTP and HTTPS.
  • Single file scan, with or without webhook.
  • Batch scan: add the downloadfrom header to each file request in the batch. The batch request itself needs nothing extra.
    • If you cancel the batch, all files in the batch that are still downloading are also cancelled.
  • Settings in the workflow ("General" tab):
    • Max sizes > URL file download
    • Timeouts > File download
  • Settings in Settings > Scan From Link:
    • Max download queue: the number of downloads that run at once. Other links wait their turn.
    • Idle timeout: a download fails if it receives no data for this long.
    • Enforce scan from link validation: allow or block links that match the given patterns.
  • Size check before download: MetaDefender Cluster sends an HTTP HEAD request to the link. If the file is larger than the max URL file download size or the max file scan size, the download is refused. To skip this check, use the skip-head-request header.
redirect-supportboolean

Use only with the downloadfrom header.

Follow redirects of the download link.

  • Default: false. If the link redirects, the request fails with HTTP 400 (Redirect link not supported.).
  • true: Follow up to 5 redirects.

Default: false

skip-head-requestboolean

Use only with the downloadfrom header.

Skip the HTTP HEAD request that checks the file size before the download. Use it when the download server does not support HEAD requests.

  • Default: false. Send the HEAD request first, then download.
  • true: Download the file directly. The size limits are still checked during the download.

Default: false

global-timeoutinteger

This custom global timeout (in seconds) will override the global timeout predefined in corresponding workflow rule.

client-identitystring

The client-identity header identifies the clients involved in processing a file, providing greater visibility into its processing stages. The header value is a JSON object containing a clients array. Each client object supports the following fields:

  • deployment_id: REQUIRED. Unique identifier of the deployment.
  • user_name: REQUIRED. Name of the user or system that initiated the scan.
  • product_type: REQUIRED. Type of product or system performing the scan.
  • version: OPTIONAL. Version of the product or system.
  • host: OPTIONAL. Hostname or IP address of the client machine.
  • timestamp: REQUIRED. Time at which the scan was initiated, expressed in milliseconds since the Unix epoch. Example:
    {
    "clients": 
    [
    {
      "deployment_id": "abcdef1234567890",
      "user_name": "Gemini",
      "product_type": "MetaDefender Kiosk",
      "version": "1.0.0",
      "host": "client.example.com",
      "timestamp": 1744949754890
    }
    ]
    }
    URL-encode the JSON value before sending the header to MetaDefender Cluster to avoid issues caused by unsafe characters or incorrect encoding. Omit the header when client identity tracking is not required.
Request Body
filefile
POST /file
curl --request POST \
--url 'http://localhost:8899/file' \
--header 'apikey: {apikey}' \
--header 'filename: {filename}' \
--header 'user_agent: {user_agent}' \
--header 'rule: {rule}' \
--header 'batch: {batch}' \
--header 'archivepwd: {archivepwd}' \
--header 'content-encoding: base64' \
--header 'metadata: {
"key1": "value",
"key2": ["valueA", "valueB"]
}
' \
--header 'engines-metadata: {
"charset": "ISO-2022-JP",
"content-type": "text/html",
"content-transfer-encoding": "quoted-printable"
}
' \
--header 'callbackurl: {callbackurl}' \
--header 'downloadfrom: https://secure.eicar.org/eicar.com' \
--header 'redirect-support: {redirect-support}' \
--header 'skip-head-request: {skip-head-request}' \
--header 'global-timeout: {global-timeout}' \
--header 'client-identity: %7B%22clients%22%3A%5B%7B%22deployment_id%22%3A%22abcdef1234567890%22%2C%22user_name%22%3A%22Gemini%22%2C%22product_type%22%3A%22MetaDefender%20Kiosk%22%2C%22version%22%3A%221.0.0%22%2C%22host%22%3A%22client.example.com%22%2C%22timestamp%22%3A1744949754890%7D%5D%7D
' \
--data-binary '"<Payload in raw bytes>"'
Copy
Responses
200

Successful file submission

objectobject
data_idstring

Unique submission identifier. Use this value to reference the submission.

400

Bad Request (e.g. header is invalid, apikey is missing or invalid, parameter value is invalid or out of range, etc). The request is rejected before the file is processed, so no data_id is created.

When the client-identity header is present but its value is invalid, err is one of:

err Cause
Header 'client-identity' is empty The header was sent without a value.
Header 'client-identity' must be less than or equal 4096 characters The header value is longer than 4096 characters.
Header 'client-identity' contains non-printable character The value contains an ASCII control character, either directly or through an escape.
Header 'client-identity' is not in JSON format The value could not be URL-decoded, is not valid JSON, or is not a JSON object.
Header 'client-identity' does not contain a 'clients' key or empty 'clients' clients is missing, is not an array, or is an empty array.
Header 'client-identity' contains an invalid data An entry of clients is not a JSON object.
Header 'client-identity' does not contain required key '<key>' An entry is missing deployment_id, user_name, product_type or timestamp.
Header 'client-identity' contains a non-string '<key>' deployment_id, user_name or product_type is not a string.
Header 'client-identity' contains an empty '<key>' deployment_id, user_name or product_type is blank.
Header 'client-identity' contains an invalid 'deployment_id' deployment_id holds anything other than letters and digits.
Header 'client-identity' contains a non-integer 'timestamp' timestamp is not an integer.
Header 'client-identity' contains a negative 'timestamp' timestamp is zero or negative.

Every entry of clients is checked, not only the first one, and the first rule that fails is the one reported.

403

Invalid user information or Not Allowed

411

Content-Length header is missing from the request.

422

Body input is empty.

500

Unexpected event on server.

503

Service is unavailable, err is one of:

  • Server is too busy. Try again later.
  • Failed to request because no MetaDefender Cluster Download Service instance is available - the downloadfrom header was given but no Download Service instance is healthy.
Response
{
"data_id": "61dffeaa728844adbf49eb090e4ece0e"
}
Copy

Fetch Analysis Result

Retrieve scan results.

Scan is done asynchronously and each scan request is tracked by a data ID.

Initiating file scans and retrieving the results need to be done using two separate API calls. This request needs to be made multiple times until the scan is complete. Scan completion can be traced using scan_results.progress_percentage value from the response.

Note: The REST API also supports pagination for archive file result. A completed response description with archive detection:

  • extracted_files: information about extracted files
    • files_extracted_count: the number of extracted files
    • files_in_archive: array of files in archive
      • detected_by: number of engines reported threat
      • scanned_with: number of engines used for scanning the file
    • first_index: it tells that from which file (index of the file, 0 is the first) the result JSON contains information about extracted files. (default=0, min=0)
    • page_size: it tells how many files the result JSON contains information about (default=50, min=0, max=2000). So by default, the result JSON contains information about the first 50 extracted files.
    • worst_data_id: data id of the file that has the worst result in the archive
    • total_reused_files: Indicates how many extracted files reused results from a previous analysis instead of being processed again. This field is available starting with MetaDefender Cluster 2.10.0. A value of 0 means no extracted files were reused. If the entire archive is reused, original_data_id is set and files_in_archive is empty, while the archive totals are still included in the response.
  • scan_results
    • last_file_scanned (stored only in memory, not in database): If available, the name of the most recent processed file
Auth
Headers
apikeystring

Generated session_id from Login call can be used as an apikey for API calls that require authentication.

user_agentstring

user_agent header used to identify (and limit) access to a particular rule. For rule selection, rule header should be used.

Path Params
data_idstring

Unique submission identifier. Use this value to reference the submission.

Query String
firstinteger

The first item order in the list child files of archive file

minimum: 0

Default: 0

sizeinteger

The number of items to be fetched next, counting from the item order indicated in first header. The default value is 50, and the maximum value is 2000.

maximum: 2000

minimum: 0

Default: 50

GET /file/{data_id}
curl --get \
--url 'http://localhost:8899/file/{data_id}' \
--header 'apikey: {apikey}' \
--header 'user_agent: {user_agent}' \
--data first={first} \
--data size=50
Copy
Responses
200

Entire analysis report generated by MetaDefender Core

objectobject
data_idstring

data identifier of the requested file

deflected_enginesarray[string]

Engines skipped (deflected) for this file based on the OPSWAT Alin AI Deflection verdict (available starting with MetaDefender Cluster 2.10.0). Returned only when at least one engine was deflected. Each item is an engine identifier, e.g. extraction, metascan, ds, oesis, dlp, yara, filescanio, sbom, coo, reputation, ti, aigcd, fsv.

deflection_info5 fieldsobject

Report from the OPSWAT Alin AI Deflection engine (available starting with MetaDefender Cluster 2.10.0). Deflection produces an early verdict on a file that can be used to skip (deflect) other engines in the workflow. The object is empty when Deflection did not run on the file.

dlp_info9 fieldsobject

Full report from Proactive DLP

download_info5 fieldsobject

The downloading status. Only present when the file was submitted with the downloadfrom header (scan from link), in which case MetaDefender Cluster Download Service downloads the file before it is scanned.

extraction_info6 fieldsobject

Details for archive extraction.

file_info13 fieldsobject

basic information of the scanned file

filetype_info6 fieldsobject

response information from FileType engine

opswatfilescan_infoobject

response information from OPSWAT Filescan engine

original_data_idstring

The data ID of the previous analysis whose result was reused. This field is present only when the result was returned from an earlier analysis through the workflow rule's Reuse processing result option (process_info.reuse_processing_result) instead of being processed again. For archive files, archive result reuse must also be enabled with process_info.reuse_processing_result.include_archive. Available starting with MetaDefender Cluster 2.10.0.

process_info16 fieldsobject

Processing information

scan_results8 fieldsobject

Result of the scanning process.

vulnerability_info2 fieldsobject

Contains all vulnerability information of the analysis result

yaraobject

Information on data that matched YARA rules

hitsobject

detailed results that contains the name of the matched rules and a description for each.

verdictinteger

The overall result for the analyzed file. Value will be one of the following: | index | status | |---------------|------------------------------| | 0 | Clean | | 1 | Found matched data | | 2 | Suspicious | | 3 | Failed | | 4 | Not scanned |

Enum: 0,1,2,3,4

400

Bad Request (e.g. header is invalid, apikey is missing or invalid, parameter value is invalid or out of range, etc).

405

The user has no rights for this operation.

500

Unexpected event on server.

Response
{
"data_id": "8101abae27be4d63859c55d9e0ed0135",
"deflected_engines": [
"metascan",
"dlp"
],
"deflection_info": {
"final_verdict": {
"confidence": 83,
"detail": {
"data_id": "cfa7e498a31742fbb22fbeda197bb1da",
"file_type": "PDF"
},
"verdict": "malicious"
},
"result_template_hash": "d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5e6"
},
"dlp_info": {
"certainty": "High",
"errors": {
"redact": "File structure invalid."
},
"filename": "OPSWAT_Proactive_DLP_CCN_proactive-dlp-processed_by_OPSWAT_MetaDefender_8101abae27be4d63859c55d9e0ed0135.pdf",
"hits": {
"ccn": {
"display_name": "Credit Card Number",
"hits": [
{
"after": "123 Cherry Lane st.",
"before": "Card Number",
"certainty": "Very High",
"certainty_score": 100,
"hit": "XXXXXXXXXXXXXXX1938",
"location": "Page 1",
"severity": 0,
"tryRedact": true
Copy

Fetch Analysis Result By Hash

Retrieve analysis result by hash

Auth
Headers
apikeystring

Generated session_id from Login call can be used as an apikey for API calls that require authentication.

rulestring

Select rule for the analysis, if no header given the default rule will be selected (URL encoded UTF-8 string of rule name)

selfonlyboolean

Useful to archive hash lookup.

Allow specifying to only perform hash lookup against the original archive file self only, and skip searching all child files result within the original archive.

Default value is false.

timerangeinteger

Scoping down the recent number of hours that hash lookup task should start from till now, instead of searching the entire scan history in MetaDefender Cluster database.

Default value is 0. That means no time scope.

include-inprogressboolean

False (default): API will return "Not Found" if the verdict is in progress.

True: If the queried hash has a completed processing result before, API will return the completed processing result. If this hash doesn't have any completed processing result, API will return this In-progress result.

Path Params
md5|sha1|sha256|sha512string

Hash value to search. This can be md5, sha1, sha256, sha512

Query String
firstinteger

The first item order in the list child files of archive file

minimum: 0

Default: 0

sizeinteger

The number of items to be fetched next, counting from the item order indicated in first header. The default value is 50, and the maximum value is 2000.

maximum: 2000

minimum: 0

Default: 50

GET /hash/{md5|sha1|sha256|sha512}
curl --get \
--url 'http://localhost:8899/hash/{md5|sha1|sha256|sha512}' \
--header 'apikey: {apikey}' \
--header 'rule: {rule}' \
--header 'selfonly: {selfonly}' \
--header 'timerange: {timerange}' \
--header 'include-inprogress: {include-inprogress}' \
--data first={first} \
--data size=50
Copy
Responses
200

Get information of file

objectobject
data_idstring

data identifier of the requested file

deflected_enginesarray[string]

Engines skipped (deflected) for this file based on the OPSWAT Alin AI Deflection verdict (available starting with MetaDefender Cluster 2.10.0). Returned only when at least one engine was deflected. Each item is an engine identifier, e.g. extraction, metascan, ds, oesis, dlp, yara, filescanio, sbom, coo, reputation, ti, aigcd, fsv.

deflection_info5 fieldsobject

Report from the OPSWAT Alin AI Deflection engine (available starting with MetaDefender Cluster 2.10.0). Deflection produces an early verdict on a file that can be used to skip (deflect) other engines in the workflow. The object is empty when Deflection did not run on the file.

dlp_info9 fieldsobject

Full report from Proactive DLP

download_info5 fieldsobject

The downloading status. Only present when the file was submitted with the downloadfrom header (scan from link), in which case MetaDefender Cluster Download Service downloads the file before it is scanned.

extraction_info6 fieldsobject

Details for archive extraction.

file_info13 fieldsobject

basic information of the scanned file

filetype_info6 fieldsobject

response information from FileType engine

opswatfilescan_infoobject

response information from OPSWAT Filescan engine

original_data_idstring

The data ID of the previous analysis whose result was reused. This field is present only when the result was returned from an earlier analysis through the workflow rule's Reuse processing result option (process_info.reuse_processing_result) instead of being processed again. For archive files, archive result reuse must also be enabled with process_info.reuse_processing_result.include_archive. Available starting with MetaDefender Cluster 2.10.0.

process_info16 fieldsobject

Processing information

scan_results8 fieldsobject

Result of the scanning process.

vulnerability_info2 fieldsobject

Contains all vulnerability information of the analysis result

yaraobject

Information on data that matched YARA rules

hitsobject

detailed results that contains the name of the matched rules and a description for each.

verdictinteger

The overall result for the analyzed file. Value will be one of the following: | index | status | |---------------|------------------------------| | 0 | Clean | | 1 | Found matched data | | 2 | Suspicious | | 3 | Failed | | 4 | Not scanned |

Enum: 0,1,2,3,4

404

Invalid hash format

Response
{
"data_id": "8101abae27be4d63859c55d9e0ed0135",
"deflected_engines": [
"metascan",
"dlp"
],
"deflection_info": {
"final_verdict": {
"confidence": 83,
"detail": {
"data_id": "cfa7e498a31742fbb22fbeda197bb1da",
"file_type": "PDF"
},
"verdict": "malicious"
},
"result_template_hash": "d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5e6"
},
"dlp_info": {
"certainty": "High",
"errors": {
"redact": "File structure invalid."
},
"filename": "OPSWAT_Proactive_DLP_CCN_proactive-dlp-processed_by_OPSWAT_MetaDefender_8101abae27be4d63859c55d9e0ed0135.pdf",
"hits": {
"ccn": {
"display_name": "Credit Card Number",
"hits": [
{
"after": "123 Cherry Lane st.",
"before": "Card Number",
"certainty": "Very High",
"certainty_score": 100,
"hit": "XXXXXXXXXXXXXXX1938",
"location": "Page 1",
"severity": 0,
"tryRedact": true
Copy

Retrieve blocked leaf files from an archive by hash

Returns the deepest blocked files found within an original archive, identified by the archive's hash value. A leaf file is a file that has no successfully extracted child files. If no blocked leaf files are found, the response returns an empty array. A maximum of 100 blocked leaf files is returned in a single request.

Auth
Headers
apikeystring

Generated session_id from Login call can be used as an apikey for API calls that require authentication.

rulestring

Select rule for the analysis, if no header given the default rule will be selected (URL encoded UTF-8 string of rule name)

timerangeinteger

Limits the hash lookup to files analyzed within the specified number of hours.

A value of 0 (default) searches the entire analysis history.

Path Params
md5|sha1|sha256|sha512string

Hash value of the archive. Supported hash types are MD5, SHA-1, SHA-256, and SHA-512.

GET /hash/{md5|sha1|sha256|sha512}/blocked-leaves
curl --get \
--url 'http://localhost:8899/hash/8101abae27be4d63859c55d9e0ed0135/blocked-leaves' \
--header 'apikey: {apikey}' \
--header 'rule: {rule}' \
--header 'timerange: {timerange}'
Copy
Responses
200

Successfully retrieved the list of blocked leaf files.

objectobject
details10 fieldsarray[object]

List of blocked leaf files.

limit_reachedboolean

Indicates whether more than 100 blocked leaf files were found.

totalinteger

Number of blocked leaf files returned in the details array.

400

The timerange header value is invalid.

404

The specified hash was not found, or the file is still being processed.

405

The user has no rights for this operation.

500

Unexpected event on server.

Response
{
"details": [
{
"blocked_reasons": [
"Infected"
],
"engines": [
{
"engine": "Avira",
"threat_name": "Virus eicar test file"
}
],
"data_id": "914b95fb1a9948e5a1d9b29817ecb69f",
"display_name": "ProKey.exe",
"file_type": "application/x-dosexec",
"parent_id": "8101abae27be4d63859c55d9e0ed0135",
"path": "prokey-x64.zip\\\\ProKey.exe",
"process_info": {
"post_processing": {
"actions_failed": "Sanitization Failed | PAscript failed",
"actions_ran": "Sanitized | PAscript"
}
},
"verdicts": [
"Infected"
],
"yara_info": {
"hits": [
"source0.filesizelessthan2MB"
]
}
}
],
"limit_reached": false,
"total": 1
}
Copy

Fetching Available Analysis Rules

Retrieve all available rules with their custom configurations. Fetching available processing rules.

Auth
Headers
apikeystring

Generated session_id from Login call can be used as an apikey for API calls that require authentication. Only those rules are returned, that:

  • Match the apikey's role sent using the apikey header, or
  • Are not restricted to a specific role.
user_agentstring

The user agent string value sent in the header (specified by the client).

Only those rules are returned, that:

  • Match the client's user agent sent using the user_agent header, or
  • Are not restricted to a specific user agent.

For details see KB article What are Security Policies and how do I use them?.

GET /file/rules
curl --get \
--url 'http://localhost:8899/file/rules' \
--header 'apikey: {apikey}' \
--header 'user_agent: {user_agent}'
Copy
Responses
200

Returns the list of available rules.

arrayarray[object]
max_file_sizeinteger

The maximum allowed file size (in bytes) for this rule.

namestring

A unique identifier for identify in the used rule for a scan..

global_timeoutobject

The global timeout for the rule in seconds. If the rule takes longer than this time, it will be stopped.

valueinteger

The timeout value in seconds.

enabledboolean

Indicates whether the global timeout is enabled.

500

Unexpected event on server.

Response
[
{
"max_file_size": 200000000,
"name": "File scan",
"global_timeout": {
"value": 1440,
"enabled": false
}
}
]
Copy

Download Sanitized Files

Retrieve sanitized file based on the data_id

Auth
Headers
apikeystring

Generated session_id from Login call can be used as an apikey for API calls that require authentication.

Path Params
data_idstring

The data_id comes from the result of Analyze a file. In case of sanitizing the content of an archive, the data_id of contained file can be found in Fetch analysis result.

GET /file/converted/{data_id}
curl --get \
--url 'http://localhost:8899/file/converted/8101abae27be4d63859c55d9e0ed0135' \
--header 'apikey: {apikey}'
Copy
Responses
200

Returns the sanitized content.

filefile
404

Requests resource was not found.

405

The user has no rights for this operation.

500

Unexpected event on server.

Response
<Raw bytes content>
Copy

Download either sanitized files or DLP processed files

Retrieve sanitized file based on the data_id. In case there's no sanitized file, and DLP processed file is available, user will retrieve DLP processed file.

Auth
Headers
apikeystring

Generated session_id from Login call can be used as an apikey for API calls that require authentication.

Path Params
data_idstring

The data_id comes from the result of Analyze a file. In case of sanitizing the content of an archive, the data_id of contained file can be found in Fetch analysis result.

GET /file/download/{data_id}
curl --get \
--url 'http://localhost:8899/file/download/8101abae27be4d63859c55d9e0ed0135' \
--header 'apikey: {apikey}'
Copy
Responses
200

Returns the sanitized or DLP processed content.

filefile
404

File could not be found

405

The user has no rights for this operation.

500

Unexpected event on server.

Response
<Raw bytes content>
Copy

Cancel File Analysis

When cancelling a file analysis, the connected analysis (e.g. files in an archive) that are still in progress will be cancelled also.

The cancelled analysis will be automatically closed.

When the file was submitted with the downloadfrom header and is still being downloaded, the download is stopped and download_info.status becomes Download Cancelled.

Auth
Headers
apikeystring

Generated session_id from Login call can be used as an apikey for API calls that require authentication.

Path Params
data_idstring

Unique submission identifier. Use this value to reference the submission.

POST /file/{data_id}/cancel
curl --request POST \
--url 'http://localhost:8899/file/{data_id}/cancel' \
--header 'apikey: {apikey}'
Copy
Responses
200

Analysis was sucessfully cancelled.

objectobject
400

Bad Request (e.g. header is invalid, apikey is missing or invalid, parameter value is invalid or out of range, etc).

403

Invalid user information or Not Allowed

404

Data ID not found (invalid id) or Requests resource was not found

405

The user has no rights for this operation.

500

Unexpected event on server.

Response
{
"<<data_id>>": "cancelled"
}
Copy

Retrieve blocked leaf files from an archive

Returns the deepest blocked files found within an original archive, identified by the archive's data_id. A leaf file is a file that has no successfully extracted child files. If no blocked leaf files are found, the response returns an empty array. A maximum of 100 blocked leaf files is returned in a single request.

Auth
Headers
apikeystring

Generated session_id from Login call can be used as an apikey for API calls that require authentication.

Path Params
data_idstring

The data_id returned by the Analyze a file API. When analyzing or sanitizing an archive, the data_id of files contained within the archive can be obtained from the Fetch analysis result API.

GET /file/{data_id}/blocked-leaves
curl --get \
--url 'http://localhost:8899/file/8101abae27be4d63859c55d9e0ed0135/blocked-leaves' \
--header 'apikey: {apikey}'
Copy
Responses
200

Successfully retrieved the list of blocked leaf files.

objectobject
details10 fieldsarray[object]

List of blocked leaf files.

limit_reachedboolean

Indicates whether more than 100 blocked leaf files were found.

totalinteger

Number of blocked leaf files returned in the details array.

404

Requests resource was not found.

405

The user has no rights for this operation.

500

Unexpected event on server.

Response
{
"details": [
{
"blocked_reasons": [
"Infected"
],
"engines": [
{
"engine": "Avira",
"threat_name": "Virus eicar test file"
}
],
"data_id": "914b95fb1a9948e5a1d9b29817ecb69f",
"display_name": "ProKey.exe",
"file_type": "application/x-dosexec",
"parent_id": "8101abae27be4d63859c55d9e0ed0135",
"path": "prokey-x64.zip\\\\ProKey.exe",
"process_info": {
"post_processing": {
"actions_failed": "Sanitization Failed | PAscript failed",
"actions_ran": "Sanitized | PAscript"
}
},
"verdicts": [
"Infected"
],
"yara_info": {
"hits": [
"source0.filesizelessthan2MB"
]
}
}
],
"limit_reached": false,
"total": 1
}
Copy

Fetch the Top 100 Extraction Errors in an Archive

Returns up to 100 extraction errors found while processing the archive identified by data_id, including errors from nested archives. The response includes:

  • total: Number of archives (root and nested) that reported extraction errors.
  • root_archive: Extraction error details for the top-level archive. Omitted if no root-level errors exist.
  • nested_archives: Extraction error details for nested archives.

If no extraction errors are found:

  • total is 0.
  • nested_archives may be empty.
  • root_archive may be omitted.

If the archive result was reused from a previous analysis, the API returns the extraction errors from that analysis. You can identify this case when original_data_id is set in the GET /file/{data_id} response. The first segment of each archive_path is updated to use the name of the requested file. This behavior is available starting with MetaDefender Cluster 2.10.0.

Auth
Headers
apikeystring

Generated session_id from Login call can be used as an apikey for API calls that require authentication.

Path Params
data_idstring

Data identifier of the original (root) archive file.

GET /file/{data_id}/extraction-errors
curl --get \
--url 'http://localhost:8899/file/8101abae27be4d63859c55d9e0ed0135/extraction-errors' \
--header 'apikey: {apikey}'
Copy
Responses
200

Extraction error information for the specified archive.

objectobject
totalinteger

Total count of archives (root and nested) that have extraction errors.

root_archive3 fieldsobject

Error details for the root archive (present only if the root archive has an error).

nested_archives5 fieldsarray[object]

List of nested archives that encountered extraction errors.

400

Invalid request (e.g. malformed data_id or bad query parameters).

404

Requests resource was not found.

405

The user has no rights for this operation.

423

The file is still being processed; extraction errors not finalized yet.

500

Unexpected event on server.

Response
{
"total": 2,
"root_archive": {
"err_category": "ABC",
"err_details": "abc",
"err_description": "XYZ"
},
"nested_archives": [
{
"data_id": "380a60de469c4c039b7ae2e47360e344",
"archive_path": [
"root",
"level1",
"level2",
"level3_current_archive"
],
"err_category": "Invalid file structure",
"err_details": "Failed to open file...",
"err_description": "Corrupted Archive"
}
]
}
Copy

Query webhook status

Prior to being notified when webhook mode is enabled, the client can request MetaDefender Cluster API Gateway for the file processing webhook status at any time.

Auth
Headers
apikeystring

Generated session_id from Login call can be used as an apikey for API calls that require authentication.

Path Params
data_idstring

The data_id of the file to query.

GET /file/webhook/{data_id}
curl --get \
--url 'http://localhost:8899/file/webhook/{data_id}' \
--header 'apikey: {apikey}'
Copy
Responses
200

Webhook status is fetched successfully.

objectobject
data_idstring

The file submission identifier

request_timestring

A timestamp when the request has been made.

status_codeinteger

What was the returned HTTP status code.

  • 200 - Callback was sent successfully
  • 403 - ContentAccessDenied. The access to the remote content was denied (similar to HTTP(S) error 401).
  • 404 - ContentNotFoundError. The remote content was not found at the server (similar to HTTP(S) error 404).
  • 408 - TimeoutError. The connection to the remote server timed out.
  • 503 - HostNotFoundError. The remote host name was not found (invalid hostname).
  • 520 - RemoteHostClosedError. The remote server closed the connection prematurely, before the entire reply was received and processed.
  • 444 - Other error types.
urlstring

What was the called URL (should match the callbackurl header).

400

Bad Request (e.g. header is invalid, apikey is missing or invalid, parameter value is invalid or out of range, etc).

403

Invalid user information or Not Allowed

404

Requests resource was not found.

500

Unexpected event on server.

Response
{
"data_id": "j2939fh3ifoqkhwhr3h9h1h0re",
"request_time": "{string}",
"status_code": 200,
"url": "https://apigateway.corporate.com/metadefender/callbackurl"
}
Copy

Batch

Group the analysis requests in batches. Supported with endpoints: MetaDefender Cluster API Gateway.

Initiate Batch

Create a new batch and retrieve the batch_id

Auth
Headers
apikeystring

Generated session_id from Login call can be used as an apikey for API calls that require authentication.

rulestring

Select rule for the analysis, if no header given the default rule will be selected (URL encoded UTF-8 string of rule name)

user_agentstring

user_agent header used to identify (and limit) access to a particular rule. For rule selection, rule header should be used.

user-datastring

Name of the batch (max 1024 bytes, URL encoded UTF-8 string).

client-identitystring

The client-identity header identifies the clients involved in processing a file, providing greater visibility into its processing stages. The header value is a JSON object containing a clients array. Each client object supports the following fields:

  • deployment_id: REQUIRED. Unique identifier of the deployment.
  • user_name: REQUIRED. Name of the user or system that initiated the scan.
  • product_type: REQUIRED. Type of product or system performing the scan.
  • version: OPTIONAL. Version of the product or system.
  • host: OPTIONAL. Hostname or IP address of the client machine.
  • timestamp: REQUIRED. Time at which the scan was initiated, expressed in milliseconds since the Unix epoch. Example:
    {
    "clients": 
    [
    {
      "deployment_id": "abcdef1234567890",
      "user_name": "Gemini",
      "product_type": "MetaDefender Kiosk",
      "version": "1.0.0",
      "host": "client.example.com",
      "timestamp": 1744949754890
    }
    ]
    }
    URL-encode the JSON value before sending the header to MetaDefender Cluster to avoid issues caused by unsafe characters or incorrect encoding. Omit the header when client identity tracking is not required.
POST /file/batch
curl --request POST \
--url 'http://localhost:8899/file/batch' \
--header 'apikey: {apikey}' \
--header 'rule: {rule}' \
--header 'user_agent: {user_agent}' \
--header 'user-data: {user-data}' \
--header 'client-identity: %7B%22clients%22%3A%5B%7B%22deployment_id%22%3A%22abcdef1234567890%22%2C%22user_name%22%3A%22Gemini%22%2C%22product_type%22%3A%22MetaDefender%20Kiosk%22%2C%22version%22%3A%221.0.0%22%2C%22host%22%3A%22client.example.com%22%2C%22timestamp%22%3A1744949754890%7D%5D%7D
'
Copy
Responses
200

Batch created successfully.

objectobject
batch_idstring

The batch identifier used to submit files in the batch and to close the batch.

400

Bad Request (e.g. header is invalid, apikey is missing or invalid, parameter value is invalid or out of range, etc). The request is rejected before the file is processed, so no data_id is created.

When the client-identity header is present but its value is invalid, err is one of:

err Cause
Header 'client-identity' is empty The header was sent without a value.
Header 'client-identity' must be less than or equal 4096 characters The header value is longer than 4096 characters.
Header 'client-identity' contains non-printable character The value contains an ASCII control character, either directly or through an escape.
Header 'client-identity' is not in JSON format The value could not be URL-decoded, is not valid JSON, or is not a JSON object.
Header 'client-identity' does not contain a 'clients' key or empty 'clients' clients is missing, is not an array, or is an empty array.
Header 'client-identity' contains an invalid data An entry of clients is not a JSON object.
Header 'client-identity' does not contain required key '<key>' An entry is missing deployment_id, user_name, product_type or timestamp.
Header 'client-identity' contains a non-string '<key>' deployment_id, user_name or product_type is not a string.
Header 'client-identity' contains an empty '<key>' deployment_id, user_name or product_type is blank.
Header 'client-identity' contains an invalid 'deployment_id' deployment_id holds anything other than letters and digits.
Header 'client-identity' contains a non-integer 'timestamp' timestamp is not an integer.
Header 'client-identity' contains a negative 'timestamp' timestamp is zero or negative.

Every entry of clients is checked, not only the first one, and the first rule that fails is the one reported.

403

Invalid user information or Not Allowed

500

Unexpected event on server.

Response
{
"batch_id": "74c85f475147439bac4d33b181853923"
}
Copy

Close Batch

The batch will be closed and files can no longer be added to the current batch.

Auth
Headers
apikeystring

Generated session_id from Login call can be used as an apikey for API calls that require authentication.

Path Params
batchIdstring

The batch identifier used to submit files in the batch and to close the batch.

POST /file/batch/{batchId}/close
curl --request POST \
--url 'http://localhost:8899/file/batch/{batchId}/close' \
--header 'apikey: {apikey}'
Copy
Responses
200

Batch successfully closed.

objectobject

The response for a Batch status request.

batch_files5 fieldsobject

Information about the files included in this batch.

batch_idstring

The batch unique identifer

is_closedboolean

The batch status (open/close).

process_info7 fieldsobject

Overall batch process result

scan_results6 fieldsobject

Metascan analysis result.

user_datastring

Metadata submitted at batch creation.

400

Bad Request (e.g. header is invalid, apikey is missing or invalid, parameter value is invalid or out of range, etc).

403

Invalid user information or Not Allowed

404

Requests resource was not found.

500

Unexpected event on server.

Response
{
"batch_files": {
"batch_count": 4,
"current_finished_files": 4,
"files_in_batch": [
{
"data_id": "24c8b5dadd48445989ac3431544fdc34",
"detected_by": 4,
"display_name": "eicar.com",
"file_size": 68,
"file_type": "application/octet-stream",
"file_type_description": "EICAR virus test files",
"process_info": {
"blocked_reason": "Infected",
"progress_percentage": 100,
"result": "Blocked",
"verdicts": [
"Infected"
],
"client_identity": {
"clients": [
{
"deployment_id": "abcdef1234567890",
"user_name": "Gemini",
"product_type": "MetaDefender Kiosk",
"version": "1.0.0",
"host": "client.example.com",
"timestamp": 1744949754890
}
]
}
},
"progress_percentage": 100,
"scan_all_result_a": "No Threat Detected",
"scan_all_result_i": 0,
"scanned_with": 4
}
],
"first_index": 0,
"page_size": 50
},
"batch_id": "b7cc760038324b02908a5c111cb1563d",
"is_closed": true,
"process_info": {
"blocked_reason": "Infected",
"file_type_skipped_scan": false,
"profile": "File process",
"result": "Blocked",
"user_agent": "mdicapserver",
"username": "LOCAL/admin",
"client_identity": {
"clients": [
{
"deployment_id": "abcdef1234567890",
"user_name": "Gemini",
"product_type": "MetaDefender Kiosk",
"version": "1.0.0",
"host": "client.example.com",
"timestamp": 1744949754890
}
]
}
},
"scan_results": {
"batch_id": "b7cc760038324b02908a5c111cb1563d",
"scan_all_result_a": "No Threat Detected",
"scan_all_result_i": 0,
"start_time": "2020-03-12T08:37:05.427Z",
"total_avs": 0,
"total_time": 18403
},
"user_data": "http://localhost:8899/"
}
Copy

Status of Batch Analysis

Retrieve status report for the entire batch

Auth
Headers
apikeystring

Generated session_id from Login call can be used as an apikey for API calls that require authentication.

Path Params
batchIdstring

The batch identifier used to submit files in the batch and to close the batch.

Query String
firstinteger

The first item order in the list of files in this batch

minimum: 0

Default: 0

sizeinteger

The number of items to be fetched next, counting from the item order indicated in first header. The default value is 50, and the maximum value is 2000.

maximum: 2000

minimum: 0

Default: 50

GET /file/batch/{batchId}
curl --get \
--url 'http://localhost:8899/file/batch/{batchId}' \
--header 'apikey: {apikey}' \
--data first={first} \
--data size=50
Copy
Responses
200

Batch progress paginated report (50 entries/page).

objectobject

The response for a Batch status request.

batch_files5 fieldsobject

Information about the files included in this batch.

batch_idstring

The batch unique identifer

is_closedboolean

The batch status (open/close).

process_info7 fieldsobject

Overall batch process result

scan_results6 fieldsobject

Metascan analysis result.

user_datastring

Metadata submitted at batch creation.

400

Bad Request (e.g. header is invalid, apikey is missing or invalid, parameter value is invalid or out of range, etc).

403

Invalid user information or Not Allowed

404

Requests resource was not found.

500

Unexpected event on server.

Response
{
"batch_files": {
"batch_count": 4,
"current_finished_files": 3,
"files_in_batch": [
{
"data_id": "24c8b5dadd48445989ac3431544fdc34",
"detected_by": 4,
"display_name": "eicar.com",
"file_size": 68,
"file_type": "application/octet-stream",
"file_type_description": "EICAR virus test files",
"process_info": {
"blocked_reason": "Infected",
"progress_percentage": 100,
"result": "Blocked",
"verdicts": [
"Infected"
],
"client_identity": {
"clients": [
{
"deployment_id": "abcdef1234567890",
"user_name": "Gemini",
"product_type": "MetaDefender Kiosk",
"version": "1.0.0",
"host": "client.example.com",
"timestamp": 1744949754890
}
]
}
},
"progress_percentage": 100,
"scan_all_result_a": "No Threat Detected",
"scan_all_result_i": 0,
"scanned_with": 4
}
],
"first_index": 0,
"page_size": 50
},
"batch_id": "b7cc760038324b02908a5c111cb1563d",
"is_closed": false,
"process_info": {
"blocked_reason": "Infected",
"file_type_skipped_scan": false,
"profile": "File process",
"result": "Processing",
"user_agent": "mdicapserver",
"username": "LOCAL/admin",
"client_identity": {
"clients": [
{
"deployment_id": "abcdef1234567890",
"user_name": "Gemini",
"product_type": "MetaDefender Kiosk",
"version": "1.0.0",
"host": "client.example.com",
"timestamp": 1744949754890
}
]
}
},
"scan_results": {
"batch_id": "b7cc760038324b02908a5c111cb1563d",
"scan_all_result_a": "No Threat Detected",
"scan_all_result_i": 0,
"start_time": "2020-03-12T08:37:05.427Z",
"total_avs": 0,
"total_time": -1
},
"user_data": "http://localhost:8899/"
}
Copy

Download Signed Batch Result

Download digitally signed status report for the entire batch

Auth
Headers
apikeystring

Generated session_id from Login call can be used as an apikey for API calls that require authentication.

metadatastring

In JSON format, this can be used to:

Include additional information in the response YML. Currently, one supported field in the metadata is include_vul_info, which can be set to true or false to indicate whether vulnerability processing information should be included or not. It is strongly recommended to apply URL encoding before sending metadata to Metadefender Cluster API Gateway to prevent unexpected issues related to encoding errors or unsafe characters.

Path Params
batchIdstring

The batch identifier used to submit files in the batch and to close the batch.

GET /file/batch/{batchId}/certificate
curl --get \
--url 'http://localhost:8899/file/batch/{batchId}/certificate' \
--header 'apikey: {apikey}' \
--header 'metadata: {
"include_vul_info": true
}
'
Copy
Responses
200

Signed batch result and certificate are sent back in response body (YAML format).

No response body
400

Bad Request (e.g. header is invalid, apikey is missing or invalid, parameter value is invalid or out of range, etc).

403

Invalid user information or Not Allowed

404

Requests resource was not found.

500

Unexpected event on server.

Response
--- batch_id: 092876200fb54cfb80b6e3332c410ae9 user_data: the user data from the header from batch creation cert_sha1_fingerprint: <some cert serial value> batch_files:
batch_count: 1
files_in_batch:
- data_id: 9112b225f0634f189a2bb46ec1a7826f
display_name: New%20Text%20Document.txt
file_size: 5
scan_all_result_i: 0
process_info:
blocked_reason:
result: Allowed
md5: 42b130c3ce46e058f30712838cebf420
sha1: ed94baf55ca851055fb76045f6949bca2f865605
sha256: f4191b3ec6ce93aaf712919a38e52815c5da9c91d2b141df920bc8bcb5cbb8e3
sha512: ""
vulnerabilities:
- cve: CVE-2021-45463
cvss:
score: 6.8
cvss_3_0:
base_score: 7.8
- cve: CVE-2018-12713
cvss:
score: 6.4
cvss_3_0:
base_score: 9.1
process_info:
blocked_reason:
file_type_skipped_scan: false
profile: File scan
result: Allowed
user_agent: webscan
scan_results:
scan_all_result_a: No Threat Detected
scan_all_result_i: 0
start_time: 2017-05-23T11:22:03.010Z
total_avs: 14
total_time: 995
...
--- signature: 881d22220c4ca0557d7c7d5c5794d53a8a2780997cd65b27b6e7f1c099a15de03dbcb5edbeaea7aafa6099fab37be07017b39e3e3a7d66c550f44eb59a096c54d5b9555cb28198546fbec57c33b717751d333a09733d95dd876e2798d044c8caef828f4352b91f9a6d057253bb1a9461e0e0e0bf4313a80895998d645bebc81841ff3499589c80ffc4e8a190d1ec9b3e4126d86659d303b0e1f22d9289c9c4671d35532b55ad4620e048a78bb405b573897da63efdd5f036692c934a82d9bdc9b9862e7fea5e8abeeb1444be0689d50373c5c0632484950c0fe0337ed5f91bdf26986f7cff8aa3431bf4bc948fc127c16ba13ec679fe9f67e7586075c1f467454fa8cf40e9cd501291c95d862eb16f4477c17d1711294f0ff2b3a1140bd53dbd1fbb0846af6062e9e4e2e1a09af3448503ed11e342164e535fc268bf7d8fbc28ed946cd2bb8ea075f2295d2fa8392076d41608c3b5decf8fab3a5ec7de190f07583331e0517e5f361735cd59326622dc8b07b10a464028de781a063e408f918c1d5534329140f4e4dc1a717d808d6784410410b00d36cb9a345f5bbc11fa1c58ee28f8e7b863f3ea2c923ec5fb2ac29eaa4ddc0d6d9dfd3f16a97f207dc2858410a577c7f4a92ff01bad3229f5fcdb08e21df9869a113272aa9d96bfdfe8bfb3a50414c174e16a3504e5780c2718779b0757298546f287ef7ea86e67510d48a8 certificate: |
-----BEGIN CERTIFICATE-----
MIIGJzCCBA+gAwIBAgIBATANBgkqhkiG9w0BAQUFADCBsjELMAkGA1UEBhMCRlIx
DzANBgNVBAgMBkFsc2FjZTETMBEGA1UEBwwKU3RyYXNib3VyZzEYMBYGA1UECgwP
d3d3LmZyZWVsYW4ub3JnMRAwDgYDVQQLDAdmcmVlbGFuMS0wKwYDVQQDDCRGcmVl
bGFuIFNhbXBsZSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkxIjAgBgkqhkiG9w0BCQEW
E2NvbnRhY3RAZnJlZWxhbi5vcmcwHhcNMTIwNDI3MTAzMTE4WhcNMjIwNDI1MTAz
MTE4WjB+MQswCQYDVQQGEwJGUjEPMA0GA1UECAwGQWxzYWNlMRgwFgYDVQQKDA93
d3cuZnJlZWxhbi5vcmcxEDAOBgNVBAsMB2ZyZWVsYW4xDjAMBgNVBAMMBWFsaWNl
MSIwIAYJKoZIhvcNAQkBFhNjb250YWN0QGZyZWVsYW4ub3JnMIICIjANBgkqhkiG
9w0BAQEFAAOCAg8AMIICCgKCAgEA3W29+ID6194bH6ejLrIC4hb2Ugo8v6ZC+Mrc
k2dNYMNPjcOKABvxxEtBamnSaeU/IY7FC/giN622LEtV/3oDcrua0+yWuVafyxmZ
yTKUb4/GUgafRQPf/eiX9urWurtIK7XgNGFNUjYPq4dSJQPPhwCHE/LKAykWnZBX
RrX0Dq4XyApNku0IpjIjEXH+8ixE12wH8wt7DEvdO7T3N3CfUbaITl1qBX+Nm2Z6
q4Ag/u5rl8NJfXg71ZmXA3XOj7zFvpyapRIZcPmkvZYn7SMCp8dXyXHPdpSiIWL2
uB3KiO4JrUYvt2GzLBUThp+lNSZaZ/Q3yOaAAUkOx+1h08285Pi+P8lO+H2Xic4S
vMq1xtLg2bNoPC5KnbRfuFPuUD2/3dSiiragJ6uYDLOyWJDivKGt/72OVTEPAL9o
6T2pGZrwbQuiFGrGTMZOvWMSpQtNl+tCCXlT4mWqJDRwuMGrI4DnnGzt3IKqNwS4
Qyo9KqjMIPwnXZAmWPm3FOKe4sFwc5fpawKO01JZewDsYTDxVj+cwXwFxbE2yBiF
z2FAHwfopwaH35p3C6lkcgP2k/zgAlnBluzACUI+MKJ/G0gv/uAhj1OHJQ3L6kn1
SpvQ41/ueBjlunExqQSYD7GtZ1Kg8uOcq2r+WISE3Qc9MpQFFkUVllmgWGwYDuN3
Zsez95kCAwEAAaN7MHkwCQYDVR0TBAIwADAsBglghkgBhvhCAQ0EHxYdT3BlblNT
TCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFFlfyRO6G8y5qEFKikl5
ajb2fT7XMB8GA1UdIwQYMBaAFCNsLT0+KV14uGw+quK7Lh5sh/JTMA0GCSqGSIb3
DQEBBQUAA4ICAQAT5wJFPqervbja5+90iKxi1d0QVtVGB+z6aoAMuWK+qgi0vgvr
mu9ot2lvTSCSnRhjeiP0SIdqFMORmBtOCFk/kYDp9M/91b+vS+S9eAlxrNCB5VOf
PqxEPp/wv1rBcE4GBO/c6HcFon3F+oBYCsUQbZDKSSZxhDm3mj7pb67FNbZbJIzJ
70HDsRe2O04oiTx+h6g6pW3cOQMgIAvFgKN5Ex727K4230B0NIdGkzuj4KSML0NM
slSAcXZ41OoSKNjy44BVEZv0ZdxTDrRM4EwJtNyggFzmtTuV02nkUj1bYYYC5f0L
ADr6s0XMyaNk8twlWYlYDZ5uKDpVRVBfiGcq0uJIzIvemhuTrofh8pBQQNkPRDFT
Rq1iTo1Ihhl3/Fl1kXk1WR3jTjNb4jHX7lIoXwpwp767HAPKGhjQ9cFbnHMEtkro
RlJYdtRq5mccDtwT0GFyoJLLBZdHHMHJz0F9H7FNk2tTQQMhK5MVYwg+LIaee586
CQVqfbscp7evlgjLW98H+5zylRHAgoH2G79aHljNKMp9BOuq6SnEglEsiWGVtu2l
hnx8SB3sVJZHeer8f/UQQwqbAO+Kdy70NmbSaqaVtp8jOxLiidWkwSyRTsuU6D8i
DiH5uEqBXExjrj0FslxcVKdVj5glVcSmkLwZKbEU1OKwleT/iXFhvooWhQ==
-----END CERTIFICATE-----
...

Copy

Cancel Batch

When cancelling a batch, the connected analysis that are still in progress will be cancelled also.

The cancelled batch will be closed.

Auth
Headers
apikeystring

Generated session_id from Login call can be used as an apikey for API calls that require authentication.

Path Params
batchIdstring

The batch identifier used to submit files in the batch and to close the batch.

POST /file/batch/{batchId}/cancel
curl --request POST \
--url 'http://localhost:8899/file/batch/{batchId}/cancel' \
--header 'apikey: {apikey}'
Copy
Responses
200

Batch cancelled.

objectobject
400

Bad Request (e.g. header is invalid, apikey is missing or invalid, parameter value is invalid or out of range, etc).

403

Invalid user information or Not Allowed

404

Batch not found (invalid id)

500

Unexpected event on server.

Response
{
"<<batch_id>>": "cancelled"
}
Copy

License

Retrieve the current license information.

Get current license information

Fetch details about the longest expiry active license among all activated licenses.

Auth
Headers
apikeystring

Generated session_id from Login call can be used as an apikey for API calls that require authentication.

GET /admin/license
curl --get \
--url 'http://localhost:8899/admin/license' \
--header 'apikey: {apikey}'
Copy
Responses
200

Information about the licensed product (product type, number of activations, deploymentId, expiration date and days left)

objectobject

Information about the licensed product (product type, number of activations, deploymentId, expiration date and days left)

days_leftinteger

Number of days left before expiration

expirationstring

Expiration date in MM/DD/YYYY format.

licensed_enginesarray[string]

List of engine/module identifiers that have been licensed

licensed_tostring

Name of the entity to which the license is issued.

max_agent_countstring

Total number of deployed MetaDefender Agents attached to this MetaDefender Core instance.

online_activatedboolean

Track online/offline activation mode

product_idstring

Official MetaDefender base SKU licensed.

product_namestring

Official MetaDefender base product name licensed.

403

Invalid user information or Not Allowed

405

The user has no rights for this operation.

500

Unexpected event on server.

Response
{
"activation_key": "",
"days_left": 3731,
"deployment": "",
"expiration": "09/30/2026",
"licensed_engines": "*",
"licensed_to": "OPSWAT, Inc.",
"max_agent_count": "10",
"online_activated": true,
"product_id": "MSCL-4-unlimited",
"product_name": "Metadefender Core 5 Linux"
}
Copy

Stats

Health check and statistics about MetaDefender Core instance usage.

Engine Status

Return the status of the latest engines between the MetaDefender Core instances.

Auth
Headers
apikeystring

Generated session_id from Login call can be used as an apikey for API calls that require authentication.

GET /stat/engines
curl --get \
--url 'http://localhost:8899/stat/engines' \
--header 'apikey: {apikey}'
Copy
Responses
200

An array with all the engines and their details.

arrayarray[object]
abandonedboolean

Indicates if this engine is abandoned.

activeboolean

If used by at least one engine

def_timestring

The database definition time for this engine

download_progressinteger

The percentage progress of download

download_timestring

When this engine downloaded from the update server.

eng_idstring

Engine internal ID

eng_namestring

Engine name

eng_typestring

Engine type in human readable form

eng_verstring

Engine's version (format differs from one engine to another).

engine_typestring

Engine's type:

  • av
  • archive
  • filetype

Enum: av,archive,filetype

pinnedboolean

Indicate if this engine is pinned.

statestring

Status of the engine:

  • downloading
  • downloaded
  • staging
  • production
  • removed
  • temporary failed
  • permanently failed
  • content invalid
  • download failed

Enum: downloading,downloaded,staging,production,removed,temporary failed,permanently failed,content invalid,download failed

typestring

The type of information, whether it is engine or engine's database.

Response
[
{
"abandoned": false,
"active": true,
"def_time": "2020-04-17T02:37:05.000Z",
"download_progress": 100,
"download_time": "2020-04-17T08:17:22.810Z",
"eng_id": "clamav_1_linux",
"eng_name": "ClamAV",
"eng_type": "Bundled engine",
"eng_ver": "3.0-43",
"engine_type": "av",
"notified_messages": [],
"pinned": false,
"state": "production",
"type": "engine"
}
]
Copy

Instance Status Overview

Retrieve status details of all available MetaDefender Core instances.

Auth
Headers
apikeystring

Generated session_id from Login call can be used as an apikey for API calls that require authentication.

GET /stat/nodes
curl --get \
--url 'http://localhost:8899/stat/nodes' \
--header 'apikey: {apikey}'
Copy
Responses
200

Status details of MetaDefender Core instances.

objectobject
external_nodes_allowedboolean

Indicates whether external nodes can connect; always true.

max_node_countinteger

Total number of available MetaDefender Core instances.

statuses18 fieldsarray[object]

List of MetaDefender Core instance status details.

403

Invalid user information or Not Allowed

405

The user has no rights for this operation.

Response
{
"external_nodes_allowed": true,
"max_node_count": 1,
"statuses": [
{
"address": "{string}",
"available_mem": 2825,
"cpu_cores": 8,
"current_processing_files": 24,
"engines": [
{
"active": true,
"db_ver": "25050",
"def_time": "2020-04-17T02:37:05.000Z",
"download_time": "2020-04-17T04:32:05.000Z",
"eng_name": "ClamAV",
"eng_ver": "3.0-43",
"engine_type": "av",
"id": "clamav_1_linux",
"issues": []
}
],
"free_disk_space": 1739928,
"id": "ecc114e4fc0bbb4f8382c881617b4480",
"info_disk_space": [
{
"dirs": [
"core_log_path",
"data",
"dlp",
"installation",
"nginx_log_path",
"quarantine",
"resource",
"sanitized"
],
"free": 1739928,
"location": "C",
"total": 500000878592
}
],
"issues": [
{
"description": "1 engines are not deployed to this Core",
"severity": "warning"
}
],
"load": 14,
"os": "Linux Mint 18.3 Sylvia",
"scan_queue": 24,
"scan_queue_details": {
"archive_scan_queue_ratio": -1,
"available_slots": -1,
"extracted_file_slots": 50,
"file_slots": 10,
"total_scan_queue": -1
},
"total_disk_space": 500000878592,
"total_mem": 40100,
"total_scan_queue": -1,
"uptime": 12791,
"version": "5.15.1"
}
]
}
Copy

Get health check status

Fetch current status of system health.

Auth
Query String
verboseboolean

Optional. Show detailed result of system health.

GET /readyz
curl --get \
--url 'http://localhost:8899/readyz' \
--data verbose=true
Copy
Responses
200

System is currently healthy.

objectobject

System readiness / health status.

statusboolean

System-wide status, indicate if all components are healthy.

scan_queueobject

Scan queue status.

number_in_queueinteger

Number of objects being processed by the system.

statusboolean

The operational status of the scan process; true if the system contains the required minimum of healthy MetaDefender Core instances.

licenseobject

License status.

statusstring

License status.

Enum: expired,invalid,ok

components7 fieldsobject

Core component statuses.

ometascan3 fieldsobject

Status of MetaDefender Core instances

callback-serviceobject

Webhook callback service status.

statusboolean

Callback service overall status.

instancearray[string]

List of instance status.

download-serviceobject

MetaDefender Cluster Download Service status (scan from link). This status does not affect the overall system status: when it is unhealthy, only file submissions with the downloadfrom header are refused.

statusboolean

Download Service overall status. true when at least one instance is healthy, or when no instance is deployed.

instancearray[string]

List of instance status.

500

Unexpected event on server.

503

System is currently unhealthy.

Response
{
"status": true,
"scan_queue": {
"number_in_queue": 42,
"status": true
},
"license": {
"status": "ok"
},
"components": {
"status": true,
"clusterdb": {
"status": true,
"detail": "Healthy"
},
"datalake": {
"status": true,
"detail": "Healthy"
},
"caching": {
"status": true,
"detail": "Healthy"
},
"broker": {
"status": true,
"detail": "Healthy"
},
"filestorage": {
"status": true,
"detail": "Healthy"
},
"identity": {
"status": true,
"detail": "Healthy"
}
},
"ometascan": {
"status": true,
"detail": "All MetaDefender Core instances healthy.",
"instance": [
"8ff354cb076e154893dbf61734f3cf8e: Healthy",
"a1b2c3d4e5f60718293a4b5c6d7e8f90: Healthy"
]
},
"callback-service": {
"status": true,
"instance": [
"8a5a6bfaad1e4c0caf7da10785fa9e8a: Healthy"
]
},
"download-service": {
"status": true,
"instance": [
"d039f0ee3f8440e5ab89927e10ffdc76: Healthy"
]
}
}
Copy