Free course

Get Paid Per API Call with x402

x402 lets an API charge per call. An unpaid request gets HTTP 402 with machine-readable payment terms, an agent pays in USDC and retries. No signups, no API keys.

Get Paid Per API Call with x402 course cover

Get new crypto-payable AI tools weekly

One short email a week with the x402 and pay-per-call tools we added and re-verified. No spam, unsubscribe any time.

At a glance

Price
Free, inside the YourAITools Community (free account).
Format
7 lessons; each ends with something live you can test.
Paid courses
x402 Pro, MCP Server Pro, Agent Skills and n8n for AI Agents: join free, then unlock a course from a locked lesson.

What the course covers

You return a valid 402, set a per-call price, take payments into a wallet you control, list your API in x402 directories, and expose it to agents over MCP. Each lesson ends with something live you can test. It is for developers and indie API builders who already run an HTTP API. You need an API you can deploy, basic JSON and HTTP, and a self-custody wallet address on Base; you can finish it with free testnet USDC.

Lessons

  1. What a 402 response is and why agents need itReturn your first valid x402 v2 payment request.
  2. Pricing per callChoose prices, convert them to USDC units, and add tiers and a free route.
  3. Wallets, payTo and settling only on successGet paid on testnet, and never charge for a failed call.
  4. Make your API readable by agentsopenapi.json with x-payment-info, /.well-known/x402, llms.txt and /health.
  5. Listing in x402 directoriesPre-flight checks and registration on x402scan.
  6. Exposing your API over MCPWrap your paid route as an MCP tool that agents can call.
  7. Keep it healthy: monitoring and gradesA daily unpaid self-check with a free grade.
Build Your First MCP Server course cover
FreeNew course

Build Your First MCP Server

Six hands-on lessons for builders who want their own code to show up as tools inside AI apps and agents. Turn a script or an API into tools any MCP client can discover and call, over stdio and Streamable HTTP. Tested with the official TypeScript SDK.

  1. What MCP Is (Tools, Schemas, Transports)Send JSON-RPC by hand and ship a one-tool hello server on stdio.
  2. A stdio Server in TypeScriptFive tools, zod schemas, safe errors, createServer() + StdioServerTransport.
  3. Streamable HTTP, on Node and in a WorkerSame server over /mcp on Node and as an edge Worker.
  4. Tool Copy That Gets ChosenNames, titles, descriptions and annotations models actually pick.
  5. Testing with the SDK ClientA 19-check suite across in-memory, stdio, Node HTTP and Worker.
  6. Connecting to Desktop Clients (and the Inspector)Inspector CLI checks plus an mcpServers config for desktop clients.
Take Build Your First MCP Server free in the community
x402 Buyer Basics course cover
FreeNew course

Paying for APIs as an Agent: x402 Buyer Basics

The other side of x402: six hands-on lessons for builders whose agents pay for APIs. Teach your agent to read a price tag, check it, cap it, and pay once. On testnet, with code you can run today.

  1. Read a 402 by handDecode a live x402 price tag in plain words, without paying.
  2. Check every field before you signA policy that refuses mainnet, unknown tokens, bad hosts and prices over your cap.
  3. Spending caps your agent can't talk its way pastPer-call, per-day and per-host caps with an append-only ledger.
  4. Sign a testnet paymentSign an EIP-3009 authorization and pay a local practice seller.
  5. Retries that never pay twiceReuse one signed payment on retries, and pass a 17-check test suite.
  6. Put it together, and use the official client safelyOne safe payAndFetch() tool, plus the official fetch client with spend controls.
Take Buyer Basics free in the community
x402 Pro course cover
Pro$29 one-time

x402 Pro: Launch a Production Paid API in a Weekend

The paid follow-up in the same community: 10 build-along lessons that take a pay-per-call API to production, with a tested starter Worker, a cost-per-call calculator and a directory submission kit. Lesson 1 is a free preview. Join the community free, then unlock the course from a locked lesson.

  1. The production blueprintOutcome: run the Starter Worker and pass all 7 checks.
  2. Inside the template: the money pathOutcome: add your own paid route.
  3. Pricing strategy and the cost-per-call calculatorOutcome: set prices you can defend.
  4. Discovery that never driftsOutcome: generated openapi.json, llms.txt and the /.well-known files.
  5. MCP inside your WorkerOutcome: a stateless MCP server tested with the official SDK.
  6. Publish to the official MCP Registry with DNS authOutcome: your server, under your domain.
  7. Deploy: testnet first, then mainnetOutcome: live, verified with a real testnet payment.
  8. The directory blitzOutcome: 13 free x402 and MCP directories in one sitting.
  9. Monitoring and grading in productionOutcome: a daily check, a free grade and a failure playbook.
  10. Launch weekOutcome: Product Hunt, dev.to, Hashnode and a $0 launch checklist.
Join free, then unlock the course

More community courses

Paid courses in the same community. Join free, then unlock a course from a locked lesson.