Check an x402 endpoint before paying it
x402_verifyCall this BEFORE authorising payment to any x402 endpoint you did not write yourself. It fetches the endpoint's live payment challenge and compares it against every observation previously made by every other caller, so you learn things a single agent cannot see on its own -- above all, whether the address receiving the money has changed. A 'critical' entry in drift means something determining where funds go (pay_to, network or asset) is different from before: stop and confirm out of band. Read the LIVE charges in preference to any directory listing, and pass what the listing claimed as expect to have the disagreement reported. IMPORTANT: 'status':'ok' is NOT an endorsement -- it only means a challenge was read and recorded. It cannot tell you whether the operator will deliver anything for your money. 'first_observation':true means there is no history at all, so an empty drift proves nothing. ALWAYS read prior_criticals: drift only compares against the last observation, so an endpoint that swapped its payee earlier shows an empty drift once that swap became the baseline -- a non-zero prior_criticals means it has changed where money goes before, and that is true no matter how clean today's look is. 'status':'unreachable' is not evidence of fraud and not evidence of health; do not pay on it either way. A null price_usd means the token's units are unknown here and the amount was NOT converted -- do not assume it is small. Costs $0.010 in USDC on Base, paid via the x402 protocol, or from a credit token — call credits_trial for free credit if you have neither.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | Public HTTPS URL of the endpoint you are about to pay. Loopback and private-network addresses are refused rather than fetched. | |
| expect | No | Optional. What a directory, README or earlier response led you to believe. Any disagreement with the live challenge is reported. | |
| method | No | How to provoke the challenge: 'POST' (default), 'GET' or 'HEAD'. Use the method you intend to pay for. | |
| credit_token | No | Optional. A credit token from credits_trial or /credits/buy. Supplying it pays for this call from that balance, so no x402 payment or wallet is needed. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | No | The URL that was checked | |
| drift | No | Differences from the last observation. Any severity 'critical' entry changes where money goes. Null means no comparison was made at all, which is not the same as an empty array. | |
| advice | No | Plain-language statement of what was and was not established | |
| status | Yes | 'ok' means a challenge was read -- NOT that the endpoint is trustworthy. 'refused' means the URL was never fetched. 'unreachable', 'redirected' and 'not_x402' all mean no challenge was obtained. | |
| charges | No | What the endpoint declares it will charge, right now | |
| last_seen | No | ISO-8601 time of the previous observation | |
| reachable | No | Whether the endpoint answered at all | |
| first_seen | No | ISO-8601 time this endpoint was first observed | |
| mismatches | No | How the live challenge disagrees with what you expected | |
| times_seen | No | How many observations exist, across all callers | |
| http_status | No | Status code the endpoint returned | |
| last_critical | No | The most recent previously recorded critical change, or null if there has never been one. | |
| prior_criticals | No | How many critical changes have EVER been recorded for this endpoint, not counting this call. `drift` only compares against the last observation, so once a change has been absorbed into the baseline it stops appearing there. A non-zero value here means this endpoint has changed where money goes before, even when `drift` is empty. | |
| first_observation | No | True when there was no prior record, so an empty `drift` means nothing | |
| matches_expectation | No | Present only when `expect` was supplied |