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
The URL to fetch.
HTTP method. One of
GET, POST, PUT, PATCH, DELETE.Raw request body string. When provided,
Content-Type: application/json is set by default unless overridden by a header entry.Additional HTTP headers. Each entry must be a string in
Name: value format.Request timeout in milliseconds.
Force a specific payment protocol:
x402 or mpp. By default, AgentCash auto-selects.Preferred network for SIWX and payment when applicable. By default, AgentCash auto-selects.
Maximum amount (in USD) to pay if the route still requires payment.
Response
The tool returns the response body along with payment metadata when a payment was made:The parsed response body from the endpoint.
Payment details, present when a 402 payment was made.
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, extracts payment details - Checks your wallet balance against the required amount
- Signs a payment credential with your wallet’s private key
- 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"}.