Earn 5.75% APY staking with Solana Compass + help grow Solana's ecosystem

Stake natively or with our LST compassSOL to earn a market leading APY

x402 on Solana: Your AI Agent Can Pay for Its Own Data

Solana 🧭 Compass By Solana 🧭 Compass Feb 28, 2026 11 min read

AI agents can now pay for premium APIs, web scraping, and market data per-request using USDC on Solana. No API keys, no subscriptions — just sol fetch and a wallet.

Why AI Agents Need x402 Instead of API Keys

Every premium API starts the same way: create an account, generate an API key, store it somewhere, rotate it periodically, manage billing separately. For humans, this is tedious. For autonomous AI agents, it's a fundamental design problem.

An agent running autonomously needs data — market prices, social sentiment, web content, news. Each data source requires its own API key, its own billing arrangement, its own credential management. Scale that to dozens of sources and you have a credential management nightmare that someone has to maintain manually. The agent can't sign up for services itself.

x402 replaces all of this with a single mechanism: per-request payment in USDC. Your agent makes an HTTP request to any x402-enabled endpoint. If the server requires payment, it responds with HTTP 402 and a price. The agent signs a USDC transfer, retries the request with the signed payment attached, and gets its data. No accounts, no keys, no subscriptions. The wallet is the credential.


How x402 Payments Work with sol fetch

sol fetch is curl for paid APIs. The syntax is identical to what you'd expect:

sol fetch https://api.example.com/data

If the server responds with 402 Payment Required, sol fetch automatically parses the payment requirements, builds a USDC transfer, signs it, and retries with the payment attached. If the server doesn't require payment, it works like a normal HTTP request.

Payment info goes to stderr, the response body goes to stdout — so you can pipe it directly to jq or into another command:

sol fetch https://pro-api.coingecko.com/api/v3/x402/simple/price?ids=solana\&vs_currencies=usd | jq '.solana.usd'

Check the cost before paying

sol fetch https://api.example.com/data --dry-run
Payment Required (x402)
  Amount:    $0.010000 USDC
  Recipient: GkX...abc
  Network:   solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp

Run without --dry-run to pay and fetch the resource.

Set a spending cap

sol fetch https://api.example.com/data --max 0.05

If the price exceeds $0.05, the request is rejected before any payment is signed.

Full options

Flag What it does
-X, --method <method> HTTP method — GET, POST, etc.
-d, --body <data> Request body (for POST endpoints)
-H, --header <header> Custom headers (repeatable)
--max <amount> Maximum USDC to spend per request
--dry-run Show cost without paying
--wallet <name> Which wallet to pay from
--json Structured JSON output

The JSON output follows the same CommandResult<T> envelope as every other Sol CLI command, with elapsed_ms in the metadata.


x402 Services Available on Solana Today

x402 is live on Solana with real services accepting USDC micropayments. Here's what's available right now, verified against live endpoints.

x402 market data: CoinGecko, Syraa, and more

The most immediately useful category for trading agents. Get token prices, trending pools, and DEX analytics — all without an API key.

CoinGecko — the same CoinGecko data you know, paid per-request instead of per-month:

# Get SOL price — $0.01
sol fetch "https://pro-api.coingecko.com/api/v3/x402/simple/price?ids=solana&vs_currencies=usd"

# Trending pools on Solana DEXes — $0.01
sol fetch "https://pro-api.coingecko.com/api/v3/x402/onchain/networks/solana/trending_pools"

# Search for specific pools — $0.01
sol fetch "https://pro-api.coingecko.com/api/v3/x402/onchain/search/pools?query=bonk"

x402engine — lightweight crypto price API:

# SOL price — $0.001
sol fetch "https://x402engine.app/api/crypto/price?symbol=SOL"

Syraa — DEX analytics and trending token detection across 20+ endpoints:

# DEX screener data — $0.10
sol fetch "https://api.syraa.fun/dexscreener"

# What's trending on Jupiter right now — $0.10
sol fetch "https://api.syraa.fun/trending-jupiter"

