🛡️ GuardiaAI
API Reference
🌐 Public API 📖 User Guide 🚀 Getting Started ← My Portal
API Reference

Complete reference for the Guardia AI public REST API. All endpoints require authentication via your tenant API key. The base URL for all requests is https://app.trustguardia.com. For the full admin API (platform settings, tenant management, analytics), see /admin/api-docs.

🌐 Base URL: https://app.trustguardia.com
Authentication — X-API-Key header

Every API request requires your tenant API key in the X-API-Key header. Retrieve your key from My Portal → Account. API keys follow the format gai-xxxxxxxxxxxxxxxxxxxxxxxx.

curl https://app.trustguardia.com/tenant/me \
  -H "X-API-Key: gai-your-key-here"

Keys are plan-scoped. Requests that exceed your plan's quota or access a restricted feature will return 403 Forbidden with a detail field explaining the restriction.

🔧 Platform
Health check, framework catalogue, and pricing information.
GET /health Platform health status

Returns platform health status. No authentication required. Use this endpoint to verify connectivity from CI/CD pipelines before triggering a scan.

Response
{ "status": "ok", "version": "1.0.0" }
Try it
GET /frameworks List all supported compliance frameworks

Returns all 7 supported compliance frameworks with their identifiers, display names, descriptions, and which plan tiers have access. Use the id field when specifying frameworks in /scan requests.

Headers
HeaderRequiredDescription
X-API-KeyRequiredYour tenant API key
Response — array of framework objects
[
  {
    "id":          "iso42001",
    "name":        "ISO 42001:2023",
    "description": "AI Management Systems standard",
    "category":    "AI Governance",
    "plans":       ["free_trial", "starter", "professional", "enterprise"]
  },
  { "id": "sr11_7",      "name": "SR 11-7",         ... },
  { "id": "eu_ai_act",   "name": "EU AI Act",        ... },
  { "id": "nist_ai_rmf", "name": "NIST AI RMF 1.0", ... },
  { "id": "mas_trm",     "name": "MAS TRM",          ... },
  { "id": "dora",        "name": "DORA",             ... },
  { "id": "sox",         "name": "SOX",              ... }
]
Try it
GET /pricing List all pricing tiers and features

Returns all subscription tiers with their scan quotas, framework access, governance cadence, and feature flags. Useful for building plan-upgrade prompts or quota dashboards in your own tooling.

Headers
HeaderRequiredDescription
X-API-KeyRequiredYour tenant API key
🏢 Tenant
Manage your subscription, linked Azure subscriptions, and service principal credentials.
GET /tenant/me Get current tenant profile and usage

Returns your tenant's subscription plan, scan quota usage, linked Azure subscription IDs, and current governance settings. This is the primary endpoint used by the session widget and portal UI.

Headers
HeaderRequiredDescription
X-API-KeyRequiredYour tenant API key
Response
{
  "tenant_id":         "3f8a2b1c-...",
  "purchaser_email":   "you@company.com",
  "plan_id":           "professional",
  "status":            "active",
  "scan_count":        12,
  "scan_limit":        100,
  "azure_subscription_ids": ["sub-id-1", "sub-id-2"],
  "governance_enabled": true,
  "governance_cadence": "biweekly",
  "report_history_days": 90
}
Try it
PUT /tenant/me/subscriptions Update linked Azure subscription IDs

Replace the list of Azure subscription IDs linked to your account. Plan-based limits apply: Free Trial (1), Starter (3), Professional (15), Enterprise (unlimited). All future scans will scan across all linked subscriptions.

Headers
HeaderRequiredDescription
X-API-KeyRequiredYour tenant API key
Content-TypeRequiredapplication/json
Request Body
{ "subscription_ids": ["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"] }
Parameters
FieldTypeDescription
subscription_idsRequiredstring[]Array of Azure subscription UUID strings
PUT /tenant/me/credentials Update Azure service principal credentials

Store or replace the Azure service principal credentials used by Guardia AI to scan your Azure subscriptions. Credentials are encrypted at rest using AES-256-GCM and never logged. The service principal must have Reader RBAC access on all linked subscriptions.

