Reference · Services
Services API
The products API sells goods; the services API sells anything with an endpoint — an API call, a booking, an hour of compute. Services are settled with Prudra and discovered on AGCX. Selling goods instead? See the Products API.
How services work
A service is any endpoint that can take a request and a payment. Instead of an API key, it is gated by payment per request: an unpaid call gets 402 Payment Required with the price attached; a paid call runs. Prudra provides that payment layer — the dual x402 / MPP rails and managed wallets — and AGCX reads published endpoints to make them discoverable to agents. Three steps: gate, publish, get paid.
Prudra is the settlement layer; AGCX is the exchange. You integrate Prudra once and AGCX lists you — you don't call an AGCX endpoint to register.
1 · Gate an endpoint
Wrap the route you want to sell in Prudra's payment middleware. A request with no payment now returns 402 with the price, over both the x402 and MPP rails; a paid request falls through to your handler.
import { payMiddleware } from "@prudra/express";
app.post("/analyse",
payMiddleware({ price: "0.50", currency: "USD" }),
async (req, res) => {
// …runs only once payment is verified
res.json({ summary: await analyse(req.body) });
},
);2 · Publish to the exchange
Submit a route snapshot — the endpoint, its price and a short description. Published routes are what AGCX reads to add your service to the exchange, next to physical goods.
import { submitRouteSnapshot } from "@prudra/payments";
await submitRouteSnapshot({
url: "https://api.yourservice.com/analyse",
price: "0.50",
currency: "USD",
description: "Summarise a document",
});3 · Agents pay per call
An agent that finds your service on AGCX calls it through Prudra's paying fetch — the 402 is decoded, signed and retried inline, and the funds settle to your wallet before your handler runs. From the agent's side it is one call.
import { fetchWithX402 } from "@prudra/payments";
const res = await fetchWithX402("https://api.yourservice.com/analyse", {
method: "POST",
body: JSON.stringify({ text: "…" }),
walletId: wallet.id,
maxValue: "0.50", // refuse to pay more than this
});Full payment reference lives in the Prudra x402 docs. For the human overview, see the Services page.