API Reference

Complete documentation for integrating x402-RPC-Aggregator into your applications. This API provides intelligent RPC routing with built-in x402 micropayment support for Solana, Ethereum, and Base chains.

Machine Endpoint Catalog

Agents can parse the following manifest to discover available HTTP entry points, accepted facilitators, and content types.

{
  "api": "x402-rpc-aggregator",
  "version": "2025-11-11",
  "baseUrl": "https://x402labs.cloud",
  "endpoints": [
    {"method": "POST", "path": "/rpc", "requiresPayment": true, "headers": ["Content-Type", "x402-payment?", "x402-batch?"], "facilitators": ["auto", "x402labs", "payai", "codenut"]},
    {"method": "GET", "path": "/health"},
    {"method": "GET", "path": "/providers{?chain}"},
    {"method": "GET", "path": "/providers/{providerId}"},
    {"method": "GET", "path": "/facilitator"},
    {"method": "GET", "path": "/pricing/sol-usd"},
    {"method": "GET", "path": "/batch-pricing{?chain}"},
    {"method": "GET", "path": "/rpc-methods{?chain,provider}"},
    {"method": "POST", "path": "/solana-rpc", "notes": "Server-side proxy, requires backend context"}
  ],
  "paymentHeader": "x402-payment",
  "batchHeader": "x402-batch"
}

Facilitator Status

GET /facilitator

Returns which facilitator is currently primary, its fallback, and suggested client behavior.

curl https://x402labs.cloud/facilitator
{
  "primary": {
    "name": "x402labs",
    "type": "x402labs",
    "available": true
  },
  "fallback": {
    "name": "CodeNut Pay",
    "type": "codenut",
    "available": true
  },
  "configuration": {
    "type": "auto",
    "fallbackEnabled": true
  },
  "recommendation": "Using primary facilitator: x402labs"
}

Real-Time Pricing Oracle

GET /pricing/sol-usd

Fetch the SOL/USD price feed (via Jupiter) and derived USD-to-lamports conversions used for rent-exempt enforcement.

curl https://x402labs.cloud/pricing/sol-usd
{
  "current": {
    "price": 156.38,
    "source": "Jupiter",
    "timestamp": "2025-11-11T19:05:28.439Z"
  },
  "cached": {
    "price": 156.12,
    "age": "42s"
  },
  "health": { "healthy": true },
  "providerCosts": [
    {
      "provider": "Helius",
      "usdCost": 0.00015,
      "lamports": 890880,
      "sol": "0.000890880"
    }
  ]
}

Batch Pricing API

GET /batch-pricing

Discover prepaid bundle options for a given chain. Combine with x402-batch header to redeem.

Query Parameters

Parameter Type Description
chainrequired string Blockchain identifier (e.g., "solana")
curl 'https://x402labs.cloud/batch-pricing?chain=solana'
{
  "chain": "solana",
  "batchOptions": [
    {
      "providerId": "helius-solana",
      "providerName": "Helius",
      "calls": 1000,
      "price": 0.12,
      "pricePerCall": 0.00012,
      "savings": "20.0%"
    }
  ],
  "note": "Batch payments allow you to pre-pay for multiple RPC calls at a discount"
}

RPC Methods

GET /rpc-methods

Returns the RPC methods supported by the routed provider for a specific chain (or provider).

Query Parameters

Parameter Type Description
chainrequired string Target network ("solana" | "ethereum" | "base")
provideroptional string Provider id (overrides default selection)
curl 'https://x402labs.cloud/rpc-methods?chain=solana'
{
  "chain": "solana",
  "provider": "Helius",
  "methods": [
    "getSlot",
    "getBalance",
    "getLatestBlockhash",
    "getAccountInfo"
  ],
  "documentation": "https://docs.solana.com/api"
}

Quick Start

Make your first machine-payable RPC call in less than 5 minutes. All requests go to https://x402labs.cloud/rpc.

1. Request Data

{
    "method": "getSlot",
  "params": [],
    "chain": "solana"
}

2. Interpret 402 Challenge

{
  "x402Version": 1,
  "accepts": [
    {
      "scheme": "exact",
      "network": "solana",
      "asset": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
      "maxAmountRequired": "150",
      "payTo": "3HBV2F9C25k8169rKv6FDqQaFHj52NYH5JJjFYDoSnAZ",
      "resource": "https://x402labs.cloud/rpc",
      "extra": {
        "facilitator": {
          "primary": "x402labs",
          "type": "x402labs",
          "fallback": "CodeNut Pay"
        },
        "feePayer": "HsozMJWWHNADoZRmhDGKzua6XW6NNfNDdQ4CkE9i5wHt",
        "nonce": "1762898224761-0.11427330977237005"
  }
    }
  ]
}

3. Pay โ†’ Retry (Automatic with SDK)

import { X402Agent } from './lib/x402-client';

const agent = new X402Agent('https://x402labs.cloud/');

// Handles 402 challenge, signs payment, retries request
const result = await agent.callRPC('getSlot', [], 'solana');

console.log(result.result);           // RPC result
console.log(result.x402.paymentInfo); // Payment metadata

Authentication LIVE

x402-RPC-Aggregator uses the x402 protocol for authentication. Instead of API keys, you pay per request using USDC micropayments on Solana or Base.

Payment Flow

  1. Make request without payment โ†’ Receive 402 with invoice
  2. Sign payment with wallet (Phantom/MetaMask)
  3. Retry request with x402-payment header
  4. Facilitator verifies & settles payment
  5. Receive RPC response with receipt

RPC Endpoint LIVE

POST /rpc

Execute an RPC call with intelligent provider routing and x402 payment.

Request Body

Parameter Type Description
methodrequired string RPC method name (e.g., "getSlot", "eth_blockNumber")
paramsoptional array Method parameters (default: [])
chainoptional string Blockchain: "solana" | "ethereum" | "base" (default: "solana")
preferencesoptional object Routing preferences (see Routing Strategies)
facilitatoroptional string Payment facilitator: "x402labs" (SOL), "payai" (USDC), or "codenut" (USDC). Leave blank for automatic selection.

Response (200 Success)

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": 379462958,
  "x402": {
    "provider": "Helius",
    "paymentInfo": {
      "provider": "solana",
      "chain": "solana",
      "txHash": "5CTE...uRzh",
      "amount": 0.00015,
      "explorer": "https://orb.helius.dev/tx/5CTE...uRzh",
      "payer": "AyfXgR9SMs9GucxJReJqCHGCM2R6xgF29MwNAm7WR75k",
      "timestamp": "2025-10-28T19:12:40.582Z"
    },
    "cost": 0.00015,
    "status": "settled"
  }
}

Response (402 Payment Required)

{
  "x402Version": 1,
  "accepts": [
    {
      "scheme": "exact",
      "network": "solana",
      "asset": "USDC",
      "maxAmountRequired": "150",
      "payTo": "3HBV2F9C25k8169rKv6FDqQaFHj52NYH5JJjFYDoSnAZ",
      "resource": "https://x402labs.cloud/rpc",
      "description": "RPC access via Helius for solana",
      "extra": {
        "facilitator": {
          "primary": "x402labs",
          "type": "x402labs",
          "fallback": "CodeNut Pay"
        },
        "feePayer": "HsozMJWWHNADoZRmhDGKzua6XW6NNfNDdQ4CkE9i5wHt",
        "nonce": "1762898224761-0.11427330977237005"
    }
  }
  ]
}

x402-payment Header Format REQUIRED

The x402-payment header contains payment proof for accessing RPC endpoints. It must be a JSON string with payment payload and requirements.

Header Structure

Header: x402-payment
Value: JSON string

{
  "paymentPayload": {
    // Payment proof (varies by facilitator)
  },
  "paymentRequirements": {
    // Payment details
  }
}

Schema (JSON)

{
  "type": "object",
  "required": ["paymentPayload", "paymentRequirements"],
  "properties": {
  "paymentPayload": {
      "type": "object",
      "description": "Facilitator-specific proof",
      "properties": {
    "signedIntent": {
          "type": "object",
          "properties": {
            "publicKey": { "type": "string" },
            "signature": { "type": "string" }
          }
    },
        "x402Version": { "type": "number" },
        "scheme": { "type": "string" },
        "network": { "type": "string" },
        "facilitator": { "type": "string" },
        "txBase64": { "type": "string" },
        "payload": {
          "type": "object",
          "properties": {
            "transaction": { "type": "string" }
          }
        }
      }
  },
  "paymentRequirements": {
      "type": "object",
      "properties": {
        "scheme": { "type": "string" },
        "network": { "type": "string" },
        "maxAmountRequired": { "type": ["string", "number"] },
        "amount": { "type": ["string", "number"] },
        "asset": { "type": ["string", "object"] },
        "payTo": { "type": "string" },
        "recipient": { "type": "string" },
        "resource": { "type": "string" },
        "description": { "type": "string" },
        "extra": { "type": "object" }
      }
    }
  }
}

Facilitator Payment Specifications

Click on a facilitator tab to view its payment structure and requirements:

๐ŸŸข x402labs Facilitator ยท SOL (Self-Hosted)

Send a signed SOL transfer (rent-exempt minimum 890,880 lamports). The field txBase64 is a legacy name and MUST contain a base58-encoded transaction.

{
  "paymentPayload": {
    "facilitator": "x402labs",
    "signedIntent": {
      "publicKey": "AyfXgR95iMn9CuxJReJqCHGCM2R6xgF29MwNAm7WR75k",
      "signature": "3j5Y...9fzr"  // base58 ed25519 signature over the intent JSON
    },
    "txBase64": "5oE7...xJvS",   // base58-encoded VersionedTransaction bytes
    "network": "solana-mainnet"
  },
  "paymentRequirements": {
    "amount": 890880,             // lamports (string or number)
    "recipient": "3HBV2F9C25k8169rKv6FDqQaFHj52NYH5JJjFYDoSnAZ",
    "nonce": "1762898224761-0.11427330977237005",
    "resource": "https://x402labs.cloud/rpc"
  }
}

Intent message (sign exactly this JSON string):

{
  "amount": 890880,
  "to": "3HBV2F9C25k8169rKv6FDqQaFHj52NYH5JJjFYDoSnAZ",
  "nonce": "1762898224761-0.11427330977237005",
  "resource": "https://x402labs.cloud/rpc"
}

๐ŸŸฃ CodeNut Pay ยท USDC on Solana/Base

Provide a partially signed USDC transfer where the facilitator co-signs. Transaction MUST be base64 encoded and include compute budget instructions first.

{
  "paymentPayload": {
    "x402Version": 1,
    "scheme": "exact",
    "network": "solana",
    "facilitator": "codenut",
    "payload": {
      "transaction": "AgAAAAACAAACr8..."  // base64, requireAllSignatures=false
    }
  },
  "paymentRequirements": {
    "scheme": "exact",
    "network": "solana",
    "maxAmountRequired": "150",            // micro-USDC
    "asset": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
    "payTo": "3HBV2F9C25k8169rKv6FDqQaFHj52NYH5JJjFYDoSnAZ",
    "resource": "https://x402labs.cloud/rpc",
    "description": "x402 RPC payment",
    "extra": {
      "feePayer": "HsozMJWWHNADoZRmhDGKzua6XW6NNfNDdQ4CkE9i5wHt",
      "nonce": "1762898224761-0.11427330977237005"
    }
  }
}

Instruction order inside payload.transaction:

  • ComputeBudget.limit (40,000 units recommended)
  • ComputeBudget.price (โ‰ฅ1 micro-lamport)
  • TransferChecked for USDC (facilitator ATA must already exist)
  • Optional: CreateAssociatedTokenAccount if facilitator indicated ATA creation is allowed

๐Ÿ”ต PayAI Network ยท USDC on Solana

