Basic usage
Ask your agent to fetch data from a premium endpoint:
Use AgentCash to fetch https://stableenrich.dev/api/company/lookup with body {"domain": "anthropic.com"}.
The agent calls the fetch tool (in MCP mode) or uses the CLI, which:
- Sends the request to the endpoint
- Receives a
402 Payment Requiredresponse with pricing - Signs a USDC payment with your wallet
- Retries the request with the payment proof
- Returns the response data and payment info
Checking the price first
If you want to know the cost before paying, ask your agent to check the endpoint:Check the pricing for https://stableenrich.dev/api/company/lookup using AgentCash.This probes the endpoint without making a payment. It returns the price, accepted methods, and input/output schema.
Request options
Thefetch command accepts standard HTTP options:
AgentCash sets
Content-Type: application/json by default for requests with a body.Payment info in responses
Every paid request returns payment metadata alongside the response data:- amount: USDC paid
- transaction: on-chain transaction hash
- network: which chain the payment was made on
Error handling
If a payment fails, AgentCash returns a clear error. Common issues:| Error | Cause | Fix |
|---|---|---|
| Insufficient balance | Not enough USDC for the request price | Fund your wallet |
| Payment verification failed | On-chain verification issue | Retry the request |
| Timeout | Endpoint took too long to respond | Increase timeout or try again |