Headers
HeaderRequiredDescription
X-API-KeyRequiredYour tenant API key
Content-TypeRequiredapplication/json
Request Body
{
  "tenant_id":     "your-azure-tenant-id",
  "client_id":     "your-service-principal-app-id",
  "client_secret": "your-service-principal-secret"
}
🔍 Scanning
Trigger infrastructure compliance scans. Core endpoint for CI/CD DevSecOps integration.
POST /scan Run a full infrastructure compliance scan

Triggers a synchronous compliance scan of your linked Azure subscriptions against the specified regulatory frameworks. Returns a full JSON report with per-resource findings, risk scores, and AI-generated narratives. This is the primary endpoint for CI/CD integration — fail your pipeline on critical_count > 0.

Headers
HeaderRequiredDescription
X-API-KeyRequiredYour tenant API key
Content-TypeRequiredapplication/json
Request Body
{
  "frameworks":     ["iso42001", "sr11_7"],
  "subscription_id": "optional-override-sub-id",
  "generate_narrative": true,
  "scan_label":     "pre-deploy-check"
}
Parameters
FieldTypeDescription
frameworksRequiredstring[]One or more framework IDs from /frameworks. Plan-restricted. Free Trial: iso42001, sr11_7 only.
subscription_idOptionalstringScan a specific linked subscription. Omit to scan all linked subscriptions.
generate_narrativeOptionalboolGenerate AI-powered plain-English summaries for each finding. Default: true on paid plans.
scan_labelOptionalstringCustom label stored with the report — useful for tagging CI/CD run IDs.
Response
{
  "report_id":        "COMP-20260519-143022",
  "tenant_id":        "3f8a2b1c-...",
  "scan_ts":          "2026-05-19T14:30:22Z",
  "frameworks":       ["iso42001", "sr11_7"],
  "aggregate_score":  78,
  "critical_count":   2,
  "high_count":       5,
  "medium_count":     11,
  "findings": [
    {
      "control_id":    "ISO42001-4.1",
      "framework":     "iso42001",
      "resource":      "/subscriptions/.../providers/Microsoft.MachineLearning/workspaces/ws1",
      "severity":      "critical",
      "status":        "fail",
      "title":         "ML Workspace lacks diagnostic logging",
      "description":   "...",
      "narrative":     "Azure OpenAI generated explanation...",
      "remediation":   "Enable diagnostic settings on the workspace..."
    }
  ]
}
CI/CD Integration Example — GitHub Actions
- name: Run Guardia compliance gate
  run: |
    RESULT=$(curl -s -X POST https://app.trustguardia.com/scan \
      -H "X-API-Key: $GUARDIA_KEY" \
      -H "Content-Type: application/json" \
      -d '{"frameworks":["iso42001","sr11_7"],"scan_label":"${{ github.sha }}"}')

    CRITICAL=$(echo $RESULT | jq '.critical_count')
    if [[ $CRITICAL -gt 0 ]]; then
      echo "❌ BLOCKED: $CRITICAL critical compliance findings"
      echo "$RESULT" | jq '.findings[] | select(.severity=="critical")'
      exit 1
    fi
    echo "✅ Compliance gate passed"
POST /scan/dry-run Preview scan without consuming quota

Runs a compliance scan in dry-run mode. The scan is fully executed but the result is not persisted and does not count against your monthly scan quota. Useful for testing pipeline integration or previewing findings before a scheduled release. Accepts the same request body as /scan.

Headers
HeaderRequiredDescription
X-API-KeyRequiredYour tenant API key
Content-TypeRequiredapplication/json
Response

Same structure as /scan but with "dry_run": true and no report_id — the report is not stored.

POST /scan/compare Compare two saved scan reports

Returns a diff between two previously saved compliance reports — new findings, resolved findings, score delta, and severity changes. Useful for tracking remediation progress between deployments.

