API Reference
REST API, CLI, and MCP server documentation
API Reference
Safeguard.sh provides comprehensive APIs for automation and integration.
REST API
Authentication
All API requests require authentication:
curl "https://api.safeguard.sh/v1/projects" \
-H "Authorization: Bearer YOUR_API_KEY"Generate API keys in Settings → API Keys.
Common Endpoints
Projects
# List projects
GET /v1/projects
# Get project
GET /v1/projects/{id}
# Create project
POST /v1/projectsSBOMs
# List SBOMs
GET /v1/sboms
# Get SBOM
GET /v1/sboms/{id}
# Generate SBOM
POST /v1/sboms/generate
# Export SBOM
GET /v1/sboms/{id}/export?format=spdxVulnerabilities
# List vulnerabilities
GET /v1/vulnerabilities
# Get vulnerability details
GET /v1/vulnerabilities/{cve}
# Search vulnerabilities
POST /v1/vulnerabilities/searchResponse Format
All responses are JSON:
{
"data": { ... },
"meta": {
"page": 1,
"total": 100
}
}CLI
Installation
# npm
npm install -g @safeguard-sh/cli
# Homebrew
brew install safeguard-sh/tap/safeguard
# Direct download
curl -L https://cli.safeguard.sh/install | shAuthentication
safeguard auth loginOr use environment variable:
export SAFEGUARD_API_KEY="your-api-key"Commands
# Generate SBOM
safeguard sbom generate --source . --name "my-app" --version "1.0.0"
# List projects
safeguard projects list
# Check security gate
safeguard gate check --policy production
# Search
safeguard search "severity:critical"
# Export SBOM
safeguard sbom export --id abc123 --format cyclonedxMCP Server
Safeguard.sh provides an MCP (Model Context Protocol) server for AI integrations.
Configuration
{
"mcpServers": {
"safeguard": {
"url": "https://mcp.safeguard.sh",
"apiKey": "YOUR_API_KEY"
}
}
}Available Tools
sbom_generate- Generate SBOMssbom_search- Search SBOMsvuln_search- Search vulnerabilitiesvuln_analyze- Analyze vulnerabilitiesgate_check- Check security gates
Webhooks
Receive notifications for events:
Configuration
- Go to Settings → Webhooks
- Click Add Webhook
- Enter URL and select events
- Save
Events
sbom.createdsbom.updatedvulnerability.discoveredgate.failedpolicy.violated
Payload
{
"event": "vulnerability.discovered",
"timestamp": "2025-01-03T10:00:00Z",
"data": {
"cve": "CVE-2025-1234",
"severity": "critical",
"affected_projects": ["project-1", "project-2"]
}
}Rate Limits
| Plan | Rate Limit |
|---|---|
| Free | 100 requests/hour |
| Pro | 1,000 requests/hour |
| Enterprise | 10,000 requests/hour |
SDKs
Official SDKs: