Go from zero to first paid call in under 5 minutes.
No payment needed:
curl https://api.cybersecurity-japan.com/demo/snapshot
You need a wallet with USDC on Base. There is no testnet endpoint; use the free demo above to test your parsing.
Install the x402 v2 client:
npm install @x402/fetch @x402/evm viem
Create snapshot.mjs:
import { wrapFetchWithPaymentFromConfig } from "@x402/fetch";
import { ExactEvmScheme } from "@x402/evm";
import { privateKeyToAccount } from "viem/accounts";
const account = privateKeyToAccount(process.env.PRIVATE_KEY);
const fetchWithPayment = wrapFetchWithPaymentFromConfig(fetch, {
schemes: [{ network: "eip155:8453", client: new ExactEvmScheme(account) }],
});
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());
PRIVATE_KEY=0x... node snapshot.mjs
The response carries a PAYMENT-RESPONSE header with the settlement transaction. An error response (4xx/5xx) is not settled.