Use the API without an account using x402 micropayments

Updated

If you want to call CompliAPI without signing up for an account, every metered endpoint supports x402 micropayments — you pay per request in USDC on Base with no API token required.

How it works

  1. Make a request to any metered endpoint with no Authorization header. Instead of a 401, you receive a 402 Payment Required response containing a payment challenge that specifies the amount, the receiving address, and the USDC contract.
  2. Sign an EIP-3009 transferWithAuthorization for the quoted amount and retry the request with the signed payment attached. The current price is $0.01 per request for most endpoints (the amount in the challenge is always authoritative — build your payment from it, not from a hardcoded value).
  3. A successful response includes a settlement receipt in the response header confirming the on-chain transaction.

Using x402-fetch for automatic retries

The x402-fetch library wraps the standard fetch API and handles the challenge-and-retry loop for you automatically:

import { wrapFetchWithPayment } from "x402-fetch";

const fetchWithPayment = wrapFetchWithPayment(fetch, walletClient);const res = await fetchWithPayment(  "https://api.compliapi.com/api/v1/screen/email/test@example.com");

What you're guaranteed

  • Failed requests are never charged. Settlement only happens after your request succeeds. If a screening call errors, the authorization is left unsettled and nothing moves on-chain.
  • Unsettled data is never released. If settlement fails, the response is withheld and you receive a fresh 402 to retry.
  • Authorizations are single-use. Replaying a payment header after it has already been settled returns a 402 asking for a new authorization.

If you have an API token under quota and also send a payment header, your quota is used and no payment is taken. x402 payments are also supported on the MCP server for AI agent use cases.

← All articles

Powered by Shipstar