Use PayAI's x402-solana SDK v0.1.4 to build the payment. The facilitator URL signs and broadcasts.

{
  "paymentPayload": {
    "x402Version": 1,
    "scheme": "exact",
    "network": "solana",
    "facilitator": "payai",
    "payload": {
      "transaction": "AgAAAAABAAABo0..."  // base64, fee payer = facilitator
    }
  },
  "paymentRequirements": {
    "scheme": "exact",
    "network": "solana",
    "maxAmountRequired": "150",           // micro-USDC
    "asset": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
    "payTo": "3HBV2F9C25k8169rKv6FDqQaFHj52NYH5JJjFYDoSnAZ",
    "resource": "https://x402labs.cloud/rpc",
    "description": "x402 RPC payment",
    "extra": {
      "feePayer": "2wKupLR9q6wXYppw8Gr2NvWxKBUqm4PPJKkQfoxHDBg4"
    }
  }
}

PayAI requirements:

  • Instruction 0: ComputeBudget.limit(40000)
  • Instruction 1: ComputeBudget.price(1)
  • Instruction 2: TransferChecked (no inline ATA creation)
  • Serialize with requireAllSignatures=false; facilitator adds fee-payer signature

Amount Units Reference

Asset Base Unit Decimals Example
SOL lamports 9 749 lamports = 0.000000749 SOL โ‰ˆ $0.00015
USDC micro-USDC 6 150 micro-USDC = 0.000150 USDC = $0.00015
ETH wei 18 5e14 wei = 0.0005 ETH โ‰ˆ $1.50

๐Ÿง  Tip: Send monetary fields as strings (e.g., "150") to avoid JSON floating-point precision loss.

Usage Example

JavaScript example:

const payment = {
  paymentPayload: {
    signedIntent: { /* ... */ },
    txBase64: "...",  // x402labs only
    network: "solana"
  },
  paymentRequirements: {
    amount: 749,
    recipient: "26AvBMEXaJAfA2R7wtQiPNYeWUd8QSi6rvy5i5W78vNR",
    nonce: `${Date.now()}-${Math.random()}`
  }
};

const response = await fetch('https://x402labs.cloud/rpc', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'x402-payment': JSON.stringify(payment)  // โ† Stringified JSON
  },
  body: JSON.stringify({
    method: 'getSlot',
    params: [],
    chain: 'solana'
  })
});

Validation Rules

The payment header is validated for:

  • Valid JSON format
  • Ed25519 signature verification (x402labs only)
  • Recipient matches treasury wallet
  • Nonce is unique (prevents replay attacks)
  • x402labs: SOL transfer โ‰ฅ 890,880 lamports and txBase64 decodes to a valid transaction
  • CodeNut: Base64 payload transaction includes compute budget instructions (positions 0 and 1) and matches quoted maxAmountRequired
  • PayAI: Base64 payload transaction sets facilitator fee payer, instructions [limit, price, transfer], and passes SDK verification
  • Optional batch metadata is stored server-side (x402-batch header) and decremented atomically

Health Check

GET /health

Check service health and provider status.

curl https://x402labs.cloud/health

Response

{
  "status": "ok",
  "timestamp": "2025-10-27T12:00:00.000Z",
  "version": "1.0.0",
  "chains": ["solana", "ethereum", "base"],
  "stats": {
    "totalProviders": 8,
    "activeProviders": 8,
    "healthyProviders": 7,
    "averageLatency": 312
  }
}

List Providers

GET /providers

Get list of all RPC providers with real-time health status.

Query Parameters

Parameter Type Description
chainoptional string Filter by chain: "solana" | "ethereum" | "base"
curl 'https://x402labs.cloud/providers?chain=solana'

Response

{
  "providers": [
    {
      "id": "triton-solana",
      "name": "Triton One",
      "chains": ["solana"],
      "costPerCall": 0.0001,
      "batchCost": { "calls": 1000, "price": 0.08 },
      "status": "active",
      "priority": 100,
      "averageLatency": 245
    }
  ],
  "total": 1
}

