api.vereefy.aiREST API v1

Entwicklerdokumentation

Integrieren Sie VEREEFY in Ihren KI-Stack und erfassen Sie jede Interaktion automatisch — DSGVO-konform, manipulationssicher, EU AI Act-ready.

REST APIJSONVersion 1.0OpenAPI /docs

Quick Start

In 4 Schritten von 0 auf laufende Compliance-Erfassung — dauert ca. 15 Minuten.

1. API-Key anfordern

Melden Sie sich im Dashboard an → Admin → API-Keys → Neuen Key erstellen. Der Key beginnt mit vfy_live_.

2. Ersten Call testen

bash
curl -X POST https://api.vereefy.ai/v1/interactions \
  -H "X-API-Key: vfy_live_IhrKey" \
  -H "Content-Type: application/json" \
  -d '{
    "provider": "openai",
    "model_name": "gpt-4o",
    "purpose": "Kreditrisikoanalyse für Privatkunden",
    "sector": "financial_services",
    "input_hash":  "a665a45920422f9d417e4867efdc4fb8a04a1f3fff1fa07e998e86f7f7a27ae3",
    "output_hash": "b3a8e0e1f9ab1bfe3a36f231f676f78bb28a2d0acc01a89c7d85ec6b7d2888af",
    "customer_facing": true,
    "automation_level": "assisted",
    "decision_impact": "high"
  }'

3. Antwort verstehen

json
{
  "interaction_id": "550e8400-e29b-41d4-a716-446655440000",
  "risk_class": "high",
  "article_matches": ["Art. 6", "Art. 13", "Art. 17"],
  "required_actions": [
    "Technische Dokumentation gemäss Anhang IV erstellen (Art. 11).",
    "Konformitätsbewertung durchführen (Art. 43)."
  ],
  "required_disclosures": ["KI-Einsatz gegenüber Kunden offenlegen (Art. 13)."],
  "confidence": "high",
  "compliance_score": 42,
  "audit_entry_id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
  "chain_tip_hash": "sha256:d4f..."
}

4. Dashboard prüfen

Die Interaktion erscheint sofort unter app.vereefy.ai/interactions. Risikoklasse, Artikel-Matches und Audit Trail sind bereits generiert.

Authentifizierung

VEREEFY unterstützt zwei Auth-Methoden — API-Key für Maschinen, JWT für Browser/Dashboard.

API-Key (empfohlen für Integrationen)

bash
# Header
X-API-Key: vfy_live_IhrKey

# Beispiel
curl https://api.vereefy.ai/v1/interactions \
  -H "X-API-Key: vfy_live_abc123xyz"

JWT Bearer Token (Dashboard / Browser)

bash
# 1. Token holen
curl -X POST https://api.vereefy.ai/auth/login \
  -H "Content-Type: application/json" \
  -d '{"email": "user@firma.ch", "password": "IhrPasswort"}'

# Antwort: { "access_token": "eyJ...", "refresh_token": "..." }

# 2. Token verwenden
curl https://api.vereefy.ai/v1/reports \
  -H "Authorization: Bearer eyJ..."

Sicherheitshinweis

API-Keys niemals im Frontend/Browser-Code oder in öffentlichen Repositories speichern. Nutzen Sie Umgebungsvariablen (VEREEFY_API_KEY).

Interaktionen

Eine Interaktion ist jeder KI-API-Call, den Sie erfassen möchten. VEREEFY klassifiziert automatisch und erstellt einen Audit-Trail-Eintrag.

POST /v1/interactions — Interaktion erfassen

ParameterTypPflichtBeschreibung
providerstringKI-Anbieter: openai | anthropic | google | custom
model_namestringModellname, z.B. gpt-4o, claude-3-5-sonnet
purposestringFreitext-Beschreibung des Anwendungszwecks
sectorstringSektor (siehe Sektoren-Liste unten)
input_hashstringSHA-256-Hash des Inputs (64 Hex-Zeichen)
output_hashstringSHA-256-Hash des Outputs (64 Hex-Zeichen)
customer_facingbooleanDirekter Kundenkontakt? (default: false)
automation_levelstringnone | assisted | partial | full
decision_impactstringnone | low | medium | high | critical
response_time_msintegerAntwortzeit in Millisekunden
external_refstringIhre interne Referenz-ID

