API Discovery
The SDK includes a client for the Dexter marketplace that lets agents and applications discover x402 paid APIs programmatically. Search by keyword, filter by price and network, sort by quality or volume, then call the discovered endpoints directly with the same SDK.
Best Fit
Use API Discovery when:
- an AI agent needs to find tools and data sources at runtime
- you want to compare pricing across providers
- you need to filter APIs by network, category, or quality score
- you're building an agent that discovers and pays for capabilities on its own
Minimal Example
What This Does
- Queries the Dexter marketplace at
x402.dexter.cash - Returns typed
DiscoveredAPI[]with pricing, quality scores, seller info, and verification status - Each result's
urlcan be passed directly towrapFetchorcreateX402Client.fetch
Search Options
Sort options: marketplace (default), relevance, quality_score, settlements, volume, recent
Network options: solana, base, polygon, arbitrum, optimism, avalanche
Response Shape
Each DiscoveredAPI includes:
Discover Then Pay
The discovery + payment flow in one script:
Combining with Budget Accounts
Let an agent discover and pay within a budget:
Custom Marketplace URL
By default, searchAPIs queries the Dexter marketplace. You can point to a different marketplace:
When To Use Something Else
- If you already know the URL, skip discovery and call it directly with wrapFetch
- For browser-based discovery UIs, use the marketplace at dexter.cash
- For MCP tool discovery, use @dexterai/opendexter which wraps the same search as an MCP tool