Agent API

Agent Quickstart

Integrate Verdict into your autonomous agent pipeline or backend service in under five minutes using standard TypeScript and x402 packages.

1. Inspect the HTTP 402 Payment Challenge

You can test the endpoint immediately with cURL without providing payment. This command will return HTTP/1.1 402 Payment Required along with the advertised Base payment parameters:

terminal
curl -i -X POST https://tryverdict.xyz/api/v2/audit \
  -H 'Content-Type: application/json' \
  -d '{"url":"https://example.com"}'

2. Install x402 Dependencies

Install the official x402 client packages and viem in your Node/TypeScript project:

terminal
npm install @x402/core@2.24 @x402/evm@2.24 @x402/fetch@2.24 viem

3. Execute the Autonomous Audit

Use wrapFetchWithPayment to automatically intercept the 402 challenge, sign the $0.50 USDC authorization on Base, and receive the structured verdict:

audit.ts
import { x402Client } from "@x402/core/client";
import { ExactEvmScheme } from "@x402/evm/exact/client";
import { wrapFetchWithPayment } from "@x402/fetch";
import { privateKeyToAccount } from "viem/accounts";

const privateKey = process.env.EVM_PRIVATE_KEY as `0x${string}`;
const signer = privateKeyToAccount(privateKey);

const client = new x402Client();
client.register("eip155:*", new ExactEvmScheme(signer));

const fetchWithPayment = wrapFetchWithPayment(fetch, client);
const response = await fetchWithPayment("https://tryverdict.xyz/api/v2/audit", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ url: "https://example.com" }),
});

if (!response.ok) {
  throw new Error(`Verdict request failed: ${response.status}`);
}

const verdict = await response.json();
console.log(verdict);

4. Response Excerpt

The endpoint returns a structured JSON payload ready for direct downstream reasoning:

response.json
{
  "reportId": "7c3f…91a2",
  "overallScore": 78,
  "company_name": "Example",
  "identity": {
    "company_name": "Example",
    "inferred_description": "Developer platform for autonomous workflows",
    "target_audience": "Engineering teams",
    "primary_cta": "Get Started Free"
  },
  "the_verdict": {
    "status": "Pass",
    "primary_constraint": "Self-serve pricing is hidden below the fold.",
    "highest_opportunity": "Expose transparent self-serve tiers directly on navigation.",
    "estimated_impact": "High"
  },
  "score_interpretation": "Strong growth foundation with clear ICP clarity and high conversion potential.",
  "priority_matrix": [
    {
      "task": "Add upfront pricing tiers",
      "why": "Reduces friction for developer evaluation",
      "impact": "High",
      "effort": "Low"
    }
  ],
  "pillars": {
    "positioning": {
      "confidence": "High",
      "reason": "Clear positioning and distinct ICP wedge.",
      "strengths": ["Unmistakable developer focus"],
      "weaknesses": ["Competitor comparison is absent"]
    },
    "conversion": {
      "confidence": "Medium",
      "reason": "Missing upfront pricing on primary landing page.",
      "strengths": ["Clear primary CTA"],
      "weaknesses": ["Hidden pricing"]
    }
  },
  "sources": [
    {
      "url": "https://example.com/",
      "path": "/",
      "role": "homepage",
      "category": "identity",
      "keyFindings": ["Clear value prop and primary CTA"]
    }
  ],
  "pagesInspected": 2,
  "pagesAccepted": 2,
  "stopReason": "sufficient",
  "evidenceCoverage": {
    "pagesTotal": 2,
    "pagesAcquired": 2,
    "pagesAccepted": 2,
    "charsTotal": 14200,
    "categories": { "identity": 1, "conversion": 1 }
  }
}