Malware File Scanner & Analysis API
Instantly upload and analyze files to detect hidden malware, viruses, and trojans. Our API combines signature-based scanning with behavioral analysis to identify zero-day threats and ensure complete file security.
How to use?
You need to use the POST request with the file data and your API key. The request should be formatted as 'multipart/form-data'.
Request:
| Field | Type | Description |
|---|---|---|
| apikey | String | Your unique API key that authenticates requests to our services. |
| file | File | The file to be checked, uploaded as multipart/form-data. |
Example:
curl -X POST https://inspector.gridinsoft.com/api/v1/file/check \
-H 'Content-Type: multipart/form-data' \
-F 'apikey=YOUR_PRIVATE_APIKEY' \
-F 'file=@/path/to/your/file'
Response:
| Field | Type | Description |
|---|---|---|
| sha256 | String | SHA-256 hash of the file. |
| md5 | String | MD5 hash of the file. |
| filename | String | Name of the file. |
| size | Integer | Size of the file in bytes. |
| detection | String | Detected malware or threat category, if any. |
| type | String | Description of the file type. |
| heuristic | Object | Heuristic analysis indicates whether the file is malicious or harmless. For premium users, detailed analysis is available, highlighting signs of suspicion. |
| PE | Object | PE data in an executable (EXE) file refers to the Portable Executable format, which is a file format for executables, object code, DLLs, FON Font files, and others used in 32-bit and 64-bit versions of Windows operating systems. Available for paid plans |
For programming languages
Using one of these samples is the easiest way to start using our API. Feel free to add additional functionalities as needed.
import requests
url = "https://inspector.gridinsoft.com/api/v1/file/check"
files = {'file': open('local_file.exe', 'rb')}
data = {'apikey': 'YOUR_PRIVATE_APIKEY'}
response = requests.post(url, files=files, data=data)
print(response.json())
$filePath = "file.exe"
$apiKey = "YOUR_PRIVATE_APIKEY"
$boundary = [System.Guid]::NewGuid().ToString()
$LF = "`r`n"
$bodyLines = ("--$boundary", 'Content-Disposition: form-data; name="file"; filename="file.exe"', "Content-Type: application/octet-stream$LF", [System.IO.File]::ReadAllBytes($filePath), "--$boundary", "Content-Disposition: form-data; name=`"apikey`"$LF", "$apiKey", "--$boundary--$LF") -join $LF
Invoke-RestMethod -Uri "https://inspector.gridinsoft.com/api/v1/file/check" -Method Post -Body ([System.Text.Encoding]::UTF8.GetBytes($bodyLines)) -ContentType "multipart/form-data; boundary=`"$boundary`""
const formData = new FormData();
formData.append('file', fileInput.files[0]);
formData.append('apikey', "YOUR_PRIVATE_APIKEY");
const response = await fetch("https://inspector.gridinsoft.com/api/v1/file/check", {
method: 'POST',
body: formData
});
console.log(await response.json());
val client = OkHttpClient()
val requestBody = MultipartBody.Builder()
.setType(MultipartBody.FORM)
.addFormDataPart("apikey", "YOUR_PRIVATE_APIKEY")
.addFormDataPart("file", "file.exe", RequestBody.create(MediaType.parse("application/octet-stream"), File("file.exe")))
.build()
val response = client.newCall(Request.Builder().url("https://inspector.gridinsoft.com/api/v1/file/check").post(requestBody).build()).execute()
println(response.body?.string())
func main() {
var buf bytes.Buffer
w := multipart.NewWriter(&buf)
f, _ := os.Open("file.exe")
part, _ := w.CreateFormFile("file", "file.exe")
io.Copy(part, f)
w.WriteField("apikey", "YOUR_PRIVATE_APIKEY")
w.Close()
res, _ := http.Post("https://inspector.gridinsoft.com/api/v1/file/check", w.FormDataContentType(), &buf)
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
curl -X POST "https://inspector.gridinsoft.com/api/v1/file/check" \
-F "apikey=YOUR_PRIVATE_APIKEY" \
-F "file=@/path/to/your/file.exe"
- JSON Parsing: The script uses `jq` to parse the JSON response. Make sure `jq` is installed on your system to use this feature.
- HTTP Status Codes: It captures the HTTP status code to determine whether the request was successful (`200 OK`) or if there was an error. This helps in determining the appropriate action based on the response code.
- Output Handling: The script now properly separates the response handling and error messages, improving the readability and user experience when interacting with the script.
require 'rest-client'
response = RestClient.post("https://inspector.gridinsoft.com/api/v1/file/check",
file: File.new("file.exe", "rb"),
apikey: "YOUR_PRIVATE_APIKEY"
)
puts response.body
$ch = curl_init('https://inspector.gridinsoft.com/api/v1/file/check');
curl_setopt($ch, CURLOPT_POSTFIELDS, [
'apikey' => 'YOUR_PRIVATE_APIKEY',
'file' => new CURLFile('/path/to/your/file.exe')
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
echo curl_exec($ch);
curl_close($ch);
using var client = new HttpClient();
using var form = new MultipartFormDataContent();
form.Add(new ByteArrayContent(File.ReadAllBytes("file.exe")), "file", "file.exe");
form.Add(new StringContent("YOUR_PRIVATE_APIKEY"), "apikey");
var res = await client.PostAsync("https://inspector.gridinsoft.com/api/v1/file/check", form);
Console.WriteLine(await res.Content.ReadAsStringAsync());
// Using cpprestsdk
void check_file() {
http_client client(U("https://inspector.gridinsoft.com/api/v1/file/check"));
auto form = new multipart_form_data_content();
form->add(istream_body(U("file.exe")), U("file"));
form->add({U("YOUR_PRIVATE_APIKEY")}, U("apikey"));
client.request(methods::POST, U(""), form).then([](http_response res) {
std::wcout << res.extract_json().get().serialize() << std::endl;
}).wait();
}
// Standard Java 11+ doesn't have built-in multipart/form-data helper.
// Best to use a library like Apache HttpClient or OkHttp for conciseness.
// Here is a conceptual example using OkHttp:
OkHttpClient client = new OkHttpClient();
RequestBody body = new MultipartBody.Builder()
.setType(MultipartBody.FORM)
.addFormDataPart("apikey", "YOUR_PRIVATE_APIKEY")
.addFormDataPart("file", "file.exe", RequestBody.create(new File("file.exe"), MediaType.parse("application/octet-stream")))
.build();
Request request = new Request.Builder().url("https://inspector.gridinsoft.com/api/v1/file/check").post(body).build();
System.out.println(client.newCall(request).execute().body().string());
// Use reqwest = { version = "0.11", features = ["blocking", "multipart"] }
fn main() -> Result<(), Box<dyn std::error::Error>> {
let form = reqwest::blocking::multipart::Form::new()
.file("file", "file.exe")?
.text("apikey", "YOUR_PRIVATE_APIKEY");
let client = reqwest::blocking::Client::new();
let res = client.post("https://inspector.gridinsoft.com/api/v1/file/check")
.multipart(form)
.send()?;
println!("{}", res.text()?);
Ok(())
}
var request = URLRequest(url: URL(string: "https://inspector.gridinsoft.com/api/v1/file/check")!)
request.httpMethod = "POST"
let boundary = "Boundary-\(UUID().uuidString)"
request.setValue("multipart/form-data; boundary=\(boundary)", forHTTPHeaderField: "Content-Type")
var body = Data()
body.append("--\(boundary)\r\nContent-Disposition: form-data; name=\"apikey\"\r\n\r\nYOUR_PRIVATE_APIKEY\r\n".data(using: .utf8)!)
body.append("--\(boundary)\r\nContent-Disposition: form-data; name=\"file\"; filename=\"file.exe\"\r\nContent-Type: application/octet-stream\r\n\r\n".data(using: .utf8)!)
body.append(try! Data(contentsOf: URL(fileURLWithPath: "file.exe")))
body.append("\r\n--\(boundary)--\r\n".data(using: .utf8)!)
request.httpBody = body
URLSession.shared.dataTask(with: request) { data, _, _ in
if let data = data, let result = String(data: data, encoding: .utf8) { print(result) }
}.resume()