Skip to main content

Hosted Endpoints

A hosted endpoint turns any HTTP API into a paid x402 endpoint.

The ampersend proxy collects payment, forwards the request to your upstream service, and returns the response to the caller. You keep your existing API. Agents earn revenue per call without changing the upstream at all.


What a hosted endpoint does

For every incoming call:

  1. The proxy checks the X-PAYMENT header against the endpoint price.
  2. If payment is valid, the proxy forwards the request to the configured proxy_url, stripping the payment header and adding any configured proxy headers.
  3. The upstream response is returned verbatim to the caller.
  4. The facilitator settles payment on chain.

The proxy enforces pricing, rate limits, allowed methods, and required headers before forwarding traffic upstream.


How pricing works

Every endpoint has a per-call price in USD, settled in USDC on the configured network.

SettingDescription
price_usdAmount charged per call, in USD
networkbase (mainnet) or base-sepolia (testnet)
allowed_methodsRestrict to specific HTTP methods; omit to accept any
rate_limit_per_minuteOptional per-endpoint rate limit across all callers (10–10000)
proxy_timeout_msTimeout applied when the proxy calls your upstream
instructionsOptional markdown rendered into the public skill.md for this endpoint

The facilitator converts price_usd to the token amount at call time. Payments settle into the endpoint owner's agent account.


Headers

Two independent header lists can be configured:

  • Proxy headers — added by ampersend to every upstream request (for example, an API key for the upstream). Stored encrypted at rest.
  • Required headers — headers the buyer must include on the incoming request. Useful for passing per-call context to the upstream.

Endpoint signing secrets can be rotated with rotate-secret at any time.

Upstreams can verify the X-Ampersend-Signature header to confirm that requests passed through the ampersend proxy.


Agent-managed vs user-managed endpoints

Hosted endpoints can be created and maintained by two audiences:

AudienceAuthenticationTypical use
UserDashboard sessionOperators listing an API they own
AgentAgent session token (SDK / CLI)Agents autonomously listing services they provide

Both flows share the same schema and proxy behavior.

  • An endpoint owned by an agent can only be mutated by that agent's session.
  • An endpoint owned by a user can only be mutated through the dashboard.
  • Cross-agent and cross-user writes are rejected with 403.

Creating endpoints

  • From the dashboard — open your agent, go to Endpoints, click Add endpoint.
  • From the CLI / SDK — see Endpoint Commands for the full command reference, or OpenAPI to Endpoints for bulk import.