Headers
HeaderRequiredDescription
X-API-KeyRequiredYour tenant API key
Content-TypeRequiredapplication/json
Request Body
{ "report_a": "COMP-20260515-120000", "report_b": "COMP-20260519-143022" }
Response
{
  "score_delta":     +6,
  "new_findings":    [ ... ],
  "resolved":        [ ... ],
  "unchanged":       [ ... ]
}
📋 Reports
Retrieve and manage saved compliance scan reports.
GET /reports List all saved reports

Returns all saved compliance reports for your tenant, newest first. Reports are retained per your plan's history window: Free Trial/Starter (30 days), Professional (90 days), Enterprise (365 days).

Headers
HeaderRequiredDescription
X-API-KeyRequiredYour tenant API key
Query Parameters
ParamDescription
limitOptionalMax results to return (default: 50)
typeOptionalFilter by scan type: manual or governance
GET /reports/{report_id} Retrieve a single full report

Returns the full JSON payload of a saved compliance report by ID. Includes all findings, narratives, scores, and resource paths. Report IDs follow the format COMP-YYYYMMDD-HHmmss.

Headers
HeaderRequiredDescription
X-API-KeyRequiredYour tenant API key
Path Parameters
ParamDescription
report_idRequiredThe report ID, e.g. COMP-20260519-143022
DELETE /reports Delete all manual scan reports

Permanently deletes all manual scan reports for your tenant. Governance (CCM) scan reports are not affected. Each deletion is audit-logged. This action is irreversible — deleted reports cannot be recovered from the portal (deleted reports are non-recoverable from the portal).

Headers
HeaderRequiredDescription
X-API-KeyRequiredYour tenant API key
Response
{ "status": "ok", "deleted": 7 }
DELETE /reports/{report_id} Delete a single report

Permanently deletes a single compliance report by ID. Deletion is audit-logged.

Headers
HeaderRequiredDescription
X-API-KeyRequiredYour tenant API key
Path Parameters
ParamDescription
report_idRequiredThe report ID to delete
Response
{ "status": "ok", "deleted": 1, "report_id": "COMP-20260519-143022" }
🔁 Governance (CCM)
Continuous Control Monitoring status and history management. Professional and Enterprise only.
GET /governance/status Get CCM schedule and history Professional+

Returns your tenant's Continuous Control Monitoring (CCM) configuration: cadence, last scan time, next scheduled scan, history of governance scan report IDs, and current health status.

Headers
HeaderRequiredDescription
X-API-KeyRequiredYour tenant API key (Professional or Enterprise)
Response
{
  "governance_enabled":   true,
  "cadence":              "biweekly",
  "last_scan_ts":         "2026-05-12T06:00:00Z",
  "next_scan_ts":         "2026-05-26T06:00:00Z",
  "governance_score":     82,
  "drift_detected":       false,
  "history": [
    { "report_id": "COMP-20260512-060012", "score": 82, "ts": "2026-05-12T06:00:12Z" }
  ]
}
DELETE /governance/history Clear governance scan history

Deletes governance (CCM) scan history reports for your tenant. Can be used to clear all history or selectively remove a specific report. Each deletion is audit-logged internally.

Headers
HeaderRequiredDescription
X-API-KeyRequiredYour tenant API key
Content-TypeRequiredapplication/json
Request Body
{
  "selective":  false,
  "report_id":  "COMP-20260512-060012"
}
Parameters
FieldDescription
selectiveOptionalIf true, only delete the report specified in report_id. If false (default), delete all governance history.
report_idOptionalReport ID to delete when selective: true
🏗️ IaC Remediation Export
Download Infrastructure-as-Code remediation scripts for scan findings. Enterprise only.
GET /report/{report_id}/iac/status Check IaC export availability Enterprise

Returns whether IaC remediation scripts are available for a report, how many findings have associated scripts, and which formats (ARM, Bicep, Terraform) are ready to download.

Headers
HeaderRequiredDescription
X-API-KeyRequiredYour Enterprise tenant API key
Response
{
  "report_id":      "COMP-20260519-143022",
  "iac_available":  true,
  "finding_count":  7,
  "formats":        ["arm", "bicep", "terraform"]
}
GET /report/{report_id}/iac/{fmt} Download IaC remediation script Enterprise

