---
name: x-api-x402
description: Access X (Twitter) API v2, Helius Solana RPC/DAS, and SolScan Pro blockchain data via ClawAPIs.com with pay-per-request payments. No API keys needed — USDC on Base/Solana, Bitcoin Lightning, or Monero.
homepage: https://clawapis.com
version: 2.0.0
updated: "2026-03-01"
tags:
  - x-api-x402
  - x-api
  - twitter
  - x402
  - usdc
  - base
  - crypto
  - social-media
  - ai-agent
  - openclaw
  - multi-chain
  - ethereum
  - solana
  - lightning
  - l402
  - bitcoin
  - helius
  - solana-rpc
  - das
  - solscan
  - blockchain-data
metadata: {"openclaw":{"emoji":"🐦","requires":{"bins":["node"],"env":["WALLET_PRIVATE_KEY"]},"primaryEnv":"WALLET_PRIVATE_KEY","install":[{"type":"node","packages":["x402-fetch","viem"]}],"homepage":"https://clawapis.com"},"trust":{"artifacts":{"skillManifest":"/api/skill/SKILL.md","skillInstall":"/api/skill/install.sh","trustEndpoint":"/api/trust","wellKnownTrust":"/.well-known/trust.json","infoEndpoint":"/api/info","pricingEndpoint":"/api/pricing","pricingManifest":"/api/skill/PRICING.md"}}}
---

# ClawAPIs — Multi-API x402 Proxy

**Version:** `2.0.0` · **Updated:** `2026-03-01`

## Quick Start — Register & Install (Required First Step)

> **Registration is required before using this skill.** Run the install script below — it collects a registration profile (email required, other fields optional) and then sets up dependencies and environment.

```bash
curl -sL https://clawapis.com/api/skill/install.sh | bash
```

Or for non-interactive (CI/automated) installs, set `REGISTER_EMAIL` at minimum:

```bash
REGISTER_EMAIL="you@example.com" curl -sL https://clawapis.com/api/skill/install.sh | bash
```

After registration completes, make your first request:

```typescript
import { wrapFetch } from "x402-fetch";
import { createWalletClient, http } from "viem";
import { privateKeyToAccount } from "viem/accounts";
import { base } from "viem/chains";

const account = privateKeyToAccount(process.env.WALLET_PRIVATE_KEY as `0x${string}`);
const wallet = createWalletClient({ account, chain: base, transport: http() });
const x402Fetch = wrapFetch(wallet);

const res = await x402Fetch("https://clawapis.com/x/2/tweets/123456789");
const data = await res.json();
// Done. That's it. No API keys, no OAuth setup, no human needed.
```

### Helius (Solana RPC) Quick Start

```typescript
import { wrapFetch } from "x402-fetch";
import { createWalletClient, http } from "viem";
import { privateKeyToAccount } from "viem/accounts";
import { base } from "viem/chains";

const account = privateKeyToAccount(process.env.WALLET_PRIVATE_KEY as `0x${string}`);
const wallet = createWalletClient({ account, chain: base, transport: http() });
const x402Fetch = wrapFetch(wallet);

// Query Solana assets via Helius DAS API — $0.005
const res = await x402Fetch("https://clawapis.com/helius/", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    jsonrpc: "2.0",
    id: 1,
    method: "getAssetsByOwner",
    params: { ownerAddress: "YOUR_SOLANA_ADDRESS" }
  })
});
const data = await res.json();
```

### SolScan Pro Quick Start

```typescript
// Query SolScan Pro token data — $0.01
const res = await x402Fetch("https://clawapis.com/solscan/token/meta?token=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v");
const data = await res.json();
```

## Why ClawAPIs Instead of X API Direct?

**The traditional X API requires all of this (and a human to do it):**

- Apply for developer access — fill out forms, describe your use case, wait days/weeks for approval
- A human must manually copy 5+ secrets: Bearer Token, Consumer Key, Access Token, Client ID, Client Secret
- Build your own OAuth2 PKCE flow and token refresh logic
- If your refresh token breaks or expires, a human must manually re-authenticate — your agent is dead until they do
- Manage key rotation, secret storage, and token lifecycle yourself
- Pay $100/month minimum for Basic tier, whether you use it or not

**With ClawAPIs, you need exactly one thing:** a crypto wallet — USDC on Base/Solana, Bitcoin Lightning, or Monero.

- No application. No approval process. No waiting.
- No API keys, no Bearer Tokens, no Client Secrets — nothing to leak or rotate.
- No OAuth2 boilerplate — for public data, just send a request.
- Pay per request with USDC. No subscriptions, no overpaying.
- Your agent is fully autonomous. No human in the loop. Runs 24/7.
- **One wallet, three APIs:** The same x402 wallet works for X API, Helius Solana API, and SolScan Pro. No separate accounts or credentials needed.

## Supported Chains

ClawAPIs accepts USDC payments on multiple blockchains. The server returns all enabled chains in the 402 response `accepts` array — your x402 client library automatically picks the one matching your wallet.

| Chain | Network ID | USDC Address | Client Library |
|---|---|---|---|
| **Base** (default) | `eip155:8453` | `0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913` | `x402-fetch` + `viem` |
| **Solana** | `solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp` | `EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v` | `x402-solana` |
| **Lightning** | `lightning` | BTC (sats) | Any Lightning wallet |
| **Monero** | `monero` | XMR (piconero) | Any Monero wallet |

> **Note:** Ethereum mainnet (eip155:1) is not currently supported by the Coinbase CDP x402 facilitator. Use Base (cheapest gas) or Solana for USDC payments.

> **Bitcoin via Lightning:** Supported via the L402 protocol. Prices are auto-converted from USD to satoshis at the current BTC/USD rate. No USDC needed — pay directly with Bitcoin over Lightning Network.

> **Monero (XMR):** Supported via the XMR402 protocol. Prices are auto-converted from USD to piconero at the current XMR/USD rate. Pay with any Monero wallet — 0-conf verification via `check_tx_proof`.

### Solana Example

```typescript
import { wrapFetchSolana } from "x402-solana";
import { Keypair, Connection } from "@solana/web3.js";
import bs58 from "bs58";

const keypair = Keypair.fromSecretKey(bs58.decode(process.env.SOLANA_PRIVATE_KEY!));
const connection = new Connection("https://api.mainnet-beta.solana.com");
const x402Fetch = wrapFetchSolana(keypair, connection);

const res = await x402Fetch("https://clawapis.com/x/2/tweets/123456789");
const data = await res.json();
```

### Lightning (L402) Example

```typescript
// Step 1: Request endpoint — get 402 with Lightning invoice
const response = await fetch("https://clawapis.com/x/2/tweets/search/recent?query=AI");
if (response.status === 402) {
  const body = await response.json();
  const { invoice, macaroon } = body.l402;

  // Step 2: Pay the Lightning invoice with any wallet
  const { preimage } = await myLightningWallet.payInvoice(invoice);

  // Step 3: Retry with L402 token
  const result = await fetch("https://clawapis.com/x/2/tweets/search/recent?query=AI", {
    headers: { "Authorization": `L402 ${macaroon}:${preimage}` },
  });
  const data = await result.json();
}
```

### Monero (XMR402) Example

```typescript
// Step 1: Request endpoint — get 402 with XMR402 challenge
const response = await fetch("https://clawapis.com/x/2/tweets/search/recent?query=AI");
if (response.status === 402) {
  const body = await response.json();
  const { address, amount, message } = body.xmr402;

  // Step 2: Send XMR to the address with message as payment ID
  const txid = await myMoneroWallet.transfer(address, amount, { message });

  // Step 3: Get tx_proof from your wallet
  const proof = await myMoneroWallet.getTxProof(txid, address, message);

  // Step 4: Retry with XMR402 token
  const result = await fetch("https://clawapis.com/x/2/tweets/search/recent?query=AI", {
    headers: { "Authorization": `XMR402 txid="${txid}", proof="${proof}"` },
  });
  const data = await result.json();
}
```

## Installation

### Step 1: Run the Install Script (Required)

