API Workflow Guide

API Workflow Guide for MetaDefender Sandbox (previously known as OPSWAT Filescan Sandbox)

1. Log in to your instance using the provided email address and initial password (the Sandbox API key should be also be provided, and it can be re-generated any time)

If you deployed your instance on-premise, then please check that the MetaDefender Cloud Reputation API MetaDefender Cloud Reputation Service is configured correctly on your instance!

This is highly recommended to get the most accurate verdict and a more comprehensive scan report!

2. Browse the Sandbox API documentation at:

a. https://www.filescan.io/api/docs (some endpoints will only be displayed when logged in)

b. Feel free to use the “Try it out” feature for any endpoints.

https://docs.opswat.com/filescan/metadefender-sandbox-api-reference

3. Suggested API workflow:

a. Calculate the SHA-256 hash of your sample and call the Sandbox Reputation API:

https://docs.opswat.com/filescan/metadefender-sandbox-api-reference#get-reputation-hash-api-reputation-hash-get

Example request:

Curl
Copy

Make sure the reputation feature is enabled if you are using a local instance. See: https://docs.opswat.com/filescan/integrations/reputation-api-integration

If the overall_verdict in the response is likely_malicious or malicious, then skip the next steps.

More information about Sandbox verdicts: Report Verdict

b. Submit the file for analysis using the Scan File API: https://docs.opswat.com/filescan/metadefender-sandbox-api-reference#scan-file-api-scan-file-post

Example request:

Curl
Copy

Example response (note the flow_id field):

Flow_id
Copy

c. Poll the /api/scan/{flow_id}/report API endpoint using the flow_id obtained in the previous step. The recommended polling frequency is 2 seconds.

Example request:

Curl
Copy

Example Response:

Example
Copy

If the allFinished field is true, the scan can be considered complete. If the overallState is success or success_partial, then finalVerdict.verdict will contain the actual verdict for the sample. If the scan failed for some reason, it is recommended to retry the scan operation for this sample.

Special case for archives

If the submitted file was an archive, the response will also contain a sourceArchive object and it is recommended to check the sourceArchive.verdict field to get a derived verdict that applies to the whole archive. For example:

JSON
Copy

d. If more information is needed about a given analysis, then the /api/scan/{flow_id}/report API endpoint can be queried using additional filters (e.g. allTags, allSignalGroups). This extended query can return a substantially larger JSON:

JSON
Copy
Type to search, ESC to discard
Type to search, ESC to discard
Type to search, ESC to discard