Quick Start

Quick Start

Get started with get402 in under 5 minutes. You'll need Node.js 18+ and a USDC wallet on Base.

1. Install the SDK

npm install @xpay/sdk

2. Get Your API Key

Sign up at get402.net and create an API key in the dashboard.

3. Protect Your First Endpoint

import { xpay } from '@get402/sdk';

// Express.js
app.get('/api/data', 
  xpay.protect('0.01'), 
  (req, res) => {
    res.json({ data: 'premium' });
  }
);

4. Test It

curl https://api.yoursite.com/api/data
# → 402 Payment Required

curl -H "Authorization: Bearer YOUR_KEY" \
  https://api.yoursite.com/api/data
# → 200 { "data": "premium" }
🎉 Done! You just monetized your API with HTTP 402. Every request earns you USDC.