{
  "openapi": "3.1.0",
  "info": {
    "title": "istdawas Shop-Check API",
    "version": "1.2.0",
    "summary": "Look up an online shop for fake-shop warning signs before paying.",
    "description": "Answers from the istdawas fake-shop radar (checks new shop domains around the clock) and the open ID MANDAT register. Results are technical warning signs, not a verdict on a merchant and no guarantee. Every 200 response is signed (ES256): detached JWS in the X-Istdawas-Signature header over the exact response body; public keys at https://www.istdawas.com/.well-known/jwks.json. No IP addresses are stored.",
    "contact": { "email": "kontakt@istdawas.com", "url": "https://www.istdawas.com/" },
    "termsOfService": "https://www.istdawas.com/agb.html"
  },
  "servers": [ { "url": "https://www.istdawas.com" } ],
  "externalDocs": { "description": "Guide for agents", "url": "https://www.istdawas.com/AGENTS.md" },
  "paths": {
    "/api/check.php": {
      "get": {
        "operationId": "checkShop",
        "summary": "Check an online shop",
        "description": "Without key: 10 requests per minute and 100 per day. With X-Api-Key: 600 per hour. Unknown shops are queued for the radar (status \"queued\"); ask again after retry_after_seconds.",
        "parameters": [
          { "name": "url", "in": "query", "required": true, "description": "Shop address or domain, e.g. https://example-shop.de", "schema": { "type": "string", "maxLength": 2048 } },
          { "name": "lang", "in": "query", "required": false, "description": "Language of finding titles, notes and advice", "schema": { "type": "string", "enum": ["de", "en", "es"], "default": "de" } },
          { "name": "format", "in": "query", "required": false, "description": "jws returns the full compact JWS (application/jose) instead of JSON", "schema": { "type": "string", "enum": ["jws"] } }
        ],
        "security": [ {}, { "apiKey": [] } ],
        "responses": {
          "200": {
            "description": "Result",
            "headers": {
              "X-Istdawas-Signature": { "description": "Detached JWS (RFC 7515 Appendix F, ES256) over the exact response body", "schema": { "type": "string" } }
            },
            "content": {
              "application/json": { "schema": { "$ref": "#/components/schemas/CheckResult" } },
              "application/jose": { "schema": { "type": "string", "description": "Compact JWS whose payload is the CheckResult" } }
            }
          },
          "400": { "description": "Invalid address", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
          "403": { "description": "Invalid API key", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
          "429": { "description": "Rate limit reached", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "apiKey": { "type": "apiKey", "in": "header", "name": "X-Api-Key", "description": "Optional key for higher limits; request at kontakt@istdawas.com" }
    },
    "schemas": {
      "CheckResult": {
        "type": "object",
        "required": ["domain", "checked_at", "status", "disclaimer"],
        "properties": {
          "domain": { "type": "string", "description": "Registered domain that was looked up" },
          "checked_at": { "type": "string", "format": "date-time" },
          "valid_until": { "type": "string", "format": "date-time", "description": "Do not reuse the result after this time" },
          "core_version": { "type": "string" },
          "status": { "type": "string", "enum": ["known", "queued"] },
          "level": { "type": ["string", "null"], "enum": ["calm", "warn", "danger", "no_shop", null], "description": "calm: score below 20; warn: 20-49; danger: 50 or more; no_shop: the address is not an online shop; null while queued" },
          "score": { "type": ["integer", "null"], "description": "Sum of warning-sign points" },
          "findings": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "code": { "type": "string", "description": "Fixed code of the warning sign" },
                "severity": { "type": "string", "enum": ["low", "medium", "high"] },
                "points": { "type": "integer" },
                "title": { "type": "string" }
              },
              "required": ["code"]
            }
          },
          "first_flagged": { "type": ["string", "null"], "description": "When the radar first flagged the shop" },
          "last_checked": { "type": "string" },
          "online": { "type": "boolean" },
          "campaign": {
            "type": "object",
            "description": "Shops sharing the same template, texts, phone or bank account (only counts, no account data)",
            "properties": {
              "id": { "type": "string" },
              "linked_by": { "type": "string" },
              "sister_shops": { "type": "integer" },
              "first_seen": { "type": ["string", "null"] },
              "last_seen": { "type": ["string", "null"] },
              "bank_accounts": { "type": "integer" }
            }
          },
          "register": {
            "type": "object",
            "description": "Entry in the open ID MANDAT register (positive signal for honest merchants)",
            "properties": {
              "name": { "type": "string" },
              "status": { "type": "string", "enum": ["listed", "not_listed", "unknown", "unavailable"] },
              "level": { "type": "string", "enum": ["listed", "verified"] },
              "proof": { "type": "string", "format": "uri" }
            }
          },
          "advice": { "type": "string" },
          "note": { "type": "string" },
          "retry_after_seconds": { "type": "integer" },
          "plan": { "type": "string", "enum": ["free", "key"] },
          "lang": { "type": "string", "enum": ["de", "en", "es"], "description": "Language of titles, notes and advice" },
          "disclaimer": { "type": "string" },
          "source": { "type": "string", "format": "uri" },
          "signature": {
            "type": ["object", "null"],
            "properties": {
              "alg": { "type": "string" },
              "kid": { "type": "string" },
              "jwks": { "type": "string", "format": "uri" },
              "header": { "type": "string" },
              "format": { "type": "string" }
            }
          }
        }
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": { "type": "string", "enum": ["invalid_url", "invalid_api_key", "rate_limited"] },
          "limit": { "type": "string" },
          "hint": { "type": "string" },
          "contact": { "type": "string" },
          "disclaimer": { "type": "string" }
        },
        "required": ["error"]
      }
    }
  }
}