Social data APIs via x402

Agents that trade based on sentiment need social data. Portals Protocol offers 29 endpoints for scraping social platforms — Twitter, Instagram, and more.

# Get a Twitter user's profile and stats — $0.001
sol fetch "https://api.portalsprotocol.com/twitter/user" -X POST \
  -d '{"username": "solaboratory"}' -H "Content-Type: application/json"

# Search Twitter for mentions of a token — $0.01
sol fetch "https://api.portalsprotocol.com/twitter/search" -X POST \
  -d '{"query": "solana breakpoint"}' -H "Content-Type: application/json"

# Instagram profile data — $0.005
sol fetch "https://api.portalsprotocol.com/instagram/profile" -X POST \
  -d '{"username": "solana"}' -H "Content-Type: application/json"

Web scraping with x402

Turn any URL into structured content. Useful for agents that need to read documentation, articles, or product pages.

# Scrape any webpage — $0.005
sol fetch "https://x402engine.app/api/web/scrape?url=https://solana.com"

Crypto news and intelligence

Beyond raw price data — news, smart money tracking, and market sentiment:

# Breaking crypto news — $0.10
sol fetch "https://api.syraa.fun/news" -X POST \
  -d '{"query": "solana defi"}' -H "Content-Type: application/json"

Syraa offers around 20 endpoints covering news aggregation, smart money wallet tracking, sentiment analysis, and token screening. All follow the same pattern — POST with a JSON query body, $0.10 per request.

Premium content and AI services via x402

# Premium articles — $0.01
sol fetch "https://v402pay.onvoyage.ai/api/pay/article-slug"

# AI agent runtime access — $0.10
sol fetch "https://tropir.xyz/api/cortex/access"

The broader x402 ecosystem on Solana

These are the endpoints we've tested and verified. The full ecosystem is significantly larger. x402list.fun tracks 54 providers on Solana alone, offering 522+ endpoints across categories including web scraping, AI inference, social data, and developer tools.

Services like Browserbase (browser automation), Firecrawl (web crawling), Pinata (IPFS pinning), and Neynar (Farcaster data) are available on other chains and may add Solana support as the protocol matures. The ecosystem has processed over 120 million x402 transactions to date, with Solana handling roughly 77% of the volume.


x402 in Action: End-to-End AI Agent Workflows

The real power of sol fetch isn't any single endpoint — it's what happens when an agent chains paid data sources together with Sol CLI's trading and portfolio commands. Here are two complete workflows.

Research a token and decide whether to buy

An agent is tasked with finding promising tokens and making small trades. Here's the full command sequence:

# 1. Check what we're working with
sol portfolio --json

# 2. Find trending pools on Solana — $0.01
sol fetch "https://pro-api.coingecko.com/api/v3/x402/onchain/networks/solana/trending_pools" --json

# 3. A pool catches the agent's eye — check the token price — $0.01
sol fetch "https://pro-api.coingecko.com/api/v3/x402/simple/price?ids=bonk&vs_currencies=usd" --json

# 4. Check Twitter sentiment before committing — $0.01
sol fetch "https://api.portalsprotocol.com/twitter/search" -X POST \
  -d '{"query": "BONK solana"}' -H "Content-Type: application/json" --json

# 5. Sentiment is positive, volume is up — buy
sol token swap 20 usdc bonk --json

# 6. Record the portfolio state
sol portfolio snapshot --label "bonk-entry"

The agent gathered market data, cross-referenced with social sentiment, made a decision, executed a trade, and recorded its state. Total x402 cost: $0.03.

React to macro news and rebalance

An agent monitors news and rebalances a portfolio across asset classes — including tokenized equities and commodities available on Solana:

# 1. Check breaking news — $0.10
sol fetch "https://api.syraa.fun/news" -X POST \
  -d '{"query": "tariffs trade war"}' -H "Content-Type: application/json" --json

# 2. The agent reads the response: new tariffs announced, risk-off sentiment likely

