SDK Mode
In SDK modeapi.yourcompany.com/v1/todos stays api.yourcompany.com/v1/todos.
The Apiosk middleware sits in front of handlers you already run. A request
carrying one of your existing customers’ API keys falls through untouched. A
request without one gets an x402 402 Payment Required, and
once the payment verifies, the same handler runs.
Where it sits among the three modes
Gateway mode is the fastest way to sell a route you do not want to operate a
paywall for. Federated mode indexes an API that already speaks x402 on its own.
SDK mode is the middle: you keep the traffic, Apiosk keeps discovery, pricing,
verification, analytics and payouts.
Because Apiosk stays in the verify path, SDK-mode revenue lands in the same
ledgers as gateway revenue: the same Analytics, the same Transactions, the same
payout flow. There is no separate reporting surface to learn.
What it takes
- Install the middleware in front of your existing routes: SDK Middleware. Any stack that cannot use the npm package can implement the same two HTTP calls directly: Integrations API.
- Price your routes in the portal under Connect → Integrations: Integrations.
It fails toward free
Installing a paywall in front of a working API is only safe if our outage cannot become your outage. Each of the following serves the request free, and they are all checked before the one condition that charges:- No config — you are not registered yet, or Apiosk is unreachable and the middleware has never polled.
- No payout wallet on the linked listing. A
402that settles nowhere takes money and delivers nothing. - Your own customer, when
authFallbackispassthrough(the default). - No price, or x402 switched off for that route, or a price of zero.
- Terms we cannot quote honestly — an asset or chain we have no verified token facts for.
402. And only an affirmatively
verified payment reaches your handler: an unreachable verifier, a rejected
proof, or an ambiguous response all re-issue the challenge rather than deliver.
A route discovered by the middleware is reported to Apiosk unpriced and
switched off. Installing the middleware never starts charging for anything —
that is always a decision you make in the dashboard.
What the caller sees
The middleware emits a dual-stack challenge, the same shape the Apiosk gateway emits:- the body is x402 v1 (bare network names,
maxAmountRequired), which is what every released payer SDK parses - the
payment-requiredheader is x402 v2 (CAIP-2 ids,amount), base64-encoded JSON, for header-first v2 clients and indexers
x-payment for v1, payment-signature for v2), and a settled call
carries the receipt back in x-payment-response. See
x402 Versions.
Settlement in SDK mode is USDC on Base. The gateway’s wider network set
(see Multi-chain Settlement) does not apply here: the
middleware only quotes terms it holds verified token facts for, and quoting a
chain it cannot settle on would produce a 402 no one can pay.
Status
Registration, configuration, route discovery, the connection test and the402
challenge are complete and tested end to end.
Related links
- SDK middleware: /guides/sdk-middleware
- Integrations API: /guides/integrations-api
- Integrations in the portal: /dashboard/integrations
- Provider SDK keys: /guides/provider-sdk
- Publisher lifecycle: /guides/publisher-lifecycle