API Documentation
Integrate TrustTrace scanning into your workflow.
Authentication
Send your API key in the X-API-Key header on every request.
X-API-Key: sk_scan_your_key_here
Sign up to create an API key
Get Started FreeBase URL
https://api.trusttrace.io/v1
/v1/scan/mcpScan a remote MCP server over streamable HTTP. The URL is usually the server's /mcp endpoint. A URL serving a static tools JSON document also works. Query strings are rejected: put a token in target_auth, which is sent to the server as the Authorization header. Local (stdio) servers are not supported yet.
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"}'Response
{
"scan_id": "abc123-def456",
"status": "queued"
}/v1/scan/uploadUpload one file, up to 1 MB: an MCP tools document (.json), a package.json or package-lock.json, or a YAML config (.yaml, .yml).
Request
curl -X POST https://api.trusttrace.io/v1/scan/upload \ -H "X-API-Key: sk_scan_your_key_here" \ -F "file=@tools.json"
Response
{
"scan_id": "abc123-def456",
"status": "queued"
}/v1/scan/assessmentRun the full rule engine on an engagement config (.yaml or .yml, up to 1 MB), with an optional code archive (.zip, .tar.gz or .tgz, up to 10 MB). Available on every plan. Live endpoint testing, TLS, CVE lookup and logs are not assessed in self-serve scans, and the result lists them in warnings.
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"
Response
{
"scan_id": "abc123-def456",
"status": "queued"
}/v1/scan/{scan_id}Poll for results. status is queued, processing, completed, failed or failed_permanent. A failed scan carries the reason in error_message. Finding detail depends on your plan.
Request
curl https://api.trusttrace.io/v1/scan/abc123-def456 \ -H "X-API-Key: sk_scan_your_key_here"
Response (completed, paid plan)
{
"scan_id": "abc123-def456",
"status": "completed",
"scan_type": "mcp",
"overall_score": 65,
"letter_grade": "C",
"grade_capped": true,
"grade_cap_reason": "Overall grade capped at C because at least one confirmed Critical finding is present.",
"score_version": "coverage-v2",
"findings_count": 7,
"error_message": null,
"warnings": [],
"findings": [
{
"finding_id": "FND-a1b2c3d4",
"title": "Unauthenticated MCP Server Access",
"severity": "Critical",
"owasp_category": "LLM06",
"description": "The MCP server allows...",
"remediation": "Require authentication...",
"evidence": ["Connection succeeded without credentials"],
"hipaa_mapping": [],
"soc2_mapping": []
}
],
"category_scores": [
{"category": "LLM06", "status": "assessed", "score": 7.0, "rating": "High"},
{"category": "LLM04", "status": "not_assessed", "score": null, "rating": "Not assessed"}
]
}A category with status not_assessed was not tested. Its score is null, never a zero. When grade_capped is true, grade_cap_reason says why the letter grade was held down. The three grade fields are null for older scans.
Response (completed, free plan)
{
"scan_id": "abc123-def456",
"status": "completed",
"overall_score": 65,
"letter_grade": "C",
"findings_count": 7,
"findings": [
{
"finding_id": "FND-a1b2c3d4",
"title": "Unauthenticated MCP Server Access",
"severity": "Critical",
"owasp_category": "LLM06"
}
],
"upgrade_message": "Upgrade to Developer to see full details..."
}Response (failed)
{
"scan_id": "abc123-def456",
"status": "failed_permanent",
"error_message": "Scan was interrupted. Please resubmit."
}/v1/scansList your scans with limit and offset. Requires the Developer plan or above.
Request
curl "https://api.trusttrace.io/v1/scans?limit=20&offset=0" \ -H "X-API-Key: sk_scan_your_key_here"
Rate Limits
Scan limits are enforced per calendar month and reset on the 1st. A request over the monthly limit returns 403. Submissions are also limited to 10 per minute, which returns 429.
| Plan | Scans/Month |
|---|---|
| Free | 3 |
| Developer | 15 |
| Pro | 50 |
| Team | 200 |
| Enterprise | 500 |
Error Codes
Errors return JSON with a detail field explaining what went wrong.
| Code | Description |
|---|---|
| 400 | Bad request, for example a config that is not .yaml or an unsupported archive type |
| 401 | Missing or invalid API key |
| 403 | Monthly scan limit reached, feature not on your plan, or beta access code required |
| 404 | Scan not found |
| 413 | File too large. Uploads and configs up to 1 MB, archives up to 10 MB |
| 415 | Unsupported media type |
| 422 | The request or file was rejected. The detail field says why |
| 429 | Too many requests. Up to 10 scan submissions per minute |
| 503 | Scan service temporarily unavailable. Retry after the Retry-After header |
CI/CD Integration
Add TrustTrace scanning to your GitHub Actions workflow. Set TRUSTTRACE_API_KEY as a repository secret and MCP_SERVER_URL as a repository variable.
name: TrustTrace MCP Scan
on: [push, pull_request]
jobs:
security-scan:
runs-on: ubuntu-latest
steps:
- name: Scan MCP Server
env:
API_KEY: ${{ secrets.TRUSTTRACE_API_KEY }}
MCP_URL: ${{ vars.MCP_SERVER_URL }}
run: |
# Submit the scan
RESULT=$(curl -sS -X POST https://api.trusttrace.io/v1/scan/mcp \
-H "X-API-Key: $API_KEY" \
-H "Content-Type: application/json" \
-d "{\"url\": \"$MCP_URL\"}")
SCAN_ID=$(echo "$RESULT" | jq -r '.scan_id // empty')
if [ -z "$SCAN_ID" ]; then
echo "::error::Scan was not accepted: $(echo "$RESULT" | jq -c '.detail // .error // .')"
exit 1
fi
# Poll for up to 5 minutes
for i in $(seq 1 30); do
RESPONSE=$(curl -sS https://api.trusttrace.io/v1/scan/$SCAN_ID -H "X-API-Key: $API_KEY")
STATUS=$(echo "$RESPONSE" | jq -r '.status')
case "$STATUS" in
completed) break ;;
failed|failed_permanent)
echo "::error::Scan failed: $(echo "$RESPONSE" | jq -r '.error_message')"
exit 1 ;;
esac
sleep 10
done
if [ "$STATUS" != "completed" ]; then
echo "::error::Scan did not finish in time"
exit 1
fi
# Fail on Critical findings
CRITICALS=$(echo "$RESPONSE" \
| jq '[.findings[] | select((.severity | ascii_downcase) == "critical")] | length')
if [ "$CRITICALS" -gt 0 ]; then
echo "::error::TrustTrace found $CRITICALS critical findings"
exit 1
fiWebhooks (Team+)
Set a webhook URL from your account page or with PUT /v1/account/webhook. The signing secret is shown once, when you first set a URL. When a scan completes or fails, TrustTrace sends one signed POST with no retries. A failed scan sends only scan_id, status and scan_type.
Payload (completed)
{
"scan_id": "abc123-def456",
"status": "completed",
"scan_type": "mcp",
"score": 65,
"grade": "C",
"findings_count": 7,
"severity_counts": {"Critical": 1, "High": 2, "Medium": 3, "Low": 1}
}Headers
X-TrustTrace-Timestamp: Unix time in seconds when the request was signed.X-TrustTrace-Signature: hex HMAC-SHA256 of{timestamp}.{raw body}, keyed with your webhook secret.
Verify the signature over the raw body before parsing it, and reject a timestamp more than 5 minutes from your own clock so a captured request cannot be replayed.
Verification (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"]