Scan File
The Scan File endpoint allows you to upload a file for full threat analysis.
Use this when you need a deep scan instead of a quick hash lookup.
Endpoint Summary
| Method |
Endpoint |
| POST |
/scan/file |
| Parameter |
Type |
Required |
Description |
file |
Binary |
Yes |
The file to be scanned. |
requestId |
String |
No |
Optional ID for tracking. |
metadata |
Object |
No |
Custom attributes (e.g., deviceId, username). |
Note: Maximum file size depends on your plan. Larger files may take longer to analyze.
| Header |
Value |
Authorization |
Bearer YOUR_API_KEY |
Content-Type |
multipart/form-data |
Example Requests
JavaScript (Node.js)
import fs from "fs";
import FormData from "form-data";
import axios from "axios";
const form = new FormData();
form.append("file", fs.createReadStream("./sample.pdf"));
axios.post("https://api.cybershield.com/scan/file", form, {
headers: {
Authorization: "Bearer YOUR_API_KEY",
...form.getHeaders()
}
})
.then(res => console.log("Scan submitted:", res.data))
.catch(err => console.error("Error:", err.response?.data || err.message));
Python
import requests
url = "https://api.cybershield.com/scan/file"
files = {"file": open("sample.pdf", "rb")}
headers = {
"Authorization": "Bearer YOUR_API_KEY"
}
response = requests.post(url, files=files, headers=headers)
print(response.json())
Example Response
{
"scanId": "8fe21ac4-789b-4e21-aa2e-9cbbad11e892",
"status": "processing",
"estimatedCompletion": "3-5 seconds",
"requestId": "optional-user-tracking-id",
"message": "File received and queued for scanning."
}
Common Response Fields
| Field |
Description |
scanId |
Unique identifier for retrieving final results. |
status |
processing, completed, or failed. |
message |
Provides additional processing information. |
estimatedCompletion |
Approximate analysis duration. |
Error Handling
| Error Code |
Meaning |
Fix |
401 Unauthorized |
Missing or invalid API key |
Confirm your API key. |
413 Payload Too Large |
File exceeds allowed limit |
Compress or reduce file size. |
415 Unsupported Media Type |
File type not supported |
Use a supported format. |
429 Too Many Requests |
Rate limit exceeded |
Retry with exponential backoff. |
Next Step
Once submitted, retrieve your scan result using:
➡ Get Report