Skip to main content

Documentation Index

Fetch the complete documentation index at: https://agentcash.dev/docs/llms.txt

Use this file to discover all available pages before exploring further.

The 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

url
string
required
The URL to fetch.
method
string
default:"GET"
HTTP method. One of GET, POST, PUT, PATCH, DELETE.
body
string
Raw request body string. When provided, Content-Type: application/json is set by default unless overridden by a header entry.
headers
string[]
Additional HTTP headers. Each entry must be a string in Name: value format.
timeout
number
Request timeout in milliseconds.
paymentProtocol
string
Force a specific payment protocol: x402 or mpp. By default, AgentCash auto-selects.
paymentNetwork
string
Preferred network for SIWX and payment when applicable. By default, AgentCash auto-selects.
maxAmount
number
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:
data
object
The parsed response body from the endpoint.
paymentInfo
object
Payment details, present when a 402 payment was made.

Behavior

  1. Sends the request to the target URL
  2. If the response is 402 Payment Required with a SIWX challenge, signs the challenge and retries with auth headers
  3. If the route still returns 402, reads the accepted protocols (x402, mpp) and networks from the challenge
  4. Picks a protocol/network your wallet supports and checks the balance against the required amount
  5. Signs the payment proof (on-chain USDC transfer for x402, off-chain signed intent for MPP)
  6. Retries the request with the payment proof attached
  7. 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"}.