Managing Assets via API
This guide explains how to manage assets in DevGuard using the REST API. Assets represent applications, services, or components that you want to scan and monitor for vulnerabilities.
Authentication
All endpoints require authentication using either:
- Cookie Authentication: Session-based (
ory_kratos_sessioncookie) - Personal Access Token (PAT): HTTP request signing via
X-SignatureandX-Fingerprintheaders
Use the devguard-scanner CLI for PAT authentication:
export DEVGUARD_TOKEN="your-pat-token"
devguard-scanner curl -X GET https://api.devguard.org/api/v1/organizations/my-org/projects/my-project/assetsBase URL
All endpoints use the base path: https://api.devguard.org/api/v1
Core Asset Operations
List Assets
GET /organizations/{org}/projects/{project}/assetsReturns all assets within a project you have access to.
Create Asset
POST /organizations/{org}/projects/{project}/assetsRequest Body:
{
"name": "my-application",
"description": "Application description",
"importance": "high",
"reachableFromInternet": true,
"confidentialityRequirement": "high",
"integrityRequirement": "high",
"availabilityRequirement": "medium",
"repositoryProvider": "github",
"enableTicketRange": true,
"cvssAutomaticTicketThreshold": 7.0,
"riskAutomaticTicketThreshold": "high"
}Get Asset Details
GET /organizations/{org}/projects/{project}/assets/{asset}Returns detailed information including versions, artifacts, and vulnerability statistics.
Update Asset
PATCH /organizations/{org}/projects/{project}/assets/{asset}Request Body:
{
"confidentialityRequirement": "high",
"integrityRequirement": "medium",
"availabilityRequirement": "low"
}Delete Asset
DELETE /organizations/{org}/projects/{project}/assets/{asset}Permanently deletes the asset and all associated data (versions, artifacts, vulnerabilities, VEX rules).
Lookup Asset by Repository
GET /lookup?provider=gitlab&id=12345Finds an asset by its external repository ID. Returns organization, project, and asset slugs.
Security Configuration
CIA Requirements
Configure Confidentiality, Integrity, and Availability requirements (low, medium, high). These affect vulnerability risk scoring and prioritization.
Importance Levels
low: Supporting or non-critical assetsmedium: Standard production assetshigh: Critical infrastructure
Automatic Ticket Creation
Enable automatic issue creation for vulnerabilities exceeding thresholds:
{
"enableTicketRange": true,
"cvssAutomaticTicketThreshold": 7.0,
"riskAutomaticTicketThreshold": "high"
}Asset Versions & Artifacts
Assets contain versions (branches/tags) and artifacts (SBOM files):
# List versions
GET /organizations/{org}/projects/{project}/assets/{asset}/refs/
# Get specific version
GET /organizations/{org}/projects/{project}/assets/{asset}/refs/{version}/
# List artifacts
GET /organizations/{org}/projects/{project}/assets/{asset}/refs/{version}/artifacts/SBOM & VEX Reports
Generate and retrieve compliance reports:
# SBOM in CycloneDX format
GET /organizations/{org}/projects/{project}/assets/{asset}/refs/{version}/artifacts/{artifact}/sbom.json/
# VEX document
GET /organizations/{org}/projects/{project}/assets/{asset}/refs/{version}/artifacts/{artifact}/vex.json/CSAF Reports
Common Security Advisory Framework reports:
# Provider metadata
GET /organizations/{org}/csaf/provider-metadata.json/
# Version-specific CSAF
GET /organizations/{org}/projects/{project}/assets/{asset}/csaf/white/2024/v1.0.0/Access Control
Asset access is controlled via role-based permissions on the parent project. Users need appropriate project-level permissions to view or modify assets.