Quickstart

Go from zero to first paid call in under 5 minutes.

Step 1 — Try the free demo

No payment needed:

curl https://api.cybersecurity-japan.com/demo/snapshot

Step 2 — Make a paid call (testnet)

Install x402-fetch:

npm install x402-fetch viem

Create snapshot.mjs:

import { wrapFetchWithPayment } from "x402-fetch";
import { createWalletClient, http } from "viem";
import { baseSepolia } from "viem/chains";
import { privateKeyToAccount } from "viem/accounts";

const account = privateKeyToAccount("0xYOUR_PRIVATE_KEY");
const walletClient = createWalletClient({
  account,
  chain: baseSepolia,
  transport: http(),
});

const fetchWithPayment = wrapFetchWithPayment(fetch, walletClient);

const res = await fetchWithPayment(
  "https://api.cybersecurity-japan.com/v1/snapshot",
  {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({ url: "https://example.com" }),
  }
);

console.log(await res.json());
node snapshot.mjs

Step 3 — Switch to mainnet

Replace baseSepolia with base from viem/chains. Ensure your wallet holds USDC on Base.

Get test USDC

Use the Circle USDC faucet to get free testnet USDC on Base Sepolia.

Full API reference →