Erlaubte Sektoren

text
financial_services  | healthcare         | hr_employment
education           | critical_infrastructure | law_enforcement
migration           | administration     | other

GET /v1/interactions — Liste abrufen

bash
curl "https://api.vereefy.ai/v1/interactions?limit=20&risk_class=high" \
  -H "X-API-Key: vfy_live_IhrKey"

# Query-Parameter:
# limit         integer  max. 200 (default 50)
# offset        integer  Pagination
# risk_class    string   minimal | limited | high | unacceptable
# sector        string   financial_services | healthcare | ...
# date_from     string   ISO 8601: 2026-01-01T00:00:00Z
# date_to       string   ISO 8601: 2026-12-31T23:59:59Z

Reports

Reports fassen alle Interaktionen eines Zeitraums zusammen und liefern auditierbare Compliance-Nachweise als JSON oder PDF.

POST /v1/reports — Report erstellen

bash
curl -X POST https://api.vereefy.ai/v1/reports \
  -H "Authorization: Bearer eyJ..." \
  -H "Content-Type: application/json" \
  -d '{
    "report_type": "compliance_summary",
    "format": "pdf",
    "date_from": "2026-01-01T00:00:00Z",
    "date_to":   "2026-03-31T23:59:59Z"
  }'

# report_type: compliance_summary | risk_analysis | audit_export | full_export
# format:      json | pdf

GET /v1/reports/{id}/export — Download

bash
# JSON-Download
curl "https://api.vereefy.ai/v1/reports/{id}/export?format=json" \
  -H "Authorization: Bearer eyJ..." \
  -o report.json

# PDF-Download (für Auditoren)
curl "https://api.vereefy.ai/v1/reports/{id}/export?format=pdf" \
  -H "Authorization: Bearer eyJ..." \
  -o report.pdf

Audit Chain

Jede Interaktion erzeugt automatisch einen Audit-Trail-Eintrag. Die Einträge sind kryptografisch verkettet — nachträgliche Änderungen werden sofort erkannt.

GET /v1/interactions/{id} — Detail mit Audit Trail

json
{
  "interaction": { "id": "...", "risk_class": "high", ... },
  "classification": { "article_matches": ["Art. 6"], ... },
  "audit_trail": [
    {
      "event_type": "INTERACTION_CREATED",
      "entry_hash": "sha256:a1b2c3...",
      "prev_hash":  "sha256:f9e8d7...",
      "created_at": "2026-04-28T14:32:00Z"
    }
  ],
  "chain_tip": "sha256:a1b2c3..."
}

Fehler & Rate Limits

HTTP-Statuscodes

CodeBedeutungMassnahme
200 / 201Erfolg
400Ungültige ParameterFehlermeldung im detail-Feld prüfen
401Nicht authentifiziertAPI-Key oder Token prüfen
403Keine BerechtigungScope des Keys prüfen
404Nicht gefundenID prüfen
409KonfliktStatus der Ressource prüfen (z.B. Report noch pending)
422ValidierungsfehlerRequest-Body prüfen
429Rate Limit erreichtExponentieller Retry, min. 60s warten
500ServerfehlerRetry mit Backoff, support@vereefy.ai

Rate Limits

EndpunktLimit
POST /v1/interactions100 / Minute
GET /v1/interactions200 / Minute
POST /v1/reports20 / Minute
POST /auth/login10 / Minute (IP-basiert)

SDKs & Beispiele

Python

python
import hashlib
import requests

VEREEFY_KEY = "vfy_live_IhrKey"
BASE_URL    = "https://api.vereefy.ai"

def sha256(text: str) -> str:
    return hashlib.sha256(text.encode()).hexdigest()

