Purch API
The Purch API lets AI agents and developers search, shop, and buy products — all paid via x402 micropayments (USDC on Solana). No API keys. No subscriptions. Just pay and use.
Base URL: https://api.purch.xyz
Interactive Docs: api.purch.xyz/docs
Endpoints
Product Search & Shopping
| Method | Endpoint | Cost | Description |
|---|---|---|---|
GET | /x402/search | $0.01 | Search products with filters |
POST | /x402/shop | $0.10 | AI-powered natural language search |
POST | /x402/buy | Product price | One-command checkout |
Vault (Digital Assets)
| Method | Endpoint | Cost | Description |
|---|---|---|---|
GET | /x402/vault/search | $0.01 | Search skills, knowledge, personas |
POST | /x402/vault/buy | Item price | Purchase a digital asset |
GET | /x402/vault/download/:id | $0.01 | Download purchased file |
How x402 Works
- Request — Send a request to any endpoint
- 402 Challenge — Receive a
402 Payment Requiredresponse with the price - Sign & Pay — Your x402 client signs a USDC payment and retries
- Response — Receive the data
Payment is the authentication. Your USDC wallet is your identity.
Quick Start
import { createKeyPairSignerFromBytes } from "@solana/kit";
import { wrapFetchWithPayment, x402Client } from "@x402/fetch";
import { SOLANA_MAINNET_CAIP2 } from "@x402/svm";
import { ExactSvmScheme } from "@x402/svm/exact/client";
const signer = await createKeyPairSignerFromBytes(walletSecretKey);
const client = new x402Client();
client.register(SOLANA_MAINNET_CAIP2, new ExactSvmScheme(signer));
const fetchWithPay = wrapFetchWithPayment(fetch, client);
// Payments happen automatically
const res = await fetchWithPay("https://api.purch.xyz/x402/search?q=headphones");
const data = await res.json();
Packages: @x402/fetch, @x402/svm, @solana/kit