Provider Details

Inspect telemetry, current latency, and cost for a specific provider.

GET /providers/triton-solana
{
  "id": "triton-solana",
  "name": "Triton One",
  "chains": ["solana"],
  "costPerCall": 0.00015,
  "batchCost": { "calls": 1000, "price": 0.12 },
  "status": "active",
  "priority": 90,
  "averageLatency": 241,
  "metadata": {
    "supportedMethods": ["getSlot", "getBalance", "..."],
    "dataCenters": ["us-east-1", "eu-central-1"]
  },
  "health": {
    "lastChecked": "2025-11-11T19:07:12.384Z",
    "lastStatus": "active",
    "consecutiveFailures": 0
  }
}

Routing Strategies LIVE

Customize how the aggregator selects RPC providers for your requests.

Available Strategies

1. Lowest Cost (Default)

Selects the provider with the lowest cost per call.

{
  "method": "getSlot",
  "chain": "solana",
  "preferences": {
    "strategy": "lowest-cost"
  }
}

2. Lowest Latency

Selects the fastest provider based on real-time health checks.

{
  "method": "getSlot",
  "chain": "solana",
  "preferences": {
    "strategy": "lowest-latency",
    "maxLatencyMs": 2000
  }
}

3. Highest Priority

Uses premium providers first (e.g., Triton One for Solana).

{
  "method": "getSlot",
  "chain": "solana",
  "preferences": {
    "strategy": "highest-priority"
  }
}

4. Round Robin

Distributes load evenly across all providers.

{
  "method": "getSlot",
  "chain": "solana",
  "preferences": {
    "strategy": "round-robin"
  }
}

Facilitator Catalog

Three facilitators are supported. Clients may force one via "facilitator" in the /rpc request body or allow automatic selection based on availability.

Key Network Asset Fee Payer When to use
x402labs solana SOL (lamports, rent-exempt minimum) Client wallet Self-hosted SOL settlement with full control. Requires SOL balance & rent exempt amount.
payai solana USDC (micro-USDC) PayAI facilitator Lowest per-call cost. Facilitator co-signs and broadcasts. Requires Phantom (partial signature).
codenut solana, base USDC (micro-USDC) or EVM intent CodeNut facilitator On-chain verification plus optional Base support. Facilitator can create ATA when allowed.

Availability is exposed via /facilitator. The 402 response mirrors this in accepts[].extra.facilitator.

Batch Payments LIVE

Purchase multiple calls upfront for discounted pricing (20% savings).

Get Batch Pricing

curl 'https://x402labs.cloud/batch-pricing?chain=solana'

Response

{
  "chain": "solana",
  "batchOptions": [
    {
      "providerId": "triton-solana",
      "providerName": "Triton One",
      "calls": 1000,
      "price": 0.08,
      "pricePerCall": 0.00008,
      "savings": "20.0%"
    }
  ]
}

Purchase Batch

Send a regular /rpc payment with "batchPurchase": true in the JSON body:

{
  "method": "getSlot",
  "chain": "solana",
  "batchPurchase": true
}

The 402 response will quote the batch price and the facilitator settles the bulk purchase.

Use Batch

Include x402-batch header with the returned batchId (JSON string).

curl -X POST https://x402labs.cloud/rpc \
  -H 'Content-Type: application/json' \
  -H 'x402-batch: {"batchId":"batch_1731358433_ab12cd3"}' \
  -d '{"method":"getSlot","chain":"solana"}'

Remaining call credits and expiration are returned in the normal 200 response.

Error Handling

HTTP Status Codes

Code Meaning Action
200 Success Payment settled, RPC executed
402 Payment Required Pay invoice and retry
400 Bad Request Check request parameters
404 Not Found Check endpoint URL
500 Server Error Retry with fallback provider

JavaScript/TypeScript SDK

import { X402Agent } from './lib/x402-client';

// Initialize agent
const agent = new X402Agent('https://x402labs.cloud/');

