SQL execution certificate verify
POST /api/sql-cert-verifyVerify an Ed25519 execution certificate against the exact SQL statement you are about to run - the gate your database layer calls before it obeys an agent. Checks the signature, the certificate version, the expiry, and that the statement's SHA-256 matches the one certified, so a certificate for a different (or edited) statement is rejected. Returns { valid, reason, payload } and never throws on a malformed token, so the executor always gets one uniform answer. Pass publicKey to verify a certificate issued by another deployment; omit it to use this one's.
Input
| Field | Type | Description |
|---|---|---|
sql * | string | the exact statement the certificate should cover |
certificate * | string | the token from sql-guard (payload.signature) |
publicKey | string | PEM public key of the issuer (default: this deployment's) |
Example output
{
"valid": true,
"reason": null,
"payload": {
"v": 1,
"verdict": "pass",
"sha256": "635cf20a…",
"exp": 4070908800
}
}
Try it - see the 402 challenge (free)
curl -i -X POST https://agent402.tools/api/sql-cert-verify \
-H "Content-Type: application/json" \
-d '{"sql":"UPDATE users SET plan = 'pro' WHERE id = 42","certificate":"eyJ2IjoxLCJzaGEyNTYiOiI2MzVjZjIwYTdhMzM3NzFjOGJiZjY3OTljOTJlNTdkOTRiNGY0MmFjMTYzMzkyMTg3MTg1Zjc5OWE4OGFjYTAyIiwidmVyZGljdCI6InBhc3MiLCJwb2xpY3kiOiI1MzljNzhjZDhiZTZjMzUwIiwiaWF0IjoxNzg1MDAwMDAwLCJleHAiOjQwNzA5MDg4MDB9.iOLcl81N_N2-b3Tq1YdLCbRkmgQB8fWG9TA0oRQG81CgXtLrvBi4dsk6Oww-FR3mWqtDmLxT0TZLbDxbBo5dBw","publicKey":"-----BEGIN PUBLIC KEY-----\nMCowBQYDK2VwAyEA+dgN+1FKr9VoA3fbT4bimUF4W8ORBYKwR6XiZldGxgw=\n-----END PUBLIC KEY-----\n"}'
The response is HTTP 402 Payment Required with exact payment requirements. Any x402 v2 client pays automatically and retries:
Paid call (JavaScript agent)
import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";
const client = new x402Client();
registerExactEvmScheme(client, { signer: privateKeyToAccount(KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);
const res = await payFetch("https://agent402.tools/api/sql-cert-verify", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"sql": "UPDATE users SET plan = 'pro' WHERE id = 42",
"certificate": "eyJ2IjoxLCJzaGEyNTYiOiI2MzVjZjIwYTdhMzM3NzFjOGJiZjY3OTljOTJlNTdkOTRiNGY0MmFjMTYzMzkyMTg3MTg1Zjc5OWE4OGFjYTAyIiwidmVyZGljdCI6InBhc3MiLCJwb2xpY3kiOiI1MzljNzhjZDhiZTZjMzUwIiwiaWF0IjoxNzg1MDAwMDAwLCJleHAiOjQwNzA5MDg4MDB9.iOLcl81N_N2-b3Tq1YdLCbRkmgQB8fWG9TA0oRQG81CgXtLrvBi4dsk6Oww-FR3mWqtDmLxT0TZLbDxbBo5dBw",
"publicKey": "-----BEGIN PUBLIC KEY-----\nMCowBQYDK2VwAyEA+dgN+1FKr9VoA3fbT4bimUF4W8ORBYKwR6XiZldGxgw=\n-----END PUBLIC KEY-----\n"
}),
});
No wallet? Pay with compute
This is a pure-CPU tool, so an agent without a wallet can pay with proof-of-work instead of USDC: fetch a challenge, solve the sha256 puzzle (16 leading zero bits - a fraction of a second of CPU, no money, no AI tokens), and resend with the X-Pow-Solution header.
import { createHash } from "node:crypto";
const lz = (b) => { let t = 0; for (const x of b) { if (!x) { t += 8; continue; } t += Math.clz32(x) - 24; break; } return t; };
const c = await (await fetch("https://agent402.tools/api/pow/challenge?slug=sql-cert-verify")).json();
let n = 0;
while (lz(createHash("sha256").update(c.challenge + ":" + n).digest()) < c.difficulty) n++;
await fetch("https://agent402.tools/api/sql-cert-verify", { method: "POST", headers: { "X-Pow-Solution": c.token + ":" + n, "Content-Type": "application/json" }, body: JSON.stringify({"sql":"UPDATE users SET plan = 'pro' WHERE id = 42","certificate":"eyJ2IjoxLCJzaGEyNTYiOiI2MzVjZjIwYTdhMzM3NzFjOGJiZjY3OTljOTJlNTdkOTRiNGY0MmFjMTYzMzkyMTg3MTg1Zjc5OWE4OGFjYTAyIiwidmVyZGljdCI6InBhc3MiLCJwb2xpY3kiOiI1MzljNzhjZDhiZTZjMzUwIiwiaWF0IjoxNzg1MDAwMDAwLCJleHAiOjQwNzA5MDg4MDB9.iOLcl81N_N2-b3Tq1YdLCbRkmgQB8fWG9TA0oRQG81CgXtLrvBi4dsk6Oww-FR3mWqtDmLxT0TZLbDxbBo5dBw","publicKey":"-----BEGIN PUBLIC KEY-----\nMCowBQYDK2VwAyEA+dgN+1FKr9VoA3fbT4bimUF4W8ORBYKwR6XiZldGxgw=\n-----END PUBLIC KEY-----\n"}) });
Related tools
Email validate
POST /api/email-validateValidate an email address: syntax check plus live MX record lookup on the domain (deliverability signal, not a guarantee…
URL parse
POST /api/url-parseParse a URL into components: protocol, host, port, path, query params (decoded), hash, origin, punycode hostname.
IP info
POST /api/ip-infoClassify an IP address: version, public/private/loopback/link-local, integer form, and reverse-DNS (PTR) lookup.