api

API Endpoints

Complete reference for all sus API endpoints

Overview

The sus API provides programmatic access to package security scanning. Use it to integrate sus into your CI/CD pipelines, build tools, or custom workflows.

Base URL: https://api.sus-pm.com

Authentication: No authentication required. All endpoints are public.

Content-Type: All requests and responses use application/json


Get Package

Get the latest scan result for a package.

Bash
GET /v1/packages/{name}

Path Parameters:

NameTypeDescription
namestringPackage name (URL-encoded for scoped packages)

Example:

Bash
curl https://api.sus-pm.com/v1/packages/express

For scoped packages, URL-encode the name:

Bash
curl https://api.sus-pm.com/v1/packages/@types%2Fnode

Response:

JSON
{
  "name": "express",
  "version": "4.21.0",
  "registry": "npm",
  "risk_level": "clean",
  "risk_reasons": [],
  "publisher": {
    "name": "expressjs",
    "verified": true
  },
  "weekly_downloads": 32000000,
  "install_scripts": {
    "preinstall": false,
    "install": false,
    "postinstall": false,
    "prepare": false
  },
  "cves": [],
  "agentic_threats": [],
  "scanned_at": "2024-01-15T10:30:00Z"
}

Get Package Version

Get the scan result for a specific package version.

Bash
GET /v1/packages/{name}/{version}

Path Parameters:

NameTypeDescription
namestringPackage name
versionstringPackage version

Example:

Bash
curl https://api.sus-pm.com/v1/packages/lodash/4.17.20

List Packages

Get a paginated list of all scanned packages, sorted by weekly downloads.

Bash
GET /v1/packages

Query Parameters:

NameTypeDefaultDescription
limitnumber50Number of packages to return (max 100)
offsetnumber0Number of packages to skip

Example:

Bash
curl "https://api.sus-pm.com/v1/packages?limit=20&offset=0"

Response:

JSON
{
  "packages": [
    {
      "name": "semver",
      "version": "7.7.3",
      "registry": "npm",
      "risk_level": "clean",
      "trust_score": 95,
      "weekly_downloads": 492100000,
      "publisher_verified": true,
      "cve_count": 0,
      "threat_count": 0,
      "capabilities": {
        "network": { "makes_requests": false },
        "filesystem": { "reads": false, "writes": false },
        "process": { "spawns_children": false },
        "environment": { "accessed_vars": [] },
        "native": { "has_native": false }
      },
      "scanned_at": "2024-01-15T10:30:00Z"
    }
  ],
  "total": 1006,
  "limit": 20,
  "offset": 0
}

Search Packages

Search for packages by name. Returns paginated results matching the query.

Bash
GET /v1/packages?q={query}

Query Parameters:

NameTypeDefaultDescription
qstring-Search query (matches package name)
limitnumber50Number of packages to return (max 100)
offsetnumber0Number of packages to skip

Example:

Bash
curl "https://api.sus-pm.com/v1/packages?q=express&limit=10"

Response:

JSON
{
  "packages": [
    {
      "name": "express",
      "version": "4.21.0",
      "registry": "npm",
      "risk_level": "clean",
      "trust_score": 92,
      "weekly_downloads": 32000000,
      "publisher_verified": true,
      "cve_count": 0,
      "threat_count": 0,
      "capabilities": {
        "network": { "makes_requests": true },
        "filesystem": { "reads": true, "writes": false },
        "process": { "spawns_children": false },
        "environment": { "accessed_vars": ["NODE_ENV"] },
        "native": { "has_native": false }
      },
      "scanned_at": "2024-01-15T10:30:00Z"
    }
  ],
  "total": 15,
  "limit": 10,
  "offset": 0
}

Request Scan

Request a new scan for a package. The scan is queued and processed asynchronously.

Bash
POST /v1/scan

Request Body:

NameTypeRequiredDescription
namestringYesPackage name
versionstringNoPackage version (latest if not specified)
registrystringNoPackage registry (defaults to "npm")

Example:

Bash
curl -X POST https://api.sus-pm.com/v1/scan \
  -H "Content-Type: application/json" \
  -d '{"name": "express", "version": "4.21.0", "registry": "npm"}'

Response:

JSON
{
  "job_id": "550e8400-e29b-41d4-a716-446655440000",
  "estimated_seconds": 30
}

Scan Tarball

Upload and scan a local package tarball. Useful for scanning private packages or packages before publishing.

Bash
POST /v1/scan/tarball

Content-Type: multipart/form-data

Form Fields:

NameTypeDescription
tarballfileGzipped tarball file (.tgz or .tar.gz)

Example:

Bash
curl -X POST https://api.sus-pm.com/v1/scan/tarball \
  -F "tarball=@my-package-1.0.0.tgz"

Response:

JSON
{
  "job_id": "550e8400-e29b-41d4-a716-446655440000",
  "estimated_seconds": 60
}

Bulk Lookup

Look up multiple packages in a single request.

Bash
POST /v1/bulk

Request Body:

NameTypeDescription
packagesarrayArray of package objects with name, optional version, and optional registry

Example:

Bash
curl -X POST https://api.sus-pm.com/v1/bulk \
  -H "Content-Type: application/json" \
  -d '{
    "packages": [
      {"name": "express", "version": "4.21.0", "registry": "npm"},
      {"name": "lodash", "version": "4.17.20"},
      {"name": "axios"}
    ]
  }'

Response:

Returns an array of package responses. Each response includes the registry field.


Health Check

Check if the API is running.

Bash
GET /health

Response:

JSON
{
  "status": "ok"
}

Response Schema

PackageResponse

FieldTypeDescription
namestringPackage name
versionstringPackage version
registrystringPackage registry (e.g., "npm")
risk_levelstring"clean", "warning", or "critical"
risk_reasonsstring[]List of reasons for the risk level
publisherobjectPublisher info with name and verified
weekly_downloadsnumberWeekly download count
install_scriptsobjectWhich install scripts are present
cvesarrayList of CVEs affecting this package
agentic_threatsarrayDetected agentic threats
capabilitiesobjectPackage capability analysis
docs_mdstringGenerated package documentation markdown
scanned_atstringISO 8601 timestamp of scan

PackageListItem

Lightweight package object returned by list and search endpoints.

FieldTypeDescription
namestringPackage name
versionstringPackage version
registrystringPackage registry (e.g., "npm")
risk_levelstring"clean", "warning", or "critical"
trust_scorenumberTrust score (0-100)
weekly_downloadsnumberWeekly download count
publisher_verifiedbooleanWhether publisher is verified
cve_countnumberNumber of CVEs affecting this version
threat_countnumberNumber of threats detected
capabilitiesobjectPackage capability analysis
scanned_atstringISO 8601 timestamp of scan

CVE Object

FieldTypeDescription
cve_idstringCVE identifier (e.g., CVE-2021-23337)
severitystring"low", "medium", "high", or "critical"
descriptionstringCVE description
fixed_instringVersion where the CVE is fixed

Agentic Threat Object

FieldTypeDescription
threat_typestringType of threat detected
confidencenumberConfidence score (0-1)
locationstringFile and line where threat was found
snippetstringCode snippet containing the threat

Threat Types:

  • prompt_injection - Hidden instructions targeting AI agents
  • instruction_override - Attempts to override agent instructions
  • data_exfiltration - Code that exfiltrates data
  • social_engineering - Deceptive content targeting agents
  • install_script_injection - Malicious install scripts
  • malicious_code - Other malicious code patterns

Capabilities Object

FieldTypeDescription
networkobjectNetwork access analysis
filesystemobjectFile system access analysis
processobjectProcess spawning analysis
environmentobjectEnvironment variable access
nativeobjectNative module analysis

Error Responses

All errors return JSON with an error field:

JSON
{
  "error": "Package not found"
}

Status Codes:

CodeDescription
200Success
400Bad request (invalid parameters)
404Package not found
500Internal server error