ReqCast API — Base Mainnet

ReqCast Developer Reference

ReqCast is payment infrastructure for the AI agent economy. It sits between AI agents and the API tools they need to call. Developers register their tool once and get paid in USDC every time an agent calls it. No payment code required on your side.

Base URL: https://api.reqcast.com

Network: Base Mainnet (eip155:8453) · Currency: USDC

Quickstart

Get your tool live and accepting payments from AI agents in two steps.

Step 1 — Register your tool

Send one POST request with your wallet address, tool name, price per call, and the callback URL ReqCast will hit after payment is verified.

cURL
curl -X POST https://api.reqcast.com/register \
  -H "Content-Type: application/json" \
  -d '{
    "wallet_address":  "0xYOUR_WALLET",
    "tool_name":       "your-tool-name",
    "price_per_call":  "0.10",
    "callback_url":    "https://your-server.com/your-tool",
    "timeout_seconds": 10
  }'

ReqCast responds with your dedicated payment endpoint:

Response
{
  "status":          "registered",
  "tool_name":        "your-tool-name",
  "price_per_call":   "0.10",
  "pay_endpoint":     "/pay/your-tool-name",
  "timeout_seconds":  10,
  "warning":          null
}

Step 2 — Build your callback

ReqCast calls your callback_url after payment is verified. Your endpoint receives the buyer payload and returns any JSON result.

Python (FastAPI)
from fastapi import FastAPI, Request

app = FastAPI()

@app.post("/your-tool")
async def handle(request: Request):
    body = await request.json()

    # X-ReqCast-Verified: true confirms payment cleared
    user_input = body["input"]

    result = your_tool_logic(user_input)

    return {"result": result}

That is the full integration. ReqCast handles payment verification, the USDC split, and receipt generation. You just return your tool output.

Your tool is now discoverable at api.reqcast.com/tools and callable by any AI agent with a USDC wallet and an x402 client.

x402 client setup

To call a tool registered on ReqCast, the buyer needs an x402-compatible client. This is typically an AI agent or an automated script with a USDC wallet on Base.

Python
import asyncio
from eth_account import Account
from x402 import x402Client
from x402.mechanisms.evm.exact import register_exact_evm_client
from x402.http.clients.httpx import x402HttpxClient

async def call_tool():
    account = Account.from_key("YOUR_PRIVATE_KEY")

    client = x402Client()
    register_exact_evm_client(
        client,
        account,
        networks=['eip155:8453']
    )

    async with x402HttpxClient(client) as http:
        response = await http.post(
            "https://api.reqcast.com/pay/your-tool-name",
            json={"buyer_payload": {"query": "your input"}}
        )
        print(response.json())

asyncio.run(call_tool())
Never hardcode private keys in production. Use environment variables or a secrets manager.

GET /health

Returns server status, uptime, transaction statistics, and a link to the interactive docs. Use this to verify the API is alive before integrating.

GET https://api.reqcast.com/health
Response
{
  "status":           "ok",
  "version":          "1.0.0",
  "environment":      "mainnet",
  "network":          "base",
  "uptime":           "12h 33m",
  "registered_tools": 3,
  "transactions": {
    "total":        47,
    "completed":    46,
    "failed":       1,
    "success_rate": "97.9%"
  },
  "last_transaction": "2026-03-18T14:32:00Z",
  "docs":             "https://api.reqcast.com/docs"
}

GET /tools

Returns all registered tools with their price per call and pay endpoint. Use this to discover what tools are available on ReqCast.

GET https://api.reqcast.com/tools
Response
{
  "tools": [
    {
      "tool_name":      "crypto-price-feed",
      "price_per_call": "0.01",
      "pay_endpoint":   "https://api.reqcast.com/pay/crypto-price-feed",
      "registered_at":  "2026-03-18T22:40:24Z"
    }
  ],
  "total": 1
}

POST /register

Register your tool with ReqCast. This creates a dedicated payment endpoint at /pay/{tool_name} with its own x402 price. ReqCast pings your callback URL at registration time and rejects unreachable URLs.