Downloads the Infrastructure-as-Code remediation script for a report in the specified format. Scripts are pre-filled with your subscription IDs, resource names, resource group paths, and the specific control being remediated. Apply them directly to your deployment pipeline.

Headers
HeaderRequiredDescription
X-API-KeyRequiredYour Enterprise tenant API key
Path Parameters
ParamDescription
report_idRequiredThe report ID
fmtRequiredFormat: arm, bicep, or terraform
Response

Returns the script as plain text (text/plain) or JSON depending on the format. Attach to your CI/CD artifact store or apply directly via az deployment / terraform apply.

📋 Executive Scorecard & Auditor Package
AI-generated board-ready scorecard, remediation roadmap, and auditor evidence package. Enterprise exclusive.
GET /report/{report_id}/scorecard/status Check scorecard availability Enterprise

Returns whether the authenticated tenant has access to Enterprise scorecard features, and the endpoints to call if access is granted.

Headers
HeaderRequiredDescription
X-API-KeyRequiredYour Enterprise tenant API key
Response (Enterprise)
{
  "report_id":           "COMP-20260519-143022",
  "scorecard_available": true,
  "plan":                "enterprise",
  "upgrade_message":     null,
  "endpoints": {
    "scorecard":         "/report/COMP-20260519-143022/scorecard",
    "roadmap":           "/report/COMP-20260519-143022/roadmap",
    "auditor_package":   "/report/COMP-20260519-143022/auditor-package"
  }
}
GET /report/{report_id}/scorecard Generate Executive Compliance Scorecard Enterprise

Generates an AI-powered board-ready Executive Compliance Scorecard from a scan report. Returns RAG (Red/Amber/Green) status per framework, top compliance gaps in plain business language, compliance trajectory, and a CRO-ready board narrative. Backed by Azure OpenAI.

Headers
HeaderRequiredDescription
X-API-KeyRequiredYour Enterprise tenant API key
Response
{
  "report_id":    "COMP-20260519-143022",
  "plan":         "enterprise",
  "generated_at": "2026-05-28T14:30:00Z",
  "scorecard": {
    "overall_rag":        "AMBER",
    "overall_rag_reason": "Critical gaps in access control and model governance remain unresolved.",
    "framework_rag": {
      "sr11_7":     "RED",
      "iso42001":   "AMBER",
      "eu_ai_act":  "AMBER",
      "nist_ai_rmf":"GREEN"
    },
    "top_gaps": [
      { "gap": "No model validation documentation found", "business_impact": "Regulatory exam failure risk", "severity": "CRITICAL" }
    ],
    "trajectory":      "IMPROVING",
    "trajectory_note": "Score improved 12 points across last 3 scans.",
    "board_narrative": "Our Azure AI infrastructure achieved an overall compliance score of 68/100 this period. Two critical gaps in SR 11-7 model governance require immediate remediation. The programme is trending in the right direction with 12-point improvement over the last quarter."
  }
}
Errors
StatusDescription
403Not on Enterprise plan — upgrade required
404Report not found
500Azure OpenAI generation failure
GET /report/{report_id}/roadmap Generate 30/60/90-day Remediation Roadmap Enterprise

Generates a prioritised remediation roadmap from scan findings. Each action item includes owner role, estimated effort level, and Azure-specific remediation steps. Grouped into 30-day (immediate/critical), 60-day (short-term/high), and 90-day (strategic/medium-low) horizons.

Headers
HeaderRequiredDescription
X-API-KeyRequiredYour Enterprise tenant API key
Response
{
  "report_id":    "COMP-20260519-143022",
  "plan":         "enterprise",
  "generated_at": "2026-05-28T14:30:00Z",
  "roadmap": {
    "immediate": [
      {
        "action":      "Enable diagnostic logging on all Azure ML workspaces",
        "framework":   "sr11_7",
        "effort":      "Low",
        "owner_role":  "Cloud Security Engineer",
        "azure_steps": "Navigate to Azure ML workspace → Diagnostic settings → Enable all log categories to Log Analytics.",
        "finding_ref": "SR117-LOG-001"
      }
    ],
    "short_term":  [ "..." ],
    "strategic":   [ "..." ],
    "summary_note": "Focus immediate effort on model governance documentation and logging gaps to address the highest-risk SR 11-7 findings."
  }
}
GET /report/{report_id}/auditor-package Generate Auditor Evidence Package Enterprise