// Make RPC call (handles payment automatically)
const result = await agent.callRPC('getSlot', [], 'solana');

console.log('Current slot:', result.result);
console.log('Payment tx:', result.x402.paymentInfo.txHash);

With Preferences

const result = await agent.callRPC(
  'getBalance',
  ['SomeWalletAddress...'],
  'solana',
  {
    strategy: 'lowest-latency',
    maxLatencyMs: 1500,
    preferredProviders: ['triton-solana']
  }
);

Python (Concept)

from x402_client import X402Agent

# Initialize
agent = X402Agent('https://x402labs.cloud/')

# Make call
result = agent.call_rpc('getSlot', [], chain='solana')
print(f"Slot: {result['result']}")
print(f"Tx: {result['x402']['paymentInfo']['txHash']}")

cURL Examples

Solana - Get Slot

curl -X POST https://x402labs.cloud/rpc \
  -H "Content-Type: application/json" \
  -d '{
    "method": "getSlot",
    "chain": "solana"
  }'

Ethereum - Block Number

curl -X POST https://x402labs.cloud/rpc \
  -H "Content-Type: application/json" \
  -d '{
    "method": "eth_blockNumber",
    "chain": "ethereum"
  }'

With Custom Routing

curl -X POST https://x402labs.cloud/rpc \
  -H "Content-Type: application/json" \
  -d '{
    "method": "getSlot",
    "chain": "solana",
    "preferences": {
      "strategy": "lowest-latency",
      "maxLatencyMs": 2000
    }
  }'

Need help? Check out GitHub or visit the Live Demo

Frequently Asked Questions (FAQ)

Click on any question to expand the answer. Common questions are listed first.

Q: Why am I getting "Payment verification failed" with SOL payments? โŒ„

A: You must specify "facilitator": "x402labs" in your request body for SOL payments. Without this, the system defaults to PayAI Network, which expects USDC payments and will fail when receiving SOL.

// โœ… Correct - Specify facilitator for SOL
{
  "method": "getSlot",
  "params": [],
  "chain": "solana",
  "facilitator": "x402labs"  // โ† Required for SOL payments!
}
Q: What's the difference between x402labs and PayAI facilitators? โŒ„

A: They use different payment tokens:

  • x402labs ("x402labs"): Self-hosted facilitator using SOL payments. You send a signed SOL transfer transaction.
  • PayAI ("payai"): Network facilitator using USDC payments. PayAI handles settlement and broadcasting.

Q: Why do I need to send 890,880 lamports minimum for x402labs?

A: Solana requires accounts to hold at least 890,880 lamports to be rent-exempt. The system automatically ensures SOL payments meet this minimum, even if the provider cost is lower. This prevents "InsufficientFundsForRent" errors.

Q: What encoding should I use for signatures and transactions?

A: Encoding depends on the facilitator:

  • x402labs (SOL): Use base58 for publicKey, signature, and txBase64
  • PayAI (USDC): Use base64 for payload.transaction

Q: Should network be "solana" or "solana-mainnet"?

A: Either works! The backend automatically normalizes "solana" to "solana-mainnet".

Pricing & Payments

Q: How much do payments cost?

A: Costs vary by facilitator:

  • x402labs (SOL): 890,880 lamports per call (~$0.0054 at $165/SOL) - fixed rent-exempt amount
  • PayAI (USDC): 100-200 micro-USDC per call (~$0.0001-$0.0002) - varies by provider

For micro-payments below $0.001, PayAI with USDC is more cost-effective than x402labs with SOL.

Q: How are prices calculated for SOL payments?

A: For x402labs facilitator, all SOL payments use the rent-exempt minimum of 890,880 lamports. This ensures the treasury wallet stays active on Solana and prevents "InsufficientFundsForRent" errors.

  • All calls cost: 890,880 lamports (~$0.0054 USD at $165/SOL)
  • This is required by Solana's rent-exemption rules
  • For micro-payments, use PayAI with USDC instead

Q: Which facilitator should I use?

