Skip to content
SpendTheBits

How to monetize an API with x402 without custody

By , Founder, SpendTheBits ·

In short

To monetize an API without managing accounts, you can use the open-source x402 protocol. This system communicates payment rules directly through standard HTTP responses. It allows human clients or automated agents to pay for access programmatically. Payments verify and settle directly to your own wallet, keeping the flow secure.

1.4 seconds
SettlementMeasured by SpendTheBits in production

Building web tools can bring a lot of extra work that coders do not want to do. In the past, if you wanted to monetize an API, you had to build a sign-up flow. You had to make database tables for user accounts and generate secret keys. You also had to draft invoices and connect heavy card processors [3]. This work is a huge wall for developers who just want to write code. It is even harder when your clients are automated software agents that need to make quick choices.

This lets you check payments for each request instead of forcing users to log in [1]. It is a great way to get paid by AI agents without complex software gates. Let us look at how this system operates and how the money flows from the buyer to your address.

Tiny gold tokens passing one by one through a turnstile, representing pay-per-request API access.

The Seller Side and Pricing Requirements

In this new setup, your server is the seller that guards the resource [1]. When someone calls your gated route without paying, your server returns an HTTP 402 code [1]. It also sends a JSON object with payment details in the body [1]. This response explains how much the call costs and where the funds must go.

These pricing rules are easy to change to fit your business goals. You can charge a flat rate for each call, use tiered plans, or try usage-based models [3][4]. The client reads the HTTP 402 response and builds a signed payload [1]. These messages go back and forth over basic HTTP headers [1]. The design is clean and works with any normal web server.

This tool can help you monetize an API on your own server. Your backend does not need to store client names or keep session state [1]. Each call is a single transaction with its own proof [1]. This keeps your database small and avoids the risk of data leaks. It is an ideal setup for microservices and cloud functions.

On the other side of the protocol, the resource provider must fulfill several key duties [1]. The server defines what the payment requirements are for any unauthenticated request [1]. It must also verify the incoming payloads and settle those transactions [1]. Once the check is complete and the transaction settles, the server delivers the resource to the buyer [1]. If you want to sell your own digital assets, you can use SpendTheBits to turn your handle into a live endpoint.

The Client Role and Programmatic Wallets

For this system to work, the client must read and act on the payment rules. The client is the technical component that starts the request [1]. This can be a web app run by a person or an automated agent [1]. Users do not need to create accounts or fill out forms [1].

When the client gets the HTTP 402 code, it makes a signed payload [1]. This signature acts as proof that the user owns the funds and wants to pay [2]. For developers, using a what is a non-custodial wallet is the best path. No third party gets access to your keys during the payment.

Clients can run this entire loop with no human help because the system is open [1][3]. An agent can request a resource and parse the response headers [1]. It then signs the payment payload and tries the call again in milliseconds [1]. This machine commerce is why builders use the protocol for small payments. It makes web payments as fast and simple as data transfers.

Clients have several clear duties when they interact with the server [1]. First, they send the initial request to access the resource [1]. After they receive the payment required response, they read the details and make a valid payload [1]. They then retry the request with a PAYMENT-SIGNATURE header that contains the signed payload encoded in Base64 [1]. This entire setup is stateless, so clients never need to manage accounts or session tokens beyond their own wallet [1]. With the SpendTheBits mobile application, you can initiate these payments by using the Send or Scan screen.

The Facilitator as a Verification Layer

This is why using a facilitator is a great choice to make things simple [2]. The facilitator is a helper service that checks if the payment matches your rules [2]. It takes the hard work away from your server.

When a request comes in, your server can send the payload to the facilitator to verify it [2]. Using this service means your backend does not need a direct node connection [2]. This helps developers add crypto payments to their web tools in less time [2]. It also keeps the payment checks consistent across different web apps.

The facilitator is not a custodian and never holds your funds [2]. It only checks the signature and tells your server if the payment is valid [2]. Then your server decides if it should return the requested resource [2]. This keeps the system safe and non-custodial while offloading the heavy math to a hosted tool.

To check a payment, your server makes a simple POST request to the verify endpoint of the facilitator with the payload details [2]. The facilitator performs the validation based on the specific network and payment scheme [2]. If the response is valid, your server performs the work to fulfill the request [2]. If the check fails, the server returns the HTTP 402 code to ask for a valid payment payload [1][2]. This automated check keeps your backend safe from invalid signatures.

Supported Networks and Coinbase CDP Facilitator

The protocol works on several networks to give buyers more choices. Coinbase hosts a live facilitator on Base mainnet that offers fee-free settlement [2][4]. It supports standard tokens like USDC on Base and Solana [2][4].

