How to Stop an AI Agent from Paying a Scam API
· updated · 5 min read
To stop an AI agent from paying a scam API, check the seller before every payment and cap what the agent can spend. Lumière PayCheck does the seller check for free: it compares the quote's price and payout wallet with the endpoint's history, screens the wallet, and tells your agent allow or deny before any money moves.
Developers building AI agents face risks with x402. The x402 protocol allows APIs to ask for payment in the response. A standard HTTP 402 status code includes a quote. This quote lists the price, the network, and the wallet address to pay. Your agent must sign a payment for this amount and send it back with the request. There is no invoice or API key. This speed removes traditional billing safety nets like account verification. If an endpoint is malicious, your agent pays immediately.
Lumière PayCheck monitors endpoints listed in the x402 Bazaar and x402 APIs it finds elsewhere, on GitHub, npm and sellers' own sites. It checks if the 402 quote is valid. It looks at the payout wallet to see if it has changed recently. It also runs real paid test calls to confirm the endpoint works. This process takes place before your agent sends any money.
Step 1: Check the Endpoint Score
Before your agent makes a payment, it should check the endpoint’s trust score. Lumière PayCheck monitors over 144,000 endpoints. It grades them based on stability and delivery history. You can use the free web checker or the API to get this grade.
Use the GET /v1/score endpoint to get a quick verdict. Pass the URL of the x402 endpoint as a parameter. The response includes a score from 0 to 100 and a verdict. The verdict will be "proceed," "caution," or "avoid."
curl "https://lumierepaycheck.org/v1/score?url=<endpoint>"Step 2: Run a Pre-Payment Check
For critical payments, use the detailed check-payment tool. This free POST request to /v1/check-payment takes the quote details from the API response. You send the URL, the amount (in the token's smallest unit, so 10000 is $0.01 in USDC), and the payTo wallet address. Lumière PayCheck verifies these details against its live data. It checks if the price has increased. It screens the wallet against OFAC sanctions lists. It looks for signs of a hijack or a lookalike seller.
The tool returns "allow" or "deny" with specific reasons. If it returns "deny," your agent should stop immediately. Do not pay the API. This step prevents your agent from falling for price hikes or fake wallets.
curl -X POST https://lumierepaycheck.org/v1/check-payment \
-H "Content-Type: application/json" \
-d '{"url": "<endpoint>", "amount": "10000", "payTo": "<wallet_address>"}'Step 3: Use the MCP Server for Automation
If you are building an agent, use the Lumière PayCheck MCP server. This tool integrates directly into your agent’s workflow. You can connect to the remote streamable HTTP server at https://lumierepaycheck.org/mcp or use the npm package lumiere-paycheck-mcp. The MCP tools include check_endpoint and check_payment. These tools allow your agent to make verification calls automatically.
Your agent can call check_payment with the quote it received. It waits for the allow or deny response. If allowed, the agent signs the payment in USDC on Base or Solana. It sends the proof of payment in the header of the retried request. The API then returns the data. This flow allows your agent to verify trust before every transaction.
Step 4: Verify Delivery with Receipts
Paying money does not guarantee the API delivered the right data. An on-chain payment proves money moved. It does not prove the service worked. Lumière PayCheck makes real paid test calls to endpoints. These tests confirm that the endpoint delivers what it advertises. Every paid test PayCheck makes itself comes with a signed receipt. This receipt is an Ed25519 signature that proves the test happened.
You can view these receipts at GET /v1/test-receipts. They are public and free. If your agent pays for a service, you can compare the result to the paid test results. This helps you identify endpoints that take money but fail to deliver data. Sellers can also fund a paid test of their own endpoint. The money goes back to their payout wallet. This allows them to show a live badge of reliability.
Other ways to protect an agent, and when to use each
- Spending caps. Limit what the agent can pay per call and per day. Recent x402 clients add defaults: starting with @x402/core 2.23, a $1 per-payment cap applies unless you change it. Caps limit the damage from a bad seller, but they don't tell your agent which sellers are bad.
- An allowlist. Only pay sellers you've vetted yourself. This is the safest option if your agent uses a few known APIs, but it breaks as soon as the agent needs a new one.
- A pre-payment check like PayCheck. It fits agents that pay many different or new sellers, where you can't vet each one by hand. It works alongside caps, not instead of them.
The strongest setup uses all three: an allowlist for core APIs, caps on everything, and a check before paying anyone new.
FAQ
What is x402? x402 is a protocol where APIs respond with a 402 status code and a payment quote. The client pays the quoted amount in crypto and retries the request with proof of payment. It removes the need for accounts or invoices.
What does the "caution" verdict mean? A "caution" verdict means the endpoint is not fully confirmed yet. It is not a warning to avoid payment. Only the "avoid" verdict means you should not pay. Use the detailed check-payment tool for more context on caution scores.
How do I add an endpoint that is not in the Bazaar? You can add any HTTPS x402 endpoint outside the Bazaar by posting to https://lumierepaycheck.org/v1/endpoints/submit. Checking one we do not monitor also adds it to our system for grading.
Start checking your endpoints today at https://lumierepaycheck.org/.
Related reading
More from the blog
The highest-graded x402 APIs for web search and scraping
Updated November 21, 2026 from PayCheck's live grades. These are the x402 endpoints for web search and scraping that Lumière PayCheck grades highest right…
What Is X402?
X402 is an HTTP extension that lets APIs ask for payment directly in their responses. An API returns a 402 status code with a price quote and wallet…
The highest-graded x402 APIs for weather and earth data
Updated November 20, 2026 from PayCheck's live grades. These are the x402 endpoints for weather and earth data that Lumière PayCheck grades highest right…