A: Depends on your preference:

  • x402labs ("x402labs"): Self-hosted, pay with SOL (890,880 lamports per call)
  • PayAI ("payai"): Network service, pay with USDC (100-200 micro-USDC per call, recommended for micro-payments)

Q: Are payments refundable if the RPC call fails?

A: No, payments are final once settled on-chain. However, if payment verification fails BEFORE settlement, no transaction is broadcast and you don't lose funds.

Technical Implementation

Q: Is payment verification synchronous or asynchronous?

A: Verification is synchronous and completes in less than 1 second. You get an immediate response (200 or 402). No polling or waiting required.

Q: Does the backend check my payment on-chain?

A: For x402labs, the backend:

  • Verifies your signature on the payment intent
  • Validates your transaction structure
  • Optionally simulates the transaction
  • Broadcasts YOUR signed transaction to the network
  • Waits for on-chain confirmation

The backend doesn't query for pre-existing transactions - it broadcasts the transaction you provide in txBase64.

Troubleshooting

Q: Error: "x402labs facilitator not available"

A: The backend is missing the SOLANA_PRIVATE_KEY environment variable. Use PayAI instead or contact the server administrator.

Q: How do I know which facilitator is available?

A: Check the 402 response:

"extra": {
  "facilitator": {
    "primary": "x402labs",  // Primary facilitator
    "type": "x402labs",                   // Use this value
    "fallback": "PayAI Network"           // Backup if primary fails
  }
}

Use the type value in your request body: "facilitator": "x402labs"

Provider Selection

Q: How do I use QuickNode's Metaplex DAS API?

A: Use the preferredProviders preference:

{
  "method": "getAssetSignatures",
  "params": [{"id": "HhbYrhZZ...", "limit": 10}],
  "chain": "solana",
  "preferences": {
    "preferredProviders": ["quicknode-solana"]
  },
  "facilitator": "x402labs"  // or "payai"
}

Q: Which provider will be selected if I don't specify preferences?

A: By default, the system uses "highest-priority" strategy:

  • Helius (priority: 100) - Usually selected first for Solana
  • QuickNode Base (priority: 80)
  • Triton One (priority: 70)
  • QuickNode Solana (priority: 65)

All providers are health-checked every 60 seconds. Only active providers are used.

Q: Can I force a specific provider?

A: Yes, use preferredProviders:

{
  "method": "getSlot",
  "params": [],
  "chain": "solana",
  "preferences": {
    "preferredProviders": ["triton-solana"]  // Force Triton One
  }
}

Advanced

Q: Do I need to broadcast my transaction before sending to backend?

A: No! For x402labs, the flow is:

  1. Build and sign the transaction with your wallet
  2. Serialize and encode to base58
  3. Send in txBase64 field to backend
  4. Backend broadcasts and waits for confirmation
  5. Backend returns transaction signature

For PayAI, you partially sign with facilitator as fee payer, and PayAI completes and broadcasts the transaction.

Q: How do batch payments work?

A: See the Batch Payments section. You can pre-pay for 1,000 calls at a 20% discount ($0.08 instead of $0.10), then use the batch ID for subsequent calls.

Q: What's the difference between costPerCall in provider config?

A: All costs are in USD:

  • Triton One: $0.0001 USD = 890,880 lamports (SOL, rent-exempt) or 100 micro-USDC
  • Helius: $0.00015 USD = 890,880 lamports (SOL, rent-exempt) or 150 micro-USDC
  • QuickNode: $0.0002 USD = 890,880 lamports (SOL, rent-exempt) or 200 micro-USDC

Note: SOL payments use rent-exempt minimum (890,880 lamports) to ensure treasury wallet stays active.

Getting Help

Q: Where can I get support?

A: Multiple channels available:

Q: Can I test without spending real SOL/USDC?

A: Payments are on mainnet and use real tokens. However, amounts are micro-payments ($0.0001-$0.0002 per call). For testing, you can:

  • Use the browser demo to see the flow
  • Make a single call (~$0.00015) to test integration
  • Check provider health at /providers without payment