API Reference

The TrustTrace API lets you scan MCP servers and configuration files programmatically. Use it to integrate security scanning into your scripts, automation, and CI/CD pipelines.

Base URL: https://api.trusttrace.io/v1


Authentication

All API requests require an API key. Create one on your account page. The key is shown once, when you create it, so store it somewhere safe. Afterwards only its prefix is displayed.

Send the key in the X-API-Key header:

X-API-Key: sk_scan_your_key_here

Keep your API key secret. If it is exposed, rotate it from your account page. The old key stops working immediately.


Rate Limits

Each scan submission counts toward your monthly scan limit:

PlanScans per Month
Free3
Developer15
Pro50
Team200
Enterprise500

When you reach your limit, scan submissions return 403 with:

{
  "detail": "Monthly scan limit reached. Upgrade your plan for more scans."
}

Submissions are also limited to 10 per minute. Going over returns 429.


Endpoints

Submit MCP Server Scan

Scan a remote MCP server over streamable HTTP.

POST /v1/scan/mcp

Request:

curl -X POST https://api.trusttrace.io/v1/scan/mcp \
  -H "X-API-Key: sk_scan_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://your-server.example.com/mcp"}'
FieldTypeRequiredDescription
urlstringYesMCP server endpoint, usually ending in /mcp. Must be https://. A URL serving a static tools JSON document also works. Query strings are rejected.
target_authstringNoToken for a server that requires authentication. Sent to the server as the Authorization header. Never put a token in the URL.
industrystringNoIndustry weighting for scoring. Defaults to General.

Response:

{
  "scan_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "status": "queued"
}

Restrictions:

  • URLs that resolve to private or internal addresses are rejected
  • Local (stdio) MCP servers are not supported yet. Export your tool definitions to JSON and use the upload scan instead

Submit File Upload Scan

Scan one file.

POST /v1/scan/upload
Content-Type: multipart/form-data

Request:

curl -X POST https://api.trusttrace.io/v1/scan/upload \
  -H "X-API-Key: sk_scan_your_key_here" \
  -F "file=@tools.json"
FieldTypeRequiredDescription
filefileYesOne file: an MCP tools document (.json), a package.json or package-lock.json, or a YAML config (.yaml, .yml).
industrystringNoIndustry weighting for scoring. Defaults to General.

Response:

{
  "scan_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "status": "queued"
}

Restrictions:

  • Maximum file size: 1 MB
  • Other file types are rejected
  • A .json file must be a tools document (or package.json / package-lock.json). Otherwise the API returns 422 with a message such as "This JSON is not a tools document."
  • Files containing hardcoded secrets are rejected with 422, listing where each secret was found

Submit Config Assessment

Run the full rule engine on an engagement config, optionally with a code archive. Available on every plan.

POST /v1/scan/assessment
Content-Type: multipart/form-data

Request:

curl -X POST https://api.trusttrace.io/v1/scan/assessment \
  -H "X-API-Key: sk_scan_your_key_here" \
  -F "config=@trusttrace.yaml" \
  -F "archive=@src.zip"
FieldTypeRequiredDescription
configfileYesEngagement config, .yaml or .yml, up to 1 MB. Must declare at least one agent.
archivefileNoCode archive, .zip, .tar.gz or .tgz, up to 10 MB.

Response:

{
  "scan_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "status": "queued"
}

Self-serve assessments do not test live endpoints, TLS, CVEs or logs. The completed result lists what was not assessed in warnings.


Get Scan Results

Poll for scan status and retrieve results.

GET /v1/scan/{scan_id}

status is one of:

StatusMeaning
queuedWaiting for a worker
processingScan in progress
completedResults are ready
failedThe scan failed. error_message says why
failed_permanentThe scan failed and will not be retried. error_message says why

Completed (paid plan):

{
  "scan_id": "a1b2c3d4...",
  "status": "completed",
  "scan_type": "mcp",
  "overall_score": 43,
  "letter_grade": "D",
  "grade_capped": false,
  "grade_cap_reason": "",
  "score_version": "coverage-v2",
  "findings_count": 7,
  "error_message": null,
  "warnings": [],
  "findings": [
    {
      "finding_id": "FND-a1b2c3d4",
      "title": "Unauthenticated MCP server",
      "severity": "Critical",
      "owasp_category": "LLM06",
      "confidence": "Confirmed",
      "description": "MCP server accepts connections without...",
      "remediation": "Require authentication on the MCP server...",
      "evidence": ["Connection succeeded without credentials"],
      "hipaa_mapping": [],
      "soc2_mapping": []
    }
  ],
  "category_scores": [
    {"category": "LLM06", "status": "assessed", "score": 4.0, "rating": "Moderate"},
    {"category": "LLM04", "status": "not_assessed", "score": null, "rating": "Not assessed"}
  ]
}

Category scores: each category has a status of assessed or not_assessed. An assessed category has a score from 0 to 10 (higher is riskier) and a rating of Low Risk, Moderate, High or Critical. A category the scan did not test has score: null and rating: "Not assessed". Treat it as untested, never as a clean result.

Grade cap: when grade_capped is true, the letter grade was held down by a rule and grade_cap_reason says why, for example a confirmed Critical finding capping the grade at C. When the grade is not capped, grade_cap_reason is an empty string. score_version names the scoring method used. All three are null for scans completed before they were recorded.

Plan-based response filtering:

