Core concepts
Service discovery
The catalogue#
GET /api/services returns the services this workspace can see: public listings plus the workspace's own. Each listing has a payable field, { now, reason }, that says whether this workspace can pay it right now and why not. Sandbox workspaces can pay sandbox services only: real x402 endpoints on this deployment that accept simulated payments.
import { CortexPay } from "@cortexpay/sdk";
const cortex = new CortexPay({ apiKey: process.env.CORTEXPAY_API_KEY!, baseUrl: "https://cortexpay.vercel.app" });
const page = await cortex.services.list({ category: ["data", "research"], maxPrice: "0.10", sort: "price_asc", limit: 10 });
console.log(page.total, page.data.map((s) => s.name));The response is { data, total, catalogueSize, facets, filters, nextCursor }. Latency and availability come from real (not seeded) requests over the last 30 days and are null until there is data.
Filters#
All filters are optional. List filters take comma-separated values.
| Parameter | Values |
|---|---|
q | Words matched against name, summary, slug, category and provider (up to 120 characters). |
category | inference, llm, image, data, finance, chain_analytics, research, storage, compute, devtools, agent |
minPrice, maxPrice | USD amounts, for example 0.05. |
network | sandbox, hyperevm, elysium |
asset | sUSDC, USDC |
maxLatencyMs | Ceiling on the median (p50) latency, in milliseconds. Services without data are excluded. |
providerVerification | unverified, domain_verified, reviewed |
pricingModel | fixed, usage, tiered, quote |
availability | pending, operational, degraded, offline, rejected |
source | all (default), agent, sandbox, own |
sort | featured (default), price_asc, price_desc, latency, name, newest |
limit, cursor | 1–100 (default 50); pass nextCursor back as cursor. |
One service#
GET /api/services/:id accepts an id or a slug and returns { service, endpoints, pricingHistory, paymentMethods, performance, yourUsage, … }: the listing, how each network is paid, and 30-day performance from real requests. service.id is what you pass as serviceId when you pay for a request.
import { CortexPay } from "@cortexpay/sdk";
const cortex = new CortexPay({ apiKey: process.env.CORTEXPAY_API_KEY!, baseUrl: "https://cortexpay.vercel.app" });
const detail = await cortex.services.get("SERVICE_ID_OR_SLUG");
console.log(detail.service.name, detail.service.payable, detail.paymentMethods);Listing your own service#
Any HTTPS endpoint that answers an unpaid request with a valid x402 402 can be listed with POST /api/services/register. CortexPay probes it before it is listed:
- The URL must be public HTTPS. Private, loopback and link-local addresses are refused before any request is made.
- Called without payment, the endpoint must answer
402with a valid x402 v2 challenge (exactscheme) on every declared network, in that network's verified stablecoin, paying the declared recipient the declared price, in a form CortexPay can sign. - A service that passes becomes operational with the
endpoint_validatedlevel. One that fails is saved as pending, private and unverified; fix it and callPOST /api/services/:id/validate. - Sandbox workspaces list privately. Public listing is for live workspaces.
Send "dryRun": true to run the probe without saving anything. Registration is limited to 5 attempts per 10 minutes per user and 20 per day per workspace.
Register and validate need a signed-in owner or admin, or an API key with the services:write scope (only owners and admins can create keys).
Provider statistics
GET /api/provider lists your services with revenue and request counts; GET /api/provider/requests lists the requests made to them. Both need analytics:read.
Endpoints#
- GET
/api/servicesMarketplace catalogue: q, category, price, network, asset, latency, verification, sort, cursor.
Key: services:read · 120/min
- GET
/api/services/:idOne service by id or slug: endpoints, pricing, payment methods, 30-day performance.
Key: services:read · 240/min
- POST
/api/services/registerList an x402 endpoint you operate (probed before it is listed).
Key: services:write · session owner/admin
- POST
/api/services/:id/validateRe-run the unpaid-request probe against the stored terms.
Key: services:write · session owner/admin
- GET
/api/providerYour own services with revenue and request statistics.
Key: analytics:read · 120/min
- GET
/api/provider/requestsRequests made to your services, with their payment.
Key: analytics:read · 120/min
- GET
/api/leaderboardPublic agent leaderboard (opt-in agents only).
Public