Snyk is a developer-first security platform that helps identify and fix vulnerabilities in code, open-source libraries, containers, and infrastructure as code. It integrates into your development workflow, enabling continuous security monitoring, license compliance checks, and proactive vulnerability management. The SnykHandler provides programmatic access to the Snyk REST API. It allows you to retrieve organizations, projects, issues, vulnerabilities, dependencies, container images, and more. You can also monitor projects and dependencies for vulnerabilities.

Example

To create the SnykHandler object with credentials:
import os
from superagentx_handlers.snyk import SnykHandler

snyk_handler = SnykHandler(
    api_token=os.getenv("SNYK_API_TOKEN"),
    base_url="https://api.snyk.io/rest",  # default
    version="2024-10-15"                  # default
)
Get Organizations (get_organizations):
Retrieve all organizations accessible to the user.
orgs = await snyk_handler.get_organizations()
print(orgs)
Get Projects (get_projects):
Retrieve all projects for a specific organization.
projects = await snyk_handler.get_projects(org_id="your-org-id")
print(projects)
Get Project Issues (get_project_issues):
Retrieve all issues for a specific project.
issues = await snyk_handler.get_project_issues(org_id="your-org-id", project_id="your-project-id")
print(issues)
Get Vulnerabilities (get_vulnerabilities):
Retrieve vulnerabilities for an organization, with optional severity filter.
vulns = await snyk_handler.get_vulnerabilities(org_id="your-org-id", severity="high")
print(vulns)
Get Licenses (get_licenses):
Retrieve license issues for an organization.
licenses = await snyk_handler.get_licenses(org_id="your-org-id")
print(licenses)
Get Dependencies (get_dependencies):
Retrieve dependencies for a specific project.
deps = await snyk_handler.get_dependencies(org_id="your-org-id", project_id="your-project-id")
print(deps)
Get Container Images (get_container_images):
Retrieve container images for an organization.
images = await snyk_handler.get_container_images(org_id="your-org-id")
print(images)
Get Container Image Details (get_container_image):
Retrieve details for a specific container image.
image = await snyk_handler.get_container_image(org_id="your-org-id", image_id="image-123")
print(image)
Update Container Image Target Refs (update_container_image_target_refs):
Update target references for a container image.
response = await snyk_handler.update_container_image_target_refs(
    org_id="your-org-id",
    image_id="image-123",
    target_refs_data=[{"type": "target", "id": "target-456"}]
)
print(response)
Monitor Dependency Graph (monitor_dep_graph):
Monitor a dependency graph for vulnerabilities.
results = await snyk_handler.monitor_dep_graph(dep_graph_data={"graph": {...}})
print(results)
Test Project (test_project):
Test a project for vulnerabilities.
results = await snyk_handler.test_project(org_id="your-org-id", project_id="your-project-id")
print(results)
Get Users (get_users):
Retrieve users in an organization.
users = await snyk_handler.get_users(org_id="your-org-id")
print(users)
Get Integrations (get_integrations):
Retrieve integrations for an organization.
integrations = await snyk_handler.get_integrations(org_id="your-org-id")
print(integrations)
Get Targets (get_targets):
Retrieve targets in an organization.
targets = await snyk_handler.get_targets(org_id="your-org-id")
print(targets)
Get Apps (get_apps):
Retrieve apps for an organization.
apps = await snyk_handler.get_apps(org_id="your-org-id")
print(apps)
Get Vulnerability Details (get_vulnerability_details):
Retrieve detailed information about a specific vulnerability.
vuln = await snyk_handler.get_vulnerability_details(vuln_id="CVE-2025-1234")
print(vuln)
Monitor Project (monitor_project):
Monitor a project for vulnerabilities.
response = await snyk_handler.monitor_project(
    org_id="your-org-id",
    project_data={"name": "new-project", "source": {...}}
)
print(response)
Collect All Container Data (collect_all_container_data):
Collect all container-related data for an organization.
data = await snyk_handler.collect_all_container_data(org_id="your-org-id")
print(data)
Collect All Snyk Data (collect_all_snyk_data):
Collect all available Snyk data for an organization (projects, issues, dependencies, vulnerabilities, users, integrations, containers, etc.).
data = await snyk_handler.collect_all_snyk_data(org_id="your-org-id")
print(data)