There are other options if you want to explore different chains. PayAI hosts a facilitator on Solana, Base, Polygon, and other networks [2]. You are not locked into one service provider for your web app. You can switch to the one that fits your users best.

Using a popular facilitator also helps other agents find your tool. For example, the Coinbase facilitator can index your endpoints on the Bazaar marketplace [3]. It opens up new customer bases for your tools with very little extra work.

The platform supports a wide variety of tokens to make payments convenient for every client. You can accept standard ERC-20 tokens on EVM networks through EIP-3009 or Permit2, as well as SPL tokens on Solana [3]. To make the onboarding process smoother, the facilitator supports EIP-2612 gas sponsorship [3]. This option sponsors the initial token approval so buyers do not need native gas for the first transaction [3]. These advanced features remove the friction usually associated with decentralized payments.

Settlement Speed and Direct Self-Custody

When the payment is verified, it settles on the blockchain [2]. The server can submit the transaction itself or let the facilitator do it [2]. The facilitator puts the transaction on the chain and waits for confirmation [2]. Your server only delivers the API data when the payment is secure [1]. This protects your business from payment fraud.

This flow is fast and keeps the user experience smooth. In our production test on 2 September 2026, an agent paid for a resource on Base mainnet and the transaction settled in about 1.4 seconds. This speed makes it easy to monetize an API with fast payments. Your clients do not have to wait for slow settlement times.

Your funds go directly into a self-custody stablecoin wallet without a middleman. This setup gives you full control over your income. It is a powerful way for developers to build safe and independent businesses on the web.

This settlement method is built to scale for high-volume applications. The underlying infrastructure has processed more than 100 million transactions across supported networks [3]. It also features built-in compliance checks, such as screening to identify and decline payments involving sanctioned or high-risk addresses [3]. This adds a strong layer of security to your server without requiring extra code.

Direct Settlement via SpendTheBits

With SpendTheBits, any user @handle can instantly become a live seller endpoint at x402.spendthebits.com. This enables anyone to receive payments directly without relying on a centralized platform. These payments settle in USDC, on Base through Coinbase's CDP facilitator or on Arc through Circle's, and reach your own address, either directly or through an on-chain split contract that pays you out automatically. Because SpendTheBits is fully non-custodial, the platform never holds or touches your money.

When a payment routes through a split, SpendTheBits' share is small, under 1%, and it is fixed in an immutable contract. You keep nearly the entire price of your digital resource. You can check the details on other transaction mechanics in our guide on gasless USDC transfers. Because the wallet is self-custodial, your private keys and seed phrases are generated and stored only on your own physical device.

The backend prepares unsigned transaction contexts and relays device-signed transactions to the network. By combining self-custody wallets with open protocols, you can build a business and monetize an API.

If the network experiences temporary delays, the service may report the payment as still settling, which is treated as pending rather than failed. This expands your integration options beyond traditional payment processors, ensuring that your digital resource endpoints remain highly available and reliable.

In the app · 3 steps

Get paid per call through your handle

Your handle is the x402 endpoint an agent pays. Here is where to find it and where the money shows up.

  1. Claim a handle

    The handle is the address agents pay, so one name covers every resource you sell.

    The requests screen in SpendTheBits showing payment requests
  2. Watch payments arrive

    Each paid call lands in your activity as an incoming USDC payment.

    The activity list in SpendTheBits showing incoming payments
  3. Open one to see how it settled

    The detail view shows the amount, the chain and the transaction it settled in.

    A transaction detail screen in SpendTheBits

Hold your own keys, keep the yield, skip the middleman.

SpendTheBits is a fully non-custodial wallet for 13 chains, free on iOS and Android.

Frequently asked

No, clients do not need to manage accounts, credentials, or session tokens beyond their own crypto wallet [1].

No, the facilitator does not hold funds and acts solely as an execution and verification layer for onchain transactions [2].

Sources

  1. 1.Client / Server | x402 · x402 · accessed 2026-09-19
  2. 2.Facilitator | x402 · x402 · accessed 2026-09-19
  3. 3.CDP Facilitator - Coinbase Developer Documentation · Coinbase · accessed 2026-09-19
  4. 4.FAQ | x402 · x402 · accessed 2026-09-19

This article is educational and reflects observed data and public sources on the date shown. It is not financial, legal or tax advice. Digital assets can lose value; yields shown are observed, not promised.

STB Weekly, every tuesday

The short version of pieces like this one, plus what moved in AI in finance and agent payments. What you get

Product updates and release notes. No price calls, no spam, unsubscribe in one click. We email you once to confirm before anything else is sent.