# 3. Check current portfolio exposure
sol portfolio --json

# 4. Reduce equity exposure — sell tokenized Nasdaq ETF for USDC
sol token swap 100 qqqx usdc --json

# 5. Increase gold allocation — buy tokenized gold
sol token swap 150 usdc xaux --json

# 6. Snapshot the new state
sol portfolio snapshot --label "tariff-rebalance"

The agent read the news, reasoned about macro implications, and rebalanced across asset classes — from a tokenized Nasdaq ETF to tokenized gold — in under a minute. Total x402 cost: $0.10.


Instructing Your AI Agent to Use x402 APIs

If you're running an AI agent with shell access (Claude Code, OpenClaw, or similar), you can point it at x402 endpoints with natural language. Here are example prompts:

Research trending Solana pools on CoinGecko, find the highest-volume one, check the token's price, and buy $20 worth.

Check Twitter sentiment around BONK using Portals Protocol, get the current pool data from CoinGecko, and tell me if it looks like a good entry point.

Scrape the Raydium docs page using x402engine and summarise what yield strategies are available.

Monitor crypto news every 30 minutes. If anything mentions Solana regulatory action, immediately sell all non-stablecoin positions and snapshot the portfolio.

The agent uses sol fetch for the paid data and the rest of Sol CLI for trading, portfolio management, and record-keeping. All commands support --json for structured output the agent can parse.


Controlling x402 Spending: Caps, Permissions, and Wallets

Giving an agent access to a wallet that can pay for things requires guardrails.

Check before you pay. --dry-run shows exactly what a request will cost before any money moves:

sol fetch "https://pro-api.coingecko.com/api/v3/x402/onchain/networks/solana/trending_pools" --dry-run

Cap per-request spending. --max sets a hard limit. If the endpoint charges more than your cap, the request is rejected before any payment is signed:

sol fetch "https://api.syraa.fun/news" -X POST -d '{"query":"solana"}' --max 0.05

This would reject the request — Syraa charges $0.10, which exceeds the $0.05 cap.

Disable the command entirely. In Sol CLI's config, set canFetch = false to prevent the agent from making any x402 payments:

[permissions]
canFetch = false

When canFetch is disabled, the sol fetch command doesn't even register — it's not hidden behind a flag, it's absent from the CLI entirely.

Use a dedicated wallet. Fund a separate wallet with a limited USDC balance for agent operations. The agent can only spend what's in that wallet:

sol wallet create agent-wallet
sol token send 10 usdc agent-wallet
sol fetch "https://api.example.com/data" --wallet agent-wallet

Note on transaction flow: When you use sol fetch, your wallet signs the payment transaction but does not submit it to the network. The server (or its facilitator service) handles submission and confirmation. This is by design in the x402 protocol — the server needs to verify payment before releasing the data.


All Verified x402 Endpoints on Solana

Every endpoint below has been tested with sol fetch --dry-run and confirmed to return x402 payment requirements on Solana.

Market Data & Crypto Intelligence

Service Cost Endpoint
CoinGecko $0.01 GET https://pro-api.coingecko.com/api/v3/x402/simple/price?ids=solana&vs_currencies=usd
CoinGecko $0.01 GET https://pro-api.coingecko.com/api/v3/x402/onchain/networks/solana/trending_pools
CoinGecko $0.01 GET https://pro-api.coingecko.com/api/v3/x402/onchain/search/pools?query=bonk
x402engine $0.001 GET https://x402engine.app/api/crypto/price?symbol=SOL
Syraa $0.10 GET https://api.syraa.fun/dexscreener
Syraa $0.10 GET https://api.syraa.fun/trending-jupiter
Syraa $0.10 POST https://api.syraa.fun/news

Social Data

Service Cost Endpoint
Portals Protocol $0.001 POST https://api.portalsprotocol.com/twitter/user
Portals Protocol $0.01 POST https://api.portalsprotocol.com/twitter/search
Portals Protocol $0.005 POST https://api.portalsprotocol.com/instagram/profile

