asndurl

Make HTTP requests to x402-enabled APIs with automatic payment handling via Ampersend wallet

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "asndurl" with this command: npx skills add matiasedgeandnode/asndurl

asndurl - x402 HTTP Client

Make HTTP requests to x402 payment-gated APIs. Automatically handles HTTP 402 Payment Required responses by creating and signing payments using the configured Ampersend smart account wallet.

When to Use

Use asndurl instead of curl when:

  • The API uses x402 payment protocol
  • You see HTTP 402 Payment Required responses
  • You need to pay for API access with crypto

When NOT to Use

  • Regular HTTP requests without x402 payments (use curl instead)
  • APIs using traditional API keys, OAuth, or other auth methods
  • Streaming responses (not supported)
  • When you need fine-grained control over payment authorization (use the SDK directly)

Prerequisites

Set wallet credentials using either format:

# Combined format (recommended)
export AMPERSEND_AGENT_KEY="0xaddress:::0xsession_key"

# Or separate variables
export AMPERSEND_SMART_ACCOUNT_ADDRESS="0x..."
export AMPERSEND_SESSION_KEY="0x..."

Optional:

export AMPERSEND_NETWORK="base"                 # Network (default: base)
export AMPERSEND_API_URL="https://..."          # Custom Ampersend API URL

Usage

Basic GET Request

npx @ampersend_ai/ampersend-sdk asndurl https://api.example.com/paid-endpoint

POST with JSON Body

npx @ampersend_ai/ampersend-sdk asndurl \
  -X POST \
  -H "Content-Type: application/json" \
  -d '{"query": "your data"}' \
  https://api.example.com/paid-endpoint

Inspect Payment Requirements (Without Paying)

Use --inspect to preview what payment is required without executing the payment:

npx @ampersend_ai/ampersend-sdk asndurl --inspect https://api.example.com/paid-endpoint

Debug Mode

To see detailed JSONL logs of the payment flow (output to stderr):

npx @ampersend_ai/ampersend-sdk asndurl --debug https://api.example.com/paid-endpoint

Options Reference

OptionDescription
-X, --method <method>HTTP method (default: GET)
-H, --header <header>HTTP header (format: "Key: Value"), can be repeated
-d, --data <data>Request body data
--inspectPreview payment requirements without paying
--rawOutput raw response body instead of JSON
--headersInclude response headers in JSON output
--debugOutput JSONL logs to stderr for troubleshooting

Supported Networks

  • base (default)
  • base-sepolia

How It Works

  1. Makes HTTP request to the target URL
  2. If server responds with HTTP 402 Payment Required:
    • Parses payment requirements from response
    • Creates payment using your smart account
    • Signs payment with session key
    • Retries request with payment header
  3. Returns the successful response

Error Handling

If wallet is not configured, you'll see:

Error: Wallet not configured.

Set the following environment variables:
  AMPERSEND_SMART_ACCOUNT_ADDRESS - Your smart account address
  AMPERSEND_SESSION_KEY - Session key private key

Examples

Query a Paid AI API

npx @ampersend_ai/ampersend-sdk asndurl \
  -X POST \
  -H "Content-Type: application/json" \
  -d '{"prompt": "Hello, world!"}' \
  https://ai-api.example.com/chat

Fetch Premium Data

npx @ampersend_ai/ampersend-sdk asndurl https://data-api.example.com/premium/market-data

Check if API Requires Payment

npx @ampersend_ai/ampersend-sdk asndurl --inspect https://api.example.com/endpoint

Raw Response Body

npx @ampersend_ai/ampersend-sdk asndurl --raw https://api.example.com/paid-endpoint

Output Format

By default, asndurl outputs structured JSON with a consistent envelope. Always check ok first.

Success Response

{
  "ok": true,
  "data": {
    "status": 200,
    "body": "{\"result\": \"data\"}",
    "payment": { ... }
  }
}

Use --headers to include response headers:

{
  "ok": true,
  "data": {
    "status": 200,
    "headers": { "content-type": "application/json" },
    "body": "..."
  }
}

Inspect Response

{
  "ok": true,
  "data": {
    "url": "https://api.example.com/endpoint",
    "paymentRequired": true,
    "requirements": {
      "scheme": "exact",
      "network": "base",
      "maxAmountRequired": "1000000",
      "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
      "payTo": "0x..."
    }
  }
}

Use --headers with --inspect to include response headers in the output.

Error Response

{
  "ok": false,
  "error": "Wallet not configured."
}

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Web3

Neko Futures Trader

Automated Binance Futures trading scanner with runner detection and price monitor. Features: - Runner detection (volume spike + momentum + breakout) - Real c...

Registry SourceRecently Updated
Web3

Bridge Stablecoin

Build USDC bridging with Circle Bridge Kit SDK and Crosschain Transfer Protocol (CCTP). Supports bridging USDC between EVM chains, between EVM chains and Sol...

Registry SourceRecently Updated
Web3

Binance Trade Hunter

Binance trading skill for coin analysis, pump detection, and one-click trading via Telegram. Use when the user wants to analyze crypto coins, check market tr...

Registry SourceRecently Updated
Web3

Use Usdc

USDC is Circle's stablecoin deployed across multiple blockchain ecosystems including EVM chains (Ethereum, Base, Arbitrum, Polygon, Arc) and Solana. Use this...

Registry SourceRecently Updated
asndurl | V50.AI