POST https://api.reqcast.com/register
Parameter Type Description
wallet_addressrequired string Your USDC wallet address on Base network. This is where your payments are sent.
tool_namerequired string Unique identifier for your tool. Used in the pay endpoint URL. Must be unique across all registered tools.
price_per_callrequired string USDC amount charged per call. Example: "0.10" for $0.10 per call.
callback_urlrequired string The URL ReqCast POSTs to after payment is verified. Must be publicly reachable.
timeout_secondsoptional integer How long ReqCast waits for your callback to respond. Default 10, maximum 30.
callback_auth_headeroptional string Custom auth header name to include when ReqCast calls your callback. Example: X-API-Key.
callback_auth_valueoptional string Value for the custom auth header. Stored securely and sent with every callback request.
callback_payload_modeoptional string How ReqCast sends the buyer payload to your callback. wrapped (default) sends {"input": payload}. passthrough sends the payload directly as the request body.
Request — minimal
{
  "wallet_address":  "0xYOUR_WALLET",
  "tool_name":       "your-tool-name",
  "price_per_call":  "0.10",
  "callback_url":    "https://your-server.com/your-tool",
  "timeout_seconds": 10
}
Request — with auth and passthrough payload
{
  "wallet_address":        "0xYOUR_WALLET",
  "tool_name":             "your-tool-name",
  "price_per_call":        "0.10",
  "callback_url":          "https://your-server.com/your-tool",
  "timeout_seconds":       10,
  "callback_auth_header":  "X-API-Key",
  "callback_auth_value":   "your-secret-key",
  "callback_payload_mode": "passthrough"
}
Response 200
{
  "status":          "registered",
  "tool_name":        "your-tool-name",
  "price_per_call":   "0.10",
  "pay_endpoint":     "/pay/your-tool-name",
  "timeout_seconds":  10,
  "warning":          null
}
Response 409 — Tool name already taken
{
  "detail": "Tool 'your-tool-name' is already registered."
}
Response 400 — Callback URL unreachable
{
  "detail": "Callback URL 'https://...' is not reachable."
}

POST /pay/{tool_name}

The endpoint AI agents call to use a registered tool. Each tool has its own dedicated route with its own x402 price. Payment is verified on-chain before your tool runs.

! Payment is verified on-chain before the tool runs. If your tool fails after payment clears, the payment is not automatically reversed. See the Failures and refunds policy.
POST https://api.reqcast.com/pay/{tool_name}
Request
{
  "buyer_payload": {
    "query": "your input here"
  }
}
Response 200
{
  "transaction_id": "uuid",
  "result": { ...tool output... },
  "receipt": {
    "transaction_id":   "uuid",
    "tool_name":        "your-tool-name",
    "status":           "completed",
    "timestamp":        "2026-03-18T14:32:00Z",
    "price_usdc":       0.10,
    "developer_cut":    0.095,
    "reqcast_cut":      0.005,
    "developer_wallet": "0xYOUR_WALLET",
    "payout_tx_hash":   "0x..."
  }
}
Response 502 — Tool timed out or unreachable
{
  "detail": "Tool 'your-tool-name' timed out. Payment not charged."
}

Note: 502 errors returned before tool execution means payment was not charged. 502 errors after payment verification means payment was charged and the tool failed.

GET /receipt/{transaction_id}

Returns the full tamper-evident receipt for a completed transaction. The payout_tx_hash is verifiable on BaseScan as proof of on-chain payout.

GET https://api.reqcast.com/receipt/{transaction_id}
Response 200
{
  "transaction_id":   "uuid",
  "tool_name":        "your-tool-name",
  "status":           "completed",
  "timestamp":        "2026-03-18T14:32:00Z",
  "price_usdc":       0.10,
  "developer_cut":    0.095,
  "reqcast_cut":      0.005,
  "developer_wallet": "0xYOUR_WALLET",
  "payout_tx_hash":   "0x...",
  "tool_result":      { ...tool output... }
}

Verify any payout_tx_hash at: basescan.org

GET /status/{transaction_id}

Returns the current state of a transaction. Useful for AI agents to check if they should retry or move on.

GET https://api.reqcast.com/status/{transaction_id}
Response 200
{
  "transaction_id": "uuid",
  "status":         "completed",
  "timestamp":      "2026-03-18T14:32:00Z"
}

Possible status values: pending, execution_started, completed, failed, refund_pending, refunded, refund_failed


Failures and refunds

Understanding how ReqCast handles failures is important before you bring real users to your tool.

How payment timing works

The x402 protocol verifies and moves USDC on-chain before ReqCast calls your tool. This means payment is captured the moment the agent sends a valid signed transaction, not after your tool responds.

When the buyer is not charged

If ReqCast cannot reach your callback URL at all, or if your tool fails to respond before the request even reaches your server, the buyer is not charged. ReqCast returns a 502 and no USDC moves.

When the buyer is charged and the tool fails

If your callback URL is reached but your tool returns an error or times out after payment has already been verified, ReqCast automatically initiates a refund to the buyer wallet. The refund engine retries up to 3 times with a 2-second delay between attempts.

Automatic refunds are live. Timeouts, unreachable callbacks, and non-2xx responses all trigger automatic refund attempts. If all 3 attempts fail, the transaction is marked refund_failed and the ReqCast team is alerted for manual resolution.

What to do if a dispute arises

Contact us at [email protected] with the transaction ID and payout tx hash. Every transaction has a full on-chain audit trail. Disputes are handled manually on a case by case basis.

Best practices for tool developers

  • Make your callback URL highly reliable. Use a server with good uptime.
  • Set a realistic timeout. If your tool takes 20 seconds, register with timeout_seconds: 25.
  • Return a meaningful error response if something goes wrong so the buyer understands what happened.
  • Test your callback URL thoroughly before going live. Use Base Sepolia testnet for initial testing.
Automatic refund logic is live. When your callback times out, is unreachable, or returns a non-2xx response, ReqCast automatically attempts to refund the buyer up to 3 times. If all attempts fail, the transaction is marked refund_failed and flagged for manual review.