How to sell your API to AI agents
To sell to AI agents, your product needs three things: a price a machine can read, a way to pay that doesn't need a signup form, and a place where agents go shopping. For an API, that means answering an unpaid request with HTTP 402 Payment Required and a Lightning invoice (the L402 protocol), getting paid per call, and listing the endpoint where agents search. Amazap (amazap.com), the storefront for economic agents, is one of those places: agents connect through one MCP server, search about 1,400 listings, and buy calls with a single Lightning balance.
APIs are the easiest place to start. They aren't the only thing agents buy. Anything an agent can request over HTTP, receive in the response, and pay for per request over L402 can be sold the same way: data, content, compute, files, tools, and other digital services.
This guide covers the whole path. The supporting articles go deeper on each step.
Agents are customers now
For most of the web's history, every paying customer was a person. Sign up, confirm an email, enter a card, copy an API key. An AI agent working on a task can't do most of that alone, so even when your API is exactly what it needs, it usually can't buy.
Payment protocols built on HTTP 402 remove that wall. With L402, Lightning Labs' protocol for paid APIs, "credentials are purchased, not provisioned": any client that can pay a Lightning invoice can use any L402 server right away, with no account and no key management (Lightning Labs, lightning-agent-tools).
That opens up the machine economy for sellers. Your customers can now include:
- Agents you will never meet. An agent that needs one geocode, one transcript, or one PDF converted can find you, pay for one call, and move on.
- Short, spiky usage. No minimum plan. You get paid for each request, when it happens.
- Customers in places your billing never reached. A Lightning invoice is the same everywhere.
The human behind the agent still sets the limits. On Amazap, every purchase starts with a quote and is capped by the agent's budget, so the agent pays only what it was told to expect. More on the buyer side in Agentic payments explained.
What you can sell to AI agents
If it can be returned as the response to one HTTP request, and priced per request, it can be sold to agents over L402. APIs lead, but the pattern is wider.
| What you sell | Examples | What the agent gets back |
|---|---|---|
| Data APIs | Lookups, prices, weather, geocoding, company or domain data | JSON for one query |
| Content | An article as Markdown, a report, a transcript, a feed | Text or Markdown |
| Compute | Model inference (including your self-hosted model), image or video generation, OCR, file conversion | The result of one job |
| Files | A PDF, a dataset extract, a generated image, a QR code | The file in the response body |
| Tools | Validation, parsing, search, page-to-text, screenshots | The tool's output |
| Digital services | A one-off check, a render, a format conversion | Whatever the service produces |
Real examples from the Amazap catalog today: Amazap's own Amazap Basics turn a web page or PDF into Markdown and make QR codes for a cent or two each, and the catalog includes L402 image and video models from PayPerQ.
What doesn't fit (yet): anything that needs a human session, a long-running subscription, or delivery outside the HTTP response. This guide is about digital goods an agent receives in the response it paid for.
Got a GPU? Sell your self-hosted AI model
One of the most direct ways into agent commerce: if you run a model at home or on your own server with Ollama, llama.cpp, or vLLM, you can put it behind L402 and let anyone's agent pay per query. All three can serve an OpenAI-compatible chat endpoint, so the agent sends a familiar request, pays a Lightning invoice, and gets the completion back. Your model server stays private on localhost; only the L402 gate faces the internet.
Full walkthrough, including Lightning Labs' Aperture proxy and how to price per query: Sell your self-hosted AI model to agents.
How selling on Amazap works: three steps
The Sell to agents flow has three steps.
1. Set up Amboss Payments
Your endpoint needs a way to create Lightning invoices and know when they're paid. Amazap runs its own payments on the Amboss API and recommends it to sellers. Amboss Payments is the recommended path, not a requirement. The probe accepts any valid L402 or LSAT challenge with a priced Lightning invoice, from any Lightning node or wallet. Amboss Payments is a GraphQL API for sending and receiving payments over Lightning, with a free sandbox that needs no card (Amboss docs). Funds go to your own wallet: Amboss says it "never holds, receives, or proxies your funds" (amboss.tech).
Disclosure: Amazap is an Amboss referral partner. Amazap earns a referral credit if you sign up through this link.
Step-by-step: Set up Amboss Payments for an L402 API.
2. Put your endpoint behind L402
L402 is a small handshake. An unpaid request gets 402 Payment Required with a WWW-Authenticate: L402 macaroon="...", invoice="..." header. The client pays the invoice, gets the preimage, and retries with Authorization: L402 <macaroon>:<preimage>. Your server checks that sha256(preimage) matches the payment hash in the macaroon, with no database lookup (L402 spec).
You don't have to write that from scratch. The Amazap seller starter kit has working L402 seller code in Node and Python. Lightning Labs also publishes Aperture, an L402 reverse proxy (Lightning Labs).
Explainer: Monetize an API with Lightning: L402 for API owners.
3. Paste your endpoint URL
On /sell, paste your endpoint URL and the HTTP method. Amazap calls it once, unpaid, with no request body. A POST listing is an empty POST. The probe does not use HEAD, and it waits up to 8 seconds. It expects an L402 or LSAT challenge with a priced Lightning invoice from any wallet. The price agents see is the satoshi amount on that invoice at listing time. Amazap prefills the title, description, category, and example parameters from openapi.json or llms.txt when those files are on the same host. You review it and list it in one click. A contact email is still required.
Walkthrough: List your L402 endpoint on Amazap.
How you get paid
Amazap is the merchant of record. When an agent buys your listing, Amazap pays your invoice over L402 from its own funds, calls your endpoint, and hands your response to the agent. The sats land in the wallet that issued the invoice. Amazap does not hold seller funds.
You receive your listed price, the satoshi amount on your invoice, for each paid call. Amazap sets the shopper's all-in price. The price agents see is stored when you list. It does not refresh on its own. On each buy, Amazap pays the live invoice only when it fits that stored price. A higher invoice is refused. To change the price agents see, list the endpoint again.
Make agents pick your listing
Being listed is the start. Agents choose between similar listings, and they favor the ones that work on the first try.
- Answer unpaid probes with the 402 first. If your server rejects a request with no inputs (
400) before it issues the challenge, directory probes can't read your price. Issue the challenge, then validate inputs on the paid request. - Say exactly what comes back. "Returns current temperature, wind, and conditions for a lat/lon as JSON" beats "Best weather API."
- Give example parameters. Agents copy them. Amazap shows them on the listing.
- Keep one stable price per endpoint. Split cheap and expensive operations into separate endpoints rather than surprising the buyer.
- Be fast and reliable. On Amazap, a listing that fails after payment, or gets reported, can be paused and hidden from search. Buyers get failed calls back as credit, so failures cost you the sale and your ranking.
- Return structured output. JSON with stable field names is what agents can use in a loop without a human checking each result.
Pricing gets its own article: How to price an API for AI agents.
Which protocol: L402, x402, or API keys?
You can offer more than one. API keys still suit known customers on contracts. x402 is an open HTTP 402 standard, now run by the x402 Foundation at the Linux Foundation, mostly used with dollar stablecoins. L402 settles in sats over Lightning with a stateless credential. Amazap buys over L402 (plus Lightning-payable x402), which is why the /sell flow is built around it. Fair comparison: L402 vs x402 vs API keys.
The buyer side
Want to see what your customers see? Agents install the Amazap MCP server at amazap.com/mcp, top up one Lightning balance, and use search_catalog, quote, and buy. The full buyer story is in Agentic payments explained.
The Sell to agents guide
- Monetize an API with Lightning: L402 explained for API owners
- Set up Amboss Payments for an L402 API
- How to price an API for AI agents
- List your L402 endpoint on Amazap
- L402 vs x402 vs API keys for agent payments
- Sell your self-hosted AI model to agents (Ollama, llama.cpp, vLLM)
Start selling to agents
Three steps: payments, L402, listing. Most of the work is step 2, and the starter kit covers it.
Step 1: Set up Amboss Payments
Disclosure: Amazap is an Amboss referral partner. Amazap earns a referral credit if you sign up through this link.
Then get the starter kit and list your endpoint.
FAQ
Can AI agents actually pay for my API?
Yes. With L402, an agent calls your endpoint, gets a 402 Payment Required response with a Lightning invoice, pays it, and retries with proof of payment. No account or API key is needed. On Amazap, agents pay from one prepaid Lightning balance and Amazap pays your invoice for each call.
What can I sell to AI agents besides APIs?
Anything an agent can request over HTTP, receive in the response, and pay for per request over L402: data, content such as articles or transcripts, compute such as inference or image generation, files such as PDFs or datasets, tools, and other digital services. Amazap lists endpoints that return an L402 challenge.
What is agent commerce?
Agent commerce is buying and selling where the buyer is software: an AI agent finds a service, reads its price, pays within limits a human set, and uses the result. Protocols built on HTTP 402, such as L402 and x402, let it pay in the same request loop.
Do I need my own Lightning node?
Amboss's docs say a sandbox environment needs no Lightning node. A live environment has a Lightning node attached, and new live wallets take about 30 minutes to be provisioned with liquidity. Check the Amboss environment docs for what that means for your setup.
Does Amazap hold my money?
No. Amazap pays your Lightning invoice for each call it buys, so the sats go to your wallet. Amboss says it does not hold, receive, or proxy your funds either.
What does it cost to list on Amazap?
You receive your listed price, the satoshi amount on your invoice, for each paid call. Amazap sets the shopper's all-in price. The displayed price does not refresh on its own.
Can I sell access to a model running on my own GPU?
Yes. Run the model with a server such as Ollama, llama.cpp, or vLLM, keep it on localhost, and put an L402 gate in front of it, such as Lightning Labs' Aperture proxy or the Amazap starter kit. Then list the gated endpoint on Amazap. See Sell your self-hosted AI model to agents.
How long does listing take?
Once your endpoint answers an unpaid request with a valid L402 challenge, listing is a paste-and-review step: Amazap probes the URL, prefills the listing, and you list it in one click.
What does the probe send?
Amazap calls the method you choose and sends no request body. A POST listing is an empty POST. The probe does not use HEAD. It waits up to 8 seconds. It accepts any valid L402 or LSAT challenge with a priced Lightning invoice, from any Lightning node or wallet.
Does Amazap relay streaming responses?
No. Amazap buffers the seller response, up to 256 KB, and stops at 20 seconds (90 seconds for document calls). It does not pass Server-Sent Events through. Return one complete body.