Skip to main content

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

MethodEndpointCostDescription
GET/x402/search$0.01Search products with filters
POST/x402/shop$0.10AI-powered natural language search
POST/x402/buyProduct priceOne-command checkout

Vault (Digital Assets)

MethodEndpointCostDescription
GET/x402/vault/search$0.01Search skills, knowledge, personas
POST/x402/vault/buyItem pricePurchase a digital asset
GET/x402/vault/download/:id$0.01Download purchased file

How x402 Works

  1. Request — Send a request to any endpoint
  2. 402 Challenge — Receive a 402 Payment Required response with the price
  3. Sign & Pay — Your x402 client signs a USDC payment and retries
  4. 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