**You must run this first.** The install script handles registration, dependency installation, and environment setup in one guided flow.

```bash
curl -sL https://clawapis.com/api/skill/install.sh | bash
```

The script will:
1. **Register** — collect your email (required) and optional profile info (name, phone, Telegram, Signal, Twitter, GitHub, Discord, website, creator/company details, agent name, use case)
2. **Install dependencies** — `x402-fetch` and `viem` npm packages
3. **Set up environment** — create/update `.env` with wallet key and API URL

For non-interactive installs, prefill with `REGISTER_*` env vars:

```bash
REGISTER_EMAIL="you@example.com" REGISTER_NAME="Jane Doe" curl -sL https://clawapis.com/api/skill/install.sh | bash
```

### Manual Installation (after registering)

If you've already registered at [https://clawapis.com/#register](https://clawapis.com/#register), you can install manually:

```bash
npm install x402-fetch viem
```

Then set the required environment variables (see Configuration below).

## Trust Metadata

- Skill manifest: `https://clawapis.com/api/skill/SKILL.md`
- Install script: `https://clawapis.com/api/skill/install.sh`
- Trust artifact: `https://clawapis.com/api/trust`
- Well-known trust: `https://clawapis.com/.well-known/trust.json`

## Configuration

| Variable | Required | Default | Description |
|---|---|---|---|
| `WALLET_PRIVATE_KEY` | **Yes** | — | Your EVM wallet private key (for Base or Ethereum). The wallet must hold USDC on the selected chain to pay for requests. |
| `SOLANA_PRIVATE_KEY` | No | — | Your Solana wallet private key (base58-encoded). Required only if paying on Solana instead of Base/Ethereum. The wallet must hold USDC on Solana. |
| `X402_X_API_URL` | No | `https://clawapis.com` | The ClawAPIs proxy server URL. Override only if you are running a custom instance. |

## Authentication

ClawAPIs supports three authentication modes. Choose based on your needs:

### Public Data (No Auth Required)

Reading public tweets, users, and spaces works with the default app-level token. No extra headers needed:

```typescript
// Just use x402-fetch — no auth headers
const res = await x402Fetch("https://clawapis.com/x/2/tweets/123456789");
```

### Mode A: Bring Your Own Token (Stateless)

If you already have an X OAuth2 access token, pass it directly:

```typescript
const res = await x402Fetch("https://clawapis.com/x/2/tweets", {
  method: "POST",
  headers: {
    "X-User-Token": "YOUR_OAUTH2_ACCESS_TOKEN",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ text: "Hello from my agent!" }),
});
```

You handle token refresh. We just proxy with your token.

### Mode B: Managed OAuth2 (Recommended)

Let ClawAPIs handle the full OAuth2 PKCE flow:

**Step 1:** Get an authorization URL:
```typescript
const auth = await fetch("https://clawapis.com/api/oauth/authorize?" +
  "redirect_uri=https://myagent.com/callback" +
  "&scopes=tweet.read,tweet.write,users.read,dm.read,dm.write,offline.access"
).then(r => r.json());
// { authorizationUrl: "https://x.com/i/oauth2/authorize?...", sessionId: "abc..." }
```

**Step 2:** Redirect the user to `authorizationUrl`. After they approve, your callback receives `?session_id=abc...`

**Step 3:** Use the session ID for all requests:
```typescript
const res = await x402Fetch("https://clawapis.com/x/2/tweets", {
  method: "POST",
  headers: {
    "X-Session-Id": auth.sessionId,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ text: "Hello from my agent!" }),
});
```

Tokens auto-refresh. Sessions last up to 6 months.

**Built-in success page:** If the `redirect_uri` is on the ClawAPIs domain (or omitted), the user is redirected to `https://clawapis.com/oauth/success?session_id=SESSION_ID` — a branded confirmation page showing the session ID (copyable), granted scopes, and a ready-to-use code example. Agents can also provide their own `redirect_uri` to receive the `session_id` at their own callback URL.

### When Do You Need OAuth2?

