Code Examples
Here are examples of how to interact with the API in Python, JavaScript, and cURL.
import requests
# Configuration
API_BASE = "https://www.stigviewer.com/api/v1"
TOKEN = "ss_token_app_..."
STIG_SLUG = "microsoft_windows_server_2022"
# Download the raw benchmark JSON (the default format is a CKLB checklist,
# which has a different shape, so request format=json explicitly here).
response = requests.get(
f"{API_BASE}/stigs/{STIG_SLUG}/download?format=json",
headers={"Authorization": f"Bearer {TOKEN}"}
)
if response.status_code == 200:
stig_data = response.json()
print(f"Downloaded {len(stig_data['groups'])} findings")
else:
print(f"Error: {response.json()}")