def log_interaction(prompt: str, response: str, **kwargs) -> dict:
    """Nach jedem KI-Call aufrufen."""
    r = requests.post(
        f"{BASE_URL}/v1/interactions",
        headers={"X-API-Key": VEREEFY_KEY},
        json={
            "provider":       kwargs.get("provider", "openai"),
            "model_name":     kwargs.get("model", "gpt-4o"),
            "purpose":        kwargs.get("purpose", "KI-Anwendung"),
            "sector":         kwargs.get("sector", "other"),
            "input_hash":     sha256(prompt),
            "output_hash":    sha256(response),
            "customer_facing":   kwargs.get("customer_facing", False),
            "automation_level":  kwargs.get("automation_level", "assisted"),
            "decision_impact":   kwargs.get("decision_impact", "low"),
        },
        timeout=5,
    )
    r.raise_for_status()
    return r.json()

# Verwendung
import openai

prompt = "Analysiere das Kreditrisiko für Kunde 4711"
completion = openai.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": prompt}]
)
answer = completion.choices[0].message.content

result = log_interaction(
    prompt, answer,
    provider="openai",
    model="gpt-4o",
    purpose="Kreditrisikoanalyse",
    sector="financial_services",
    customer_facing=False,
    automation_level="assisted",
    decision_impact="high",
)

print(f"Risikoklasse: {result['risk_class']}")
print(f"Artikel:      {result['article_matches']}")
print(f"Audit-ID:     {result['audit_entry_id']}")

Node.js / TypeScript

typescript
import crypto from "crypto";

const VEREEFY_KEY = process.env.VEREEFY_API_KEY!;
const BASE_URL    = "https://api.vereefy.ai";

function sha256(text: string): string {
  return crypto.createHash("sha256").update(text).digest("hex");
}

async function logInteraction(
  prompt: string,
  response: string,
  opts: {
    provider?: string;
    model?: string;
    purpose: string;
    sector: string;
    customerFacing?: boolean;
    automationLevel?: string;
    decisionImpact?: string;
  }
) {
  const res = await fetch(`${BASE_URL}/v1/interactions`, {
    method: "POST",
    headers: {
      "X-API-Key": VEREEFY_KEY,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      provider:          opts.provider ?? "openai",
      model_name:        opts.model ?? "gpt-4o",
      purpose:           opts.purpose,
      sector:            opts.sector,
      input_hash:        sha256(prompt),
      output_hash:       sha256(response),
      customer_facing:   opts.customerFacing ?? false,
      automation_level:  opts.automationLevel ?? "assisted",
      decision_impact:   opts.decisionImpact ?? "low",
    }),
  });
  if (!res.ok) throw new Error(`VEREEFY Error: ${res.status}`);
  return res.json();
}

// Verwendung mit OpenAI SDK
import OpenAI from "openai";
const openai = new OpenAI();

const prompt = "Erstelle eine Risikoeinschätzung für Portfolio X";
const completion = await openai.chat.completions.create({
  model: "gpt-4o",
  messages: [{ role: "user", content: prompt }],
});
const answer = completion.choices[0].message.content!;

const result = await logInteraction(prompt, answer, {
  purpose: "Portfolio-Risikoanalyse",
  sector:  "financial_services",
  decisionImpact: "high",
});

console.log("Risikoklasse:", result.risk_class);

Middleware-Pattern (empfohlen)

Für produktive Systeme empfehlen wir einen nicht-blockierenden Fire-and-Forget-Ansatz, damit VEREEFY nie die Antwortzeit Ihrer KI-Calls erhöht.

python
import asyncio
import aiohttp

async def log_interaction_async(prompt: str, response: str, **kwargs):
    """Asynchron, blockiert den Hauptprozess nicht."""
    async with aiohttp.ClientSession() as session:
        try:
            async with session.post(
                "https://api.vereefy.ai/v1/interactions",
                headers={"X-API-Key": VEREEFY_KEY},
                json={...},
                timeout=aiohttp.ClientTimeout(total=3),
            ) as resp:
                return await resp.json()
        except Exception:
            pass  # Logging darf nie die Hauptfunktion blockieren

# Fire-and-forget
asyncio.create_task(log_interaction_async(prompt, answer, ...))

Interaktive API-Dokumentation

Die vollständige OpenAPI-Spezifikation mit Swagger UI finden Sie unter api.vereefy.ai/docs (oder lokal unter localhost:8000/docs). Dort können Sie alle Endpunkte direkt im Browser testen.