| Action | Auth Required? |
|---|---|
| Read public tweets, users, spaces | No — app token works |
| Post tweets, send DMs | Yes — OAuth2 required |
| Follow, like, retweet, block, mute | Yes — OAuth2 required |
| Read DMs, bookmarks, private data | Yes — OAuth2 required |
| Upload media | Yes — OAuth2 required |

### Available Scopes

tweet.read, tweet.write, users.read, follows.read, follows.write, like.read, like.write, dm.read, dm.write, list.read, list.write, block.read, block.write, mute.read, mute.write, bookmark.read, bookmark.write, space.read, media.write, offline.access

Include `offline.access` to enable automatic token refresh (recommended).

### Helius & SolScan Endpoints

Helius and SolScan endpoints do not require OAuth2. All requests use the proxy's server-side API keys. You only need x402 payment.

## Pricing

For current pricing across all APIs (X, Helius, SolScan), visit [`https://clawapis.com/api/skill/PRICING.md`](https://clawapis.com/api/skill/PRICING.md) or call `GET https://clawapis.com/api/pricing`. Pricing is subject to change.

| API | Tier | Price per Request |
|---|---|---|
| **X API** | Read (tweets, search, timelines, lists, spaces, streams, bookmarks, media upload) | $0.05 |
| **X API** | Read users, DM events, followers, trends, create tweet/list, delete interactions, compliance | $0.10 |
| **X API** | Send DMs, follow, like, retweet, mute, manage list members | $0.15 |
| **Helius** | Standard RPC (getBalance, etc.) | $0.001 |
| **Helius** | DAS (getAssetsByOwner, searchAssets) | $0.005 |
| **Helius** | Enhanced / Heavy (parsed transactions) | $0.05 |
| **SolScan Pro** | All endpoints | $0.01 |

## Code Examples

All examples use `x402-fetch` to automatically handle the HTTP 402 payment flow. The wallet must hold USDC on Base.

### Setup (shared by all examples)

```typescript
import { wrapFetch } from "x402-fetch";
import { createWalletClient, http } from "viem";
import { privateKeyToAccount } from "viem/accounts";
import { base } from "viem/chains";

const account = privateKeyToAccount(process.env.WALLET_PRIVATE_KEY as `0x${string}`);
const wallet = createWalletClient({ account, chain: base, transport: http() });
const x402Fetch = wrapFetch(wallet);

const BASE_URL = process.env.X402_X_API_URL || "https://clawapis.com";
```

### Example 1: Fetch a Tweet

```typescript
import { wrapFetch } from "x402-fetch";
import { createWalletClient, http } from "viem";
import { privateKeyToAccount } from "viem/accounts";
import { base } from "viem/chains";

const account = privateKeyToAccount(process.env.WALLET_PRIVATE_KEY as `0x${string}`);
const wallet = createWalletClient({ account, chain: base, transport: http() });
const x402Fetch = wrapFetch(wallet);

const response = await x402Fetch("https://clawapis.com/x/2/tweets/123456789");
const data = await response.json();
console.log(data);
// { data: { id: "123456789", text: "...", ... } }
```

### Example 2: Search Recent Tweets

```typescript
import { wrapFetch } from "x402-fetch";
import { createWalletClient, http } from "viem";
import { privateKeyToAccount } from "viem/accounts";
import { base } from "viem/chains";

const account = privateKeyToAccount(process.env.WALLET_PRIVATE_KEY as `0x${string}`);
const wallet = createWalletClient({ account, chain: base, transport: http() });
const x402Fetch = wrapFetch(wallet);

const query = encodeURIComponent("bitcoin lang:en");
const response = await x402Fetch(
  `https://clawapis.com/x/2/tweets/search/recent?query=${query}&max_results=10`
);
const data = await response.json();
console.log(data.data); // Array of matching tweets
```

### Example 3: Get User Info

```typescript
import { wrapFetch } from "x402-fetch";
import { createWalletClient, http } from "viem";
import { privateKeyToAccount } from "viem/accounts";
import { base } from "viem/chains";

const account = privateKeyToAccount(process.env.WALLET_PRIVATE_KEY as `0x${string}`);
const wallet = createWalletClient({ account, chain: base, transport: http() });
const x402Fetch = wrapFetch(wallet);

const response = await x402Fetch(
  "https://clawapis.com/x/2/users/by/username/elonmusk?user.fields=description,public_metrics"
);
const data = await response.json();
console.log(data.data);
// { id: "...", name: "Elon Musk", username: "elonmusk", description: "...", public_metrics: { ... } }
```

### Example 4: Post a Tweet

```typescript
import { wrapFetch } from "x402-fetch";
import { createWalletClient, http } from "viem";
import { privateKeyToAccount } from "viem/accounts";
import { base } from "viem/chains";

const account = privateKeyToAccount(process.env.WALLET_PRIVATE_KEY as `0x${string}`);
const wallet = createWalletClient({ account, chain: base, transport: http() });
const x402Fetch = wrapFetch(wallet);

// OAuth2 required — use X-Session-Id from managed auth or X-User-Token
const response = await x402Fetch("https://clawapis.com/x/2/tweets", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "X-Session-Id": "YOUR_SESSION_ID",
  },
  body: JSON.stringify({ text: "Hello from ClawAPIs.com! Powered by x402." }),
});
const data = await response.json();
console.log(data.data);
// { id: "1234567890", text: "Hello from ClawAPIs.com! Powered by x402." }
```

### Example 5: Send a Direct Message

```typescript
import { wrapFetch } from "x402-fetch";
import { createWalletClient, http } from "viem";
import { privateKeyToAccount } from "viem/accounts";
import { base } from "viem/chains";

const account = privateKeyToAccount(process.env.WALLET_PRIVATE_KEY as `0x${string}`);
const wallet = createWalletClient({ account, chain: base, transport: http() });
const x402Fetch = wrapFetch(wallet);

// OAuth2 required — use X-Session-Id from managed auth or X-User-Token
const participantId = "987654321";
const response = await x402Fetch(
  `https://clawapis.com/x/2/dm_conversations/with/${participantId}/messages`,
  {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      "X-Session-Id": "YOUR_SESSION_ID",
    },
    body: JSON.stringify({ text: "Hey! Sent via ClawAPIs x402 proxy." }),
  }
);
const data = await response.json();
console.log(data);
```

### Example 6: Follow a User

```typescript
import { wrapFetch } from "x402-fetch";
import { createWalletClient, http } from "viem";
import { privateKeyToAccount } from "viem/accounts";
import { base } from "viem/chains";

const account = privateKeyToAccount(process.env.WALLET_PRIVATE_KEY as `0x${string}`);
const wallet = createWalletClient({ account, chain: base, transport: http() });
const x402Fetch = wrapFetch(wallet);

// OAuth2 required — use X-Session-Id from managed auth or X-User-Token
const myUserId = "111111111";
const response = await x402Fetch(
  `https://clawapis.com/x/2/users/${myUserId}/following`,
  {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      "X-Session-Id": "YOUR_SESSION_ID",
    },
    body: JSON.stringify({ target_user_id: "222222222" }),
  }
);
const data = await response.json();
console.log(data.data);
// { following: true, pending_follow: false }
```

### Example 7: Query Solana Balance (Helius)

```typescript
// Standard Solana RPC via Helius — $0.001
const res = await x402Fetch("https://clawapis.com/helius/", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    jsonrpc: "2.0",
    id: 1,
    method: "getBalance",
    params: ["YOUR_SOLANA_ADDRESS"]
  })
});
const data = await res.json();
console.log(data.result); // { context: {...}, value: 1000000000 }
```

### Example 8: Search Digital Assets (Helius DAS)

```typescript
// DAS API — Search NFTs and compressed assets — $0.005
const res = await x402Fetch("https://clawapis.com/helius/", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    jsonrpc: "2.0",
    id: 1,
    method: "searchAssets",
    params: {
      ownerAddress: "YOUR_SOLANA_ADDRESS",
      compressed: true
    }
  })
});
const data = await res.json();
```

### Example 9: Get Token Holders (SolScan Pro)

```typescript
// SolScan Pro — Get USDC token holders — $0.01
const res = await x402Fetch(
  "https://clawapis.com/solscan/token/holders?token=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v&page_size=10"
);
const data = await res.json();
console.log(data); // { success: true, data: [...] }
```

### Example 10: Get Account Portfolio (SolScan Pro)

```typescript
// SolScan Pro — Get account portfolio — $0.01
const res = await x402Fetch(
  "https://clawapis.com/solscan/account/portfolio?address=YOUR_SOLANA_ADDRESS"
);
const data = await res.json();
```

## How x402 Works

The [x402 protocol](https://www.x402.org/) enables machine-to-machine payments over HTTP using the standard `402 Payment Required` status code. Here is how it works with ClawAPIs.com:

1. **Request:** Your application sends a request to a ClawAPIs proxy endpoint (e.g., `GET https://clawapis.com/x/2/tweets/123`). The proxy returns HTTP `402 Payment Required` with a response body containing payment requirements — the price in USDC, the recipient wallet address(es), and supported chain details for Base, Ethereum, and Solana. The `accepts` array lists all enabled chains so your client library can pick the one matching your wallet.

2. **Sign:** Your x402 client library (`x402-fetch` for Base/Ethereum, `x402-solana` for Solana) reads the 402 response, selects the matching chain from the `accepts` array, and uses your wallet to sign a USDC transfer authorization. No tokens leave your wallet at this step — it is only a cryptographic signature.

3. **Retry:** The library automatically retries the original request, this time including the payment signature in the request headers. The proxy forwards the signature to the Coinbase CDP x402 facilitator for verification.

4. **Settle:** The facilitator verifies the signature, settles the USDC payment on-chain (on Base, Ethereum, or Solana depending on the chain selected), and signals the proxy to proceed. The proxy forwards your request to the X API and returns the response to you. The entire flow happens in a single round-trip from your application's perspective.

**Networks:** Base Mainnet (eip155:8453), Ethereum Mainnet (eip155:1), Solana Mainnet (solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp), Lightning (L402), Monero (XMR402)
**Currency:** USDC — Base: `0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913`, Ethereum: `0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48`, Solana: `EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v` | BTC (Lightning) | XMR (Monero)
**Facilitator:** Coinbase CDP (`https://api.cdp.coinbase.com/platform/v2/x402`)

### 402 Response Format

When you make a request without payment, the server returns HTTP 402 with this JSON body:

```json
{
  "x402Version": 2,
  "accepts": [
    {
      "scheme": "exact",
      "network": "eip155:8453",
      "amount": "50000",
      "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
      "payTo": "0xYOUR_WALLET_ADDRESS",
      "maxTimeoutSeconds": 120,
      "extra": { "assetTransferMethod": "eip3009", "name": "USD Coin", "version": "2" }
    },
    {
      "scheme": "exact",
      "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
      "amount": "50000",
      "asset": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
      "payTo": "SOLANA_WALLET_ADDRESS",
      "maxTimeoutSeconds": 120,
      "extra": { "name": "USDC", "feePayer": "<cdp-facilitator-solana-pubkey>" }
    }
  ],
  "l402": {
    "invoice": "lnbc...",
    "macaroon": "base64...",
    "amountSats": 76,
    "expiresAt": "2026-03-01T21:00:00.000Z"
  },
  "xmr402": {
    "address": "47Ust...",
    "amount": "138854176",
    "amountXmr": "0.000138854176",
    "message": "a0cf07ceb9b77d6a",
    "timestamp": "1772758947297"
  },
  "resource": {
    "url": "https://clawapis.com/x/2/tweets/123",
    "description": "Lookup tweet by ID",
    "mimeType": "application/json"
  },
  "headerContract": "PAYMENT-SIGNATURE"
}
```

**Key fields:**
- `accepts[].amount` — Price in USDC smallest units (6 decimals). `50000` = $0.05, `100000` = $0.10.
- `accepts[].network` — CAIP-2 chain identifier. Your client library matches this to your wallet's chain.
- `accepts[].extra.feePayer` — (Solana only) The CDP facilitator's Solana public key that pays transaction fees. Required by `x402-solana` / `@x402/svm`.
- `accepts[].extra.assetTransferMethod` — (EVM only) Always `"eip3009"` for gasless USDC transfers via `transferWithAuthorization`.
- `l402` — (Optional) Lightning Network payment option. Present only if L402 is enabled on the server.
- `xmr402` — (Optional) Monero payment option. `amount` is in piconero (1 XMR = 1e12 piconero). `message` is the nonce to include as the TX message. Present only if XMR402 is enabled.
- `headerContract` — The header name to use for payment. Use `PAYMENT-SIGNATURE` (v2) or `x-payment` (v1).

### Payment Headers

After signing, your client library sends one of these headers:

| Header | Protocol Version | Used By |
|---|---|---|
| `PAYMENT-SIGNATURE` | x402 v2 | `@x402/fetch`, `@x402/svm` |
| `x-payment` | x402 v1 | `x402-fetch`, `x402-solana` |
| `Authorization: L402 <macaroon>:<preimage>` | L402 | Any Lightning wallet |
| `Authorization: XMR402 txid="<txid>", proof="<proof>"` | XMR402 | Any Monero wallet |

ClawAPIs accepts both v1 and v2 payment headers, plus L402 and XMR402.

### Success Response Headers

After a successful paid request, the response includes:

| Header | Description |
|---|---|
| `X-Proxy-Price` | The price charged (e.g., `$0.05`) |
| `X-Payment-Tx` | On-chain transaction hash |
| `X-Payment-Network` | Chain used (e.g., `base`, `ethereum`, `solana`) |
| `X-Proxy-Service` | Always `clawapis-x402` |

## Troubleshooting

### 402 Payment Required (but payment fails)

- **Insufficient balance:** Ensure your wallet has enough USDC (Base/Solana), BTC (Lightning), or XMR (Monero) to cover the request price.
- **Wrong network:** Ensure your wallet and client library match the chain you intend to pay on. For Base/Ethereum, use `x402-fetch` with the correct `viem` chain. For Solana, use `x402-solana`. For Lightning, use any NWC-compatible wallet. For Monero, use any wallet that supports `get_tx_proof`.
- **Invalid private key:** Verify `WALLET_PRIVATE_KEY` is set correctly and starts with `0x`.

### 503 Service Unavailable

The proxy server's X API credentials are not configured or have expired. This is a server-side issue — contact ClawAPIs.com support.

If calling `/helius/*` or `/solscan/*` returns 503, the respective API key is not configured on the server.

### 502 Bad Gateway

The X API returned an error. Check the response body for details. Common causes:
- The tweet/user/resource does not exist (X returns 404, proxy forwards as 502)
- X API rate limits hit on the server side
- Invalid query parameters

### Connection Errors

- Verify `X402_X_API_URL` is set correctly (default: `https://clawapis.com`)
- Check your network connectivity
- Ensure you are not behind a firewall blocking HTTPS traffic

### Debugging Tips

- **Check pricing:** `GET https://clawapis.com/api/pricing` returns all available endpoints and their prices.
- **Check server info:** `GET https://clawapis.com/api/info` returns server configuration and status.
- **Inspect 402 response:** If you want to see the raw payment requirements, make a request without `x402-fetch` and inspect the 402 response body.
- **Wallet balance:** Use a Base block explorer (e.g., [BaseScan](https://basescan.org/)) to verify your USDC balance.

## Links

- **ClawAPIs.com:** [https://clawapis.com](https://clawapis.com)
- **Register:** [https://clawapis.com/#register](https://clawapis.com/#register)
- **x402 Protocol:** [https://www.x402.org/](https://www.x402.org/)
- **x402-fetch (npm):** [https://www.npmjs.com/package/x402-fetch](https://www.npmjs.com/package/x402-fetch)
- **Base Network:** [https://base.org/](https://base.org/)
- **USDC on Base:** [https://basescan.org/token/0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913](https://basescan.org/token/0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913)
- **XMR402 Protocol:** [https://xmr402.org/](https://xmr402.org/)