Web Scraping & Content

Service Cost Endpoint
x402engine $0.005 GET https://x402engine.app/api/web/scrape?url=https://example.com
OnVoyage $0.01 GET https://v402pay.onvoyage.ai/api/pay/<articleId>

AI & Infrastructure

Service Cost Endpoint
Tropir $0.10 GET https://tropir.xyz/api/cortex/access

Prices range from $0.001 to $0.10 per request. For most use cases, an agent can do meaningful research for well under a dollar.


Further Reading


x402 endpoints, pricing, and availability may change without notice. Always use --dry-run to verify current costs before authorising agent spending. The services listed here are third-party providers — Sol CLI facilitates the payment but does not control the data they return.


Comments

Please login to leave a comment.

Related Content

Why Your AI Agent Needs a Permissions System (Before It Gives Away $250,000)

An OpenClaw bot gave away $250K in tokens. Malicious ClawHub skills target crypto wallets. Here's why your Clawdbot, OpenClaw, or Claude Code agent needs code-level permissions, not prompt engineering.

How to Give Your AI Agent Access to Financial Markets on Solana

Your OpenClaw bot or Claude Code agent can buy tokenized stocks, gold, Bitcoin, Ethereum, and hundreds more — plus earn yield on stablecoins. Set up AI-powered investing on Solana.

Polymarket with an AI Agent: Trade Prediction Markets on Solana

Your OpenClaw bot or Claude Code agent can browse, research, and trade Polymarket and Kalshi prediction markets on Solana. Binary YES/NO contracts on crypto, politics, sports, and more — all settled in USDC.

Sol CLI Guide: Every Solana Command for AI Agents and Humans

The complete guide to Sol CLI — trade, stake, lend, and manage portfolios on Solana from OpenClaw, Claude Code, or any AI agent. No API keys, no code required.

Charge AI Agents for Your Laravel APIs and Content with x402

Add one line of Laravel middleware to charge AI agents and crawlers per-request in USDC on Solana. Keep content free for humans, monetize AI traffic. No API keys, no billing portal.

Sol CLI: A Solana Skill for AI Agents

A Solana skill for OpenClaw, Claude Code, and AI agents. Trade tokens, manage wallets, stake SOL, earn yield, and track portfolios — no API keys, no code.

The Best Wallets for Solana for Staking, NFTs, and Defi

To make the most of Solana you'll need a wallet that is secure and supports NFTs, Defi and tokens. Read on to find our favourites

Why is Solana's price and popularity going up? Should I invest?'

Since Solana can boldly compete with Ethereum, it’s worth considering as a solid investment in 2021.

Staking On Solana: How To Stake Your Sol + Earn APY Rewards

Learn how you can earn rewards on your crypto assets by staking them on the Solana network,

Token Swaps & Trading On Decentralized Exchanges (DEX)

Yield farming is a process that involves lending or staking crypto assets to generate rewards or high returns as passive incomes in the form of additional cryptocurrency

The Top Solana Projects: The Best Apps, Dapps, Defi, & NFTs

Want to learn what you can do with Solana Blockchain? The Solana Ecosystem is filled with a wide range of apps, Dapps, Defi projects, and NFTs. Below we’ve highlighted some of the most popular and best apps, Dapps, Defi, and NFT projects based on th

What makes Solana Unique? How Is it different to Ethereum?

One of the most exciting features of Solana is its speed and scalability. It is one of the few protocols that boast over 1000 TPS because of its genuine web-scale blockchain features.

Turbo Staking

Get Bonus APY on your SOL with Turbo Staking via Solana Compass and Marinade

Borrow / Lend

Borrowing and lending in DeFi is a process that allows users to earn interest on their crypto assets by lending them to others or borrowing assets from others

How to Instantly Unstake + Withdraw SOL from Solana Staking

Learn how to unstake SOL from Solana staking and withdraw your SOL from Solana staking.

Solana tokens

Solana Token Markets

Explore all tokens →