Quick Start

Copy-paste examples for your first API call. No API key required.

1 cURL

Copy, paste, run.

bashcurl https://api.contrastcyber.com/cve_lookup/CVE-2024-3094
bash# Search: critical CVEs in CISA KEV, newest first curl "https://api.contrastcyber.com/cve_search?severity=CRITICAL&in_kev=true&limit=5" # What to patch first for one vendor curl "https://api.contrastcyber.com/cve_triage?vendor=apache&min_risk_score=70" # Public exploits for a CVE (1 credit) curl https://api.contrastcyber.com/cve_exploit/CVE-2021-44228 # Bulk lookup curl -X POST https://api.contrastcyber.com/cve_lookup_bulk \ -H "Content-Type: application/json" \ -d '{"cve_ids": ["CVE-2021-44228", "CVE-2024-3094"]}'

2 Node.js

npm No SDK needed. Just fetch. Call the API from a server, not from a browser page: it sends no CORS headers.

javascript// CVE lookup const res = await fetch('https://api.contrastcyber.com/cve_lookup/CVE-2024-3094'); const vuln = await res.json(); console.log(vuln.severity); // "CRITICAL", "HIGH", "MEDIUM", "LOW" or "NONE" console.log(vuln.epss_score); // 0.0 - 1.0 console.log(vuln.in_kev); // true or false // Composite risk score const risk = await fetch('https://api.contrastcyber.com/cve_risk_score/CVE-2024-3094'); console.log((await risk.json()).label); // "CRITICAL", "HIGH", "MEDIUM" or "LOW"

3 Python

pythonimport requests # Leading CVEs by exploitation probability r = requests.get('https://api.contrastcyber.com/cve_leading', params={'limit': 5}) print(r.json()) # Rank your own CVE list by risk r = requests.post('https://api.contrastcyber.com/cve_triage_bulk', json={'cve_ids': ['CVE-2021-44228', 'CVE-2014-0160', 'CVE-2017-0144']}) print(r.json())

Call it from code over MCP: agent frameworks can use the same data as tools. See MCP setup.

4 CI: fail on KEV CVEs

Your scanner step writes the CVE IDs it found to cves.txt, one per line. This step fails the build when one of them is in CISA KEV. Without a key, a run spends the 30 credits per hour of its runner's IP address, one per ID, so a longer list fails as unchecked. A key raises the budget to 500 credits per hour. It sends each ID once, because a request that names an ID twice is refused. It also fails when an ID was not checked: the budget did not cover it, or the line is not a well-formed CVE ID.

yaml# .github/workflows/security.yml # cves.txt: one CVE ID per line, written by your scanner step - name: Fail when a found CVE is in CISA KEV env: CONTRASTAPI_API_KEY: ${{ secrets.CONTRASTAPI_API_KEY }} run: | test -e cves.txt grep -q . cves.txt || exit 0 sort -u cves.txt | grep . | split -l 50 - batch_ for f in batch_*; do jq -Rn '{cve_ids: [inputs]}' "$f" | curl -sf -X POST https://api.contrastcyber.com/cve_lookup_bulk \ -H "Authorization: Bearer $CONTRASTAPI_API_KEY" \ -H "Content-Type: application/json" -d @- > "$f.json" jq -e '(.not_processed | length == 0) and .skipped == 0' "$f.json" > /dev/null done jq -r '.results[] | select(.in_kev) | .cve_id' batch_*.json | tee kev.txt test ! -s kev.txt

5 With a Pro API Key (optional)

Free tier is 30 credits/hr. Add an Authorization: Bearer contrastapi_... header, or an X-API-Key: contrastapi_... header, to unlock 500 credits/hr and monitoring of CVEs, packages, domains and IP addresses.

bash# cURL with Pro key curl -H "Authorization: Bearer $CONTRASTAPI_API_KEY" \ https://api.contrastcyber.com/cve_exploit/CVE-2021-44228
javascript// Node.js, key from env const res = await fetch('https://api.contrastcyber.com/cve_exploit/CVE-2021-44228', { headers: { 'Authorization': `Bearer ${process.env.CONTRASTAPI_API_KEY}` } }); console.log(res.headers.get('X-RateLimit-Remaining')); // credits left this hour
pythonimport os, requests headers = {'Authorization': f'Bearer {os.environ["CONTRASTAPI_API_KEY"]}'} r = requests.get('https://api.contrastcyber.com/cve_exploit/CVE-2021-44228', headers=headers) print(r.headers['X-RateLimit-Remaining'])