Scan API
Scan API
Submit URLs for security scanning and retrieve detailed vulnerability reports.
Scan Workflow
pending
Scan queued and waiting to start
scanning
Scan in progress
completed
Scan finished successfully
failed
Scan encountered an error
Endpoints
POST
/api/v1/scans/urlSubmit a URL for security scanning
Request Body
urlstring
required
GitHub, npm, or PyPI URL to scanbranchstring
Git branch to scan (default: main/master)webhookstring
URL to POST results when scan completesGET
/api/v1/scans/:scanIdGet scan status and results
Path Parameters
scanIdstring
The scan ID returned from the submit endpointGET
/api/v1/scans/:scanId/vulnerabilitiesGet detailed vulnerability findings
Query Parameters
severitystring
Filter: critical, high, medium, low, infocategorystring
Filter by vulnerability categorypagenumber
Page number (default: 1)Examples
Request
Submit URL for scanning
curl -X POST https://api.mcpsafe.org/api/v1/scans/url \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"url": "https://github.com/owner/repo",
"branch": "main"
}'Response
202 Accepted
{
"success": true,
"data": {
"scanId": "scan_abc123xyz",
"status": "pending",
"url": "https://github.com/owner/repo",
"createdAt": "2024-01-15T10:30:00Z",
"estimatedCompletionTime": "2024-01-15T10:31:00Z"
}
}Polling vs Webhooks
Polling
Check scan status periodically
- Simple to implement
- No public endpoint needed
- Uses more API calls
Recommended polling interval: 5-10 seconds
Webhooks
Receive results when ready
- Real-time notifications
- No polling overhead
- Requires public HTTPS endpoint
Webhook payloads include full scan results