fetch tool sends an HTTP request to any URL and automatically handles SIWX authentication and payment if the endpoint requires them.
Equivalent CLI command: npx agentcash fetch <url>
Parameters
Raw request body string. When provided,
Content-Type: application/json is set by default unless overridden by a header entry.Response
The tool returns the response body along with metadata from the final response:All headers from the final endpoint response. This includes the raw
payment-receipt header for MPP or payment-response /
x-payment-response header for x402 when supplied by the server, so callers
can retain the original payment proof. Headers are also included when the
final endpoint response is an HTTP error.Behavior
- Sends the request to the target URL
- If the response is
402 Payment Requiredwith a SIWX challenge, signs the challenge and retries with auth headers - If the route still returns
402, reads the accepted protocols (x402,mpp) and networks from the challenge - Picks a protocol/network your wallet supports and checks the balance against the required amount
- Signs the payment proof (on-chain USDC transfer for x402, off-chain signed intent for MPP)
- Retries the request with the payment proof attached
- Returns the final response and payment info
Example
Ask your agent:
Use AgentCash to POST to https://stableenrich.dev/api/company/lookup with body {"domain": "stripe.com"}.