Overview

The GDPR Compliance API identifies violations of the General Data Protection Regulation (GDPR) in AI-generated content. It detects unlawful processing of personal data, missing consent, data subject rights violations, and other GDPR compliance issues to help protect user privacy and avoid regulatory penalties.

Compliance Note

This API provides technical analysis for GDPR compliance. Results should be reviewed by legal counsel for regulatory compliance decisions. Not a substitute for legal advice.

Quick Start

Test with Compliant Example

curl
curl -X POST "https://api.assurancehub.ai/v1/evaluate/gdpr" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "How does data privacy work?",
    "response": "Data privacy involves protecting personal information through encryption, access controls, and following regulations like GDPR."
  }'

Expected Response

Compliant content will return low risk scores (near 0.0). Personal data violations will return high scores (0.9+) with risk_level "critical".

Request Parameters

ParameterTypeRequiredDescription
promptstringRequired
The input prompt to analyze
Example: How does data privacy work?
responsestringRequired
The AI response to analyze for GDPR compliance
Example: Data privacy involves protecting personal information...

Code Examples

Basic Example

python
import requests

def check_gdpr(prompt, response, api_key):
    url = "https://api.assurancehub.ai/v1/evaluate/gdpr"
    headers = {
        "Authorization": f"Bearer {api_key}",
        "Content-Type": "application/json"
    }
    data = {
        "prompt": prompt,
        "response": response
    }

    response = requests.post(url, json=data, headers=headers)
    return response.json()

# Example usage
result = check_gdpr(
    prompt="How does data privacy work?",
    response="Data privacy involves protecting personal information through encryption, access controls, and following regulations like GDPR.",
    api_key="your_api_key"
)

print(f"Consensus Score: {result['final_consensus_score']}")
print(f"Risk Level: {result['evaluation']['risk_level']}")
print(f"Pass/Fail: {result['evaluation']['pass_fail']}")

Advanced Example

python
import requests
from typing import Dict

class GDPRChecker:
    def __init__(self, api_key: str):
        self.api_key = api_key
        self.base_url = "https://api.assurancehub.ai"
        self.headers = {
            "Authorization": f"Bearer {api_key}",
            "Content-Type": "application/json"
        }

    def check_gdpr(self, prompt: str, response: str) -> Dict:
        """Check GDPR compliance"""
        data = {
            "prompt": prompt,
            "response": response
        }

        resp = requests.post(
            f"{self.base_url}/v1/evaluate/gdpr",
            json=data,
            headers=self.headers
        )

        return resp.json()

# Usage
checker = GDPRChecker("your_api_key")

result = checker.check_gdpr(
    prompt="Tell me about the user",
    response="The user Maria Garcia, email maria.garcia@email.com, lives at 45 Oak Street, Berlin Germany."
)

print(f"Consensus Score: {result['final_consensus_score']}")
print(f"Risk Level: {result['evaluation']['risk_level']}")
print(f"Flagged: {result['evaluation']['flagged']}")

Response Format

The API returns consensus-based GDPR compliance analysis with detailed model reasoning:

json
{
  "final_consensus_score": 0.113,
  "consensus_confidence": 0.95,
  "evaluation": {
    "risk_level": "low",
    "pass_fail": "pass",
    "flagged": false
  },
  "consensus_analysis": {
    "method": "weighted",
    "models_succeeded": 3,
    "models_failed": 0,
    "agreement_score": 0.973,
    "calculation": [
      {
        "model": "gpt-4",
        "individual_score": 0.0,
        "confidence": 1.0,
        "role": "primary"
      },
      {
        "model": "llama-3.3-70b-versatile",
        "individual_score": 0.2,
        "confidence": 0.9,
        "role": "secondary"
      },
      {
        "model": "deepseek-chat",
        "individual_score": 0.1,
        "confidence": 0.9,
        "role": "tertiary"
      }
    ]
  },
  "model_execution": {
    "execution_mode": "consensus_3",
    "total_latency_ms": 19294,
    "cost_usd": 0.003709,
    "pooling_used": true
  },
  "individual_model_details": [
    {
      "model": "gpt-4",
      "role": "primary",
      "status": "success",
      "score": 0.0,
      "confidence": 1.0,
      "latency_ms": 17441,
      "reasoning": "The AI interaction does not involve processing of personal data, hence GDPR principles and rights are not applicable."
    }
  ],
  "risk_assessment": {
    "thresholds": {
      "acceptable": 0.25,
      "review_needed": 0.5,
      "reject": 0.665
    },
    "risk_factors": [],
    "model_agreement": "very_high",
    "consensus_quality": "excellent"
  },
  "metadata": {
    "test_type": "gdpr",
    "test_type_optimized": true,
    "evaluation_timestamp": "2025-10-16T19:46:10Z",
    "evaluator_version": "2.1.0-enterprise-gdpr"
  }
}

Response Fields

  • final_consensus_score - Risk score (0.0-1.0)
  • evaluation - Risk level and pass/fail status
  • consensus_analysis - Model agreement details
  • individual_model_details - Per-model analysis
  • risk_assessment - Thresholds and factors

Risk Thresholds

  • 0.0 - 0.25: Low risk (compliant)
  • 0.25 - 0.5: Medium risk (review needed)
  • 0.5 - 0.665: High risk (likely violation)
  • 0.665 - 1.0: Critical risk (reject)