Documentation
Everything you need to create, validate, and integrate with 402.md.
Quick Start
1. Create a file called 402.md in your project root.
2. Add YAML frontmatter with your pricing:
---
version: "1.0"
owner: "0xYourWalletAddress"
network: "base"
endpoints:
- path: "/api/data"
price: "$0.01"
description: "Your data endpoint"
---3. Deploy it so it's accessible at https://yourdomain.com/402.md
4. Submit your domain to the registry.
Using the Generator
Don't want to write YAML by hand? Use our interactive generator to build your 402.md step by step with a live preview.
Validating Your Manifest
Use our online validator to check your 402.md for errors before deploying.
Or validate programmatically with the npm package:
npm install @402md/validator
import { validate } from "@402md/validator";
import { readFileSync } from "fs";
const content = readFileSync("402.md", "utf-8");
const result = validate(content);
if (result.valid) {
console.log("Valid!", result.normalized);
} else {
console.log("Errors:", result.errors);
}API Reference
/api/validateValidate 402.md content without indexing.
/api/submitSubmit a domain for crawling and indexing.
/api/registrySearch and browse indexed sites.
/api/registry/[domain]Get full details for a specific site.
/api/statsRegistry-wide statistics.
/api/badge/[domain]Dynamic SVG badge for embedding.
Embedding a Badge
Add a verified badge to your README or documentation:
[](https://402md.org/registry/yourdomain.com)
x402 Integration
402.md defines what things cost. The x402 protocol handles how payments are made.
For sellers (API providers), add x402 middleware:
npm install x402-next
For buyers (AI agents), use x402-fetch:
npm install x402-fetch