Generates a structured auditor evidence package for presenting to OCC examiners, FCA supervisors, EU AI Act notified bodies, or internal audit teams. Includes assessment scope, methodology, per-framework coverage, finding summary, attestation statement, and recommended next review date.

Headers
HeaderRequiredDescription
X-API-KeyRequiredYour Enterprise tenant API key
Response
{
  "report_id":    "COMP-20260519-143022",
  "plan":         "enterprise",
  "generated_at": "2026-05-28T14:30:00Z",
  "auditor_package": {
    "assessment_scope":       "Azure subscription sub-abc123 assessed for AI infrastructure compliance across 7 regulatory frameworks.",
    "methodology":            "Read-only scan of Azure Resource Manager and Microsoft Graph APIs. No data plane access. No workload modification.",
    "frameworks_coverage":    [
      { "framework": "SR 11-7", "standard_reference": "SR 11-7 (2011)", "controls_assessed": 12, "gaps_found": 4 }
    ],
    "finding_summary":        { "critical": 2, "high": 5, "medium": 8, "low": 3 },
    "attestation_statement":  "This assessment was conducted by Guardia AI on 2026-05-28 using automated infrastructure scanning. All findings reflect the state of the Azure environment at the time of scan.",
    "assessor_note":          "This is an automated assessment. Manual review is recommended for controls requiring human judgement.",
    "recommended_next_review":"Within 30 days given critical findings identified."
  }
}
🔐 Encryption — CMK / BYOK
Customer-Managed Key (BYOK) encryption for Professional and Enterprise tenants. All plans include zero-trust AES-256-GCM PMK encryption by default. CMK uses your Azure Key Vault secret — Guardia never stores your key. Switching between modes requires email confirmation for security-critical changes.
GET /tenant/cmk/status Get CMK status Professional+

Returns the current CMK configuration status. Use GET /tenant/encryption/status for the full extended view including mode history and version fingerprint.

Headers
HeaderRequiredDescription
X-API-KeyRequiredYour tenant API key (Professional or Enterprise)
Response
{
  "plan":                  "professional",
  "cmk_supported":         true,
  "cmk_configured":        true,
  "key_vault_url":         "https://your-kv.vault.azure.net/",
  "key_vault_secret_name": "guardia-tenant-key",
  "cmk_key_version":       "abc123def456...",
  "cmk_verified_at":       "2026-05-20T09:00:00Z",
  "cmk_blocked":           false,
  "cmk_last_error":        null,
  "cmk_downgrade_pending": false,
  "upgrade_required":      false
}
GET /tenant/encryption/status Full encryption status with mode history Professional+

Extended encryption status including the last 10 mode-change events and the current key version fingerprint. Use this to audit all PMK↔CMK switches and key rotations on your account.

Headers
HeaderRequiredDescription
X-API-KeyRequiredYour tenant API key
Response
{
  "encryption_mode":         "cmk",
  "cmk_supported":           true,
  "cmk_configured":          true,
  "key_vault_url":           "https://your-kv.vault.azure.net/",
  "key_vault_secret_name":   "guardia-tenant-key",
  "cmk_key_version":         "abc123def456...",
  "cmk_verified_at":         "2026-05-20T09:00:00Z",
  "cmk_blocked":             false,
  "cmk_last_error":          null,
  "cmk_downgrade_pending":   false,
  "encryption_mode_history": [
    {
      "mode":          "cmk",
      "changed_at":    "2026-05-20T09:00:00Z",
      "changed_by":    "admin@acme.com",
      "previous_mode": "pmk",
      "reason":        "cmk_configure",
      "vault_uri":     "https://your-kv.vault.azure.net/",
      "key_name":      "guardia-tenant-key",
      "key_version":   "abc123def456..."
    }
  ]
}
POST /tenant/cmk/configure Enable CMK (BYOK) encryption Professional+

