{
  "openapi": "3.1.0",
  "info": {
    "title": "Payload Check (data-quality filter for agents)",
    "version": "0.1.0",
    "summary": "Catch junk before your agent acts on it: broken or truncated JSON (auto-repair), schema mismatches, syntax errors, blocked scrapes, LLM refusals, placeholders, repetition loops, mojibake.",
    "description": "Deterministic checks, no LLM, no upstream calls. Score 100 = clean; each critical issue -60, major -25, minor -8. Verdict fail if any critical issue or score < 45; pass at or above min_score (default 80).",
    "contact": {
      "name": "Seenly / Agentropolis",
      "email": "hello@agentropolis.io"
    },
    "x-guidance": "POST {\"content\":\"<payload>\"}; pay the x402 402 challenge; branch on verdict / usable; use repaired.content when present."
  },
  "servers": [
    {
      "url": "https://seenly-payload-check.vercel.app"
    }
  ],
  "paths": {
    "/api/check": {
      "post": {
        "operationId": "checkPayload",
        "summary": "Score a payload (JSON, code, scrape, LLM output, CSV) for quality before your agent uses it",
        "description": "$0.03 USDC per call on Base mainnet. Invalid request → 422 before payment. Settles only on success. 60 req/min per client. Typical latency < 100 ms. Deterministic (no LLM); the payload is never stored.",
        "tags": [
          "Data quality"
        ],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.03"
          },
          "protocols": [
            {
              "x402": {}
            }
          ],
          "rails": [
            {
              "protocol": "x402",
              "version": 2,
              "scheme": "exact",
              "network": "eip155:8453",
              "networkName": "Base mainnet",
              "asset": "USDC",
              "assetAddress": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
              "amount": "30000",
              "priceUsd": "0.03",
              "payTo": "0xeE6239F3E17bEBe5e89F21F29D74D68CAa0d78CE",
              "facilitator": "Coinbase CDP (gas sponsored; payer needs no ETH)",
              "header": "PAYMENT-SIGNATURE"
            }
          ]
        },
        "x-free-allowance": {
          "available": true,
          "per_caller_per_day": 10,
          "global_per_day": 300,
          "window": "UTC day (resets 00:00 UTC)",
          "how": "Add header \"X-Free-Allowance: use\" (or ?free=1) to a valid request. If you have free calls left it runs with no payment; otherwise you get this same x402 402.",
          "caller": "per client network: IPv4 /24 or IPv6 /64 (hashed, never stored raw)",
          "note": "Free calls are not sales and never count toward settlements or trust. Calls through the Agentropolis relay always use x402."
        },
        "parameters": [
          {
            "name": "X-Free-Allowance",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "use"
              ]
            },
            "description": "Opt in to the free daily allowance (10 checks per caller network (IPv4 /24, IPv6 /64) per UTC day, global daily cap; see x-free-allowance). Without it, unpaid calls get the normal x402 402."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CheckRequest"
              },
              "example": {
                "content": "{\"name\": \"Acme\", \"tags\": [\"a\",],}",
                "expect": "auto"
              }
            },
            "text/plain": {
              "schema": {
                "type": "string",
                "description": "Raw payload; checked with expect=auto."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Quality report",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckResult"
                }
              }
            }
          },
          "402": {
            "description": "Payment required (x402 v2 PAYMENT-REQUIRED header)"
          },
          "413": {
            "description": "payload_too_large (not charged)"
          },
          "422": {
            "description": "invalid_request (not charged)"
          },
          "429": {
            "description": "rate_limited"
          }
        }
      },
      "get": {
        "operationId": "checkPayloadGet",
        "summary": "Score a payload (JSON, code, scrape, LLM output, CSV) for quality before your agent uses it",
        "description": "$0.03 USDC per call on Base mainnet. Invalid request → 422 before payment. Settles only on success. 60 req/min per client. Typical latency < 100 ms. Deterministic (no LLM); the payload is never stored.",
        "tags": [
          "Data quality"
        ],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.03"
          },
          "protocols": [
            {
              "x402": {}
            }
          ],
          "rails": [
            {
              "protocol": "x402",
              "version": 2,
              "scheme": "exact",
              "network": "eip155:8453",
              "networkName": "Base mainnet",
              "asset": "USDC",
              "assetAddress": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
              "amount": "30000",
              "priceUsd": "0.03",
              "payTo": "0xeE6239F3E17bEBe5e89F21F29D74D68CAa0d78CE",
              "facilitator": "Coinbase CDP (gas sponsored; payer needs no ETH)",
              "header": "PAYMENT-SIGNATURE"
            }
          ]
        },
        "x-free-allowance": {
          "available": true,
          "per_caller_per_day": 10,
          "global_per_day": 300,
          "window": "UTC day (resets 00:00 UTC)",
          "how": "Add header \"X-Free-Allowance: use\" (or ?free=1) to a valid request. If you have free calls left it runs with no payment; otherwise you get this same x402 402.",
          "caller": "per client network: IPv4 /24 or IPv6 /64 (hashed, never stored raw)",
          "note": "Free calls are not sales and never count toward settlements or trust. Calls through the Agentropolis relay always use x402."
        },
        "parameters": [
          {
            "name": "content",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 6000
            },
            "description": "Payload to check (short payloads only; use POST for larger)."
          },
          {
            "name": "expect",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "auto",
                "json",
                "code",
                "text",
                "html",
                "csv"
              ]
            }
          },
          {
            "name": "language",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Free-Allowance",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "use"
              ]
            },
            "description": "Opt in to the free daily allowance (10 checks per caller network (IPv4 /24, IPv6 /64) per UTC day, global daily cap; see x-free-allowance). Without it, unpaid calls get the normal x402 402."
          }
        ],
        "responses": {
          "200": {
            "description": "Quality report",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckResult"
                }
              }
            }
          },
          "402": {
            "description": "Payment required (x402 v2 PAYMENT-REQUIRED header)"
          },
          "413": {
            "description": "payload_too_large (not charged)"
          },
          "422": {
            "description": "invalid_request (not charged)"
          },
          "429": {
            "description": "rate_limited"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "CheckRequest": {
        "type": "object",
        "properties": {
          "content": {
            "type": "string",
            "description": "The payload to check (max 256 KB): JSON (even broken), code, scraped text or HTML, CSV, an LLM answer. Objects/arrays are accepted and checked as JSON."
          },
          "expect": {
            "type": "string",
            "enum": [
              "auto",
              "json",
              "code",
              "text",
              "html",
              "csv"
            ],
            "default": "auto",
            "description": "What the payload should be. auto detects it."
          },
          "language": {
            "type": "string",
            "description": "Optional code language (javascript, typescript, jsx, tsx get a real parser; python, go, rust, sql, shell get structural checks)."
          },
          "schema": {
            "type": "object",
            "description": "Optional JSON Schema (draft-07/2019) the JSON payload must match."
          },
          "min_chars": {
            "type": "integer",
            "minimum": 0,
            "description": "Optional minimum length for text payloads."
          },
          "min_score": {
            "type": "number",
            "minimum": 0,
            "maximum": 100,
            "default": 80,
            "description": "Score at or above which the verdict is pass (fail is always < 45 or any critical issue)."
          },
          "repair": {
            "type": "boolean",
            "default": true,
            "description": "Try a conservative mechanical repair of broken JSON and return it."
          },
          "requestKey": {
            "type": "string",
            "maxLength": 128,
            "description": "Optional idempotency key, echoed back."
          }
        },
        "required": [
          "content"
        ],
        "additionalProperties": false
      },
      "CheckResult": {
        "type": "object",
        "properties": {
          "kit": {
            "type": "string"
          },
          "quality_score": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "verdict": {
            "type": "string",
            "enum": [
              "pass",
              "warn",
              "fail"
            ]
          },
          "usable": {
            "type": "boolean"
          },
          "detected_type": {
            "type": "string",
            "enum": [
              "json",
              "code",
              "text",
              "html",
              "csv"
            ]
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "issues": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "code": {
                  "type": "string"
                },
                "severity": {
                  "type": "string",
                  "enum": [
                    "critical",
                    "major",
                    "minor",
                    "info"
                  ]
                },
                "message": {
                  "type": "string"
                },
                "location": {
                  "type": "string"
                }
              }
            }
          },
          "action": {
            "type": "string"
          },
          "repaired": {
            "type": "object",
            "properties": {
              "content": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "steps": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "note": {
                "type": "string"
              }
            }
          },
          "stats": {
            "type": "object"
          },
          "thresholds": {
            "type": "object"
          },
          "check_version": {
            "type": "string"
          },
          "request_key": {
            "type": [
              "string",
              "null"
            ]
          },
          "pricing": {
            "type": "object"
          }
        }
      }
    }
  }
}