FieldFreeDeveloper+Enterprise
severity✅✅✅
title✅✅✅
owasp_category✅✅✅
description✅✅
remediation✅✅
evidence✅✅
hipaa_mapping, soc2_mapping✅

Free plan responses include an upgrade_message field.

Failed:

{
  "scan_id": "a1b2c3d4...",
  "status": "failed_permanent",
  "error_message": "Scan was interrupted. Please resubmit."
}

List Scan History

Retrieve your past scans. Requires Developer plan or above.

GET /v1/scans?limit=20&offset=0
ParameterTypeDefaultDescription
limitint20Results per page
offsetint0Number of scans to skip

Response:

{
  "scans": [
    {
      "scan_id": "a1b2c3d4...",
      "scan_type": "mcp",
      "status": "completed",
      "overall_score": 43,
      "letter_grade": "D",
      "findings_count": 7,
      "created_at": "2026-03-06T14:30:00Z"
    }
  ],
  "total": 1
}

Download PDF Report

Download a PDF report for a completed scan. Requires Developer plan or above.

GET /v1/scan/{scan_id}/report

Returns the PDF file. A scan that has not completed returns 409.


Get Account Info

Retrieve your account details, current plan, and usage.

GET /v1/auth/me

Response:

{
  "user_id": 42,
  "email": "developer@example.com",
  "tier": "developer",
  "api_key_prefix": "sk_scan_1a2b",
  "has_api_key": true,
  "scans_this_month": 12,
  "access_validated": true,
  "webhook_url": "https://your-app.example.com/webhooks/trusttrace",
  "email_notifications": true
}

The full API key and the webhook secret are never returned here. email_notifications controls the scan completion and failure emails. Change it from your account page.


Set Webhook URL (Team+)

Configure a webhook to receive scan results. Requires Team plan or above.

PUT /v1/account/webhook

Request:

{
  "webhook_url": "https://your-app.example.com/webhooks/trusttrace"
}

Response (first time a URL is set):

{
  "status": "ok",
  "webhook_url": "https://your-app.example.com/webhooks/trusttrace",
  "webhook_secret": "whsec_..."
}

The webhook_secret is returned once, when you first set a URL. Store it securely. Changing the URL keeps the same secret. To get a new secret, clear the URL (send null) and set it again.

When a scan completes or fails, TrustTrace sends one signed POST request to your webhook URL. There is one attempt with no retries, and only a 2xx response counts as delivered.

Completed scan:

{
  "scan_id": "a1b2c3d4...",
  "status": "completed",
  "scan_type": "mcp",
  "score": 43,
  "grade": "D",
  "findings_count": 11,
  "severity_counts": {
    "Critical": 3,
    "High": 5,
    "Medium": 2,
    "Low": 1
  }
}

Failed scan: only the id, status and type are sent.

{
  "scan_id": "a1b2c3d4...",
  "status": "failed_permanent",
  "scan_type": "mcp"
}

Verifying webhooks

Every request carries two headers:

HeaderValue
X-TrustTrace-TimestampUnix time in seconds when the request was signed
X-TrustTrace-SignatureHex HMAC-SHA256 of {timestamp}.{raw request body}, keyed with your webhook secret

To verify a request:

  1. Read the raw request body before parsing it as JSON. Re-serialized JSON will not match.
  2. Compute the HMAC-SHA256 of the timestamp header, a ., and the raw body, keyed with your secret. Compare it with the signature header in constant time.
  3. Reject the request if the timestamp is more than 5 minutes (300 seconds) from your own clock. This stops a captured request being replayed.

Verification example (Python):

import hashlib
import hmac
import time

TOLERANCE_SECONDS = 300  # 5 minutes


def verify_webhook(payload: bytes, timestamp: str, signature: str, secret: str) -> bool:
    """payload is the raw request body, exactly as received."""
    if not secret:
        return False
    try:
        sent_at = int(timestamp)
    except ValueError:
        return False
    if abs(time.time() - sent_at) > TOLERANCE_SECONDS:
        return False
    expected = hmac.new(
        secret.encode("utf-8"),
        timestamp.encode("utf-8") + b"." + payload,
        hashlib.sha256,
    ).hexdigest()
    return hmac.compare_digest(expected, signature)


# timestamp = request.headers["X-TrustTrace-Timestamp"]
# signature = request.headers["X-TrustTrace-Signature"]
# verify_webhook(raw_body, timestamp, signature, webhook_secret)

Error Codes

CodeMeaning
400Bad request, for example a config that is not .yaml or an unsupported archive type
401Missing or invalid API key
403Monthly scan limit reached, feature not available on your plan, or beta access code required
404Scan not found
409Scan not yet completed (report download)
413File too large. Uploads and configs up to 1 MB, archives up to 10 MB
415Unsupported media type
422The request or file was rejected. detail says why
429Too many requests (10 submissions per minute)
503Scan service temporarily unavailable. Retry after the Retry-After header

Error responses are JSON with a detail field:

{
  "detail": "Query strings are not supported in MCP URLs."
}

Request validation errors return detail as a list of objects, each with a msg field.


SDKs and Libraries

Official SDKs are on our roadmap. In the meantime, the REST API works with any HTTP client. The curl examples throughout this documentation can be adapted to any language.


Need Help?

  • Email: hello@trusttrace.io
  • Issues with the API? Include your scan ID in your message for fastest resolution.