Enables Customer-Managed Key encryption. Guardia tests connectivity to your Key Vault before saving — the request fails if the vault is unreachable or the secret is inaccessible. On success, a CMK-enabled confirmation email is sent to the account owner and the key version fingerprint is captured for silent-rotation detection.

Headers
HeaderRequiredDescription
X-API-KeyRequiredYour tenant API key (Professional or Enterprise)
Content-TypeRequiredapplication/json
Request Body
{
  "key_vault_url":          "https://your-kv.vault.azure.net/",
  "key_vault_secret_name":  "guardia-tenant-key"
}
Response (200 OK)
{
  "ok":              true,
  "message":         "CMK enabled — future reports will be encrypted using your Key Vault secret.",
  "key_version":     "abc123def456...",
  "cmk_verified_at": "2026-05-20T09:00:00Z"
}
Error (400) — connectivity test failed
{ "detail": "CMK connectivity test failed: Secret 'guardia-key' not found. Fix the issue before enabling CMK." }
PATCH /tenant/cmk/rotate-verify Confirm key rotation — refresh version fingerprint Professional+

Call this after rotating your key in Azure Key Vault to refresh Guardia's stored version fingerprint. Guardia verifies connectivity, reads the current key version, and updates the fingerprint. If the version has changed, a rotation-detected email is sent as an audit record and the mode history is stamped.

This is the manual version of what Guardia's 24-hour health check does automatically. You do not need to call this — but calling it provides immediate confirmation after a rotation.

Headers
HeaderRequiredDescription
X-API-KeyRequiredYour tenant API key
Response (200 OK)
{
  "ok":              true,
  "rotated":         true,
  "old_version":     "abc123...",
  "new_version":     "def456...",
  "cmk_verified_at": "2026-05-20T10:00:00Z",
  "message":         "Key rotation confirmed — version fingerprint updated."
}
DELETE /tenant/cmk/configure Initiate CMK → PMK downgrade Professional+

Two-step process. This call initiates the switch — it does not immediately remove CMK. A one-time confirmation link is sent to the account owner's email address, valid for 30 minutes. The switch only completes when that link is clicked (which calls POST /tenant/encryption/confirm-pmk).

Important: Historical reports encrypted with your CMK key remain bound to that Key Vault key after the switch. Do not delete or disable the key — those reports will become permanently unreadable.

Headers
HeaderRequiredDescription
X-API-KeyRequiredYour tenant API key
Response (200 OK)
{
  "ok":           true,
  "pending":      true,
  "email_sent":   true,
  "message":      "A confirmation link has been sent to admin@acme.com. Click it within 30 minutes to complete the switch to PMK."
}
POST /tenant/encryption/confirm-pmk?token=<token> Complete CMK → PMK switch (token confirmation) Professional+

Completes the CMK → PMK downgrade using the one-time token from the confirmation email. Token expires after 30 minutes. The portal handles this automatically via a URL parameter — you do not need to call this manually unless building a custom integration.

Query Parameters
ParameterRequiredDescription
tokenRequiredOne-time token from the confirmation email
Headers
HeaderRequiredDescription
X-API-KeyRequiredYour tenant API key
Response (200 OK)
{
  "ok":                 true,
  "mode":               "pmk",
  "cmk_was_accessible": true,
  "warning":            null,
  "message":            "Encryption switched to Platform-Managed Key. Future scans use Guardia's PMK."
}
Error Codes
CodeMeaning
400No pending downgrade request found
403Invalid token
410Token expired — restart the process
⚠️ Error Handling
Standard error response format and common status codes.
ERR Error Response Format Standard error structure for all endpoints

All errors return a JSON body with a detail field and an appropriate HTTP status code.

{ "detail": "Scan quota exceeded for plan 'starter' (25/25 used this month)" }
Common Status Codes
CodeMeaning
401Missing or invalid X-API-Key
403Feature not available on your plan, or scan quota exceeded
404Report or resource not found
422Invalid request body — check required fields
429Rate limited — slow down requests
500Internal server error — contact support@trustguardia.com