SDKS
TypeScript
@ax402/sdk + /buyer + /platform
@ax402/sdk mirrors the control-plane REST contract and includes a /buyer module for paying gateway URLs. Subpaths: main entry, /buyer, /platform, /scopes, /shell.
Source: github.com/AxLabs/ax402-sdks (packages/typescript/).
Install
npm install @ax402/sdk
# Buyer deps (required for /buyer)
npm install @x402/fetch @x402/evm viemControl plane
import { Ax402Client, buildUsdcAccept, usdcToAtomic } from "@ax402/sdk";
const client = new Ax402Client({
baseUrl: process.env.AX402_BASE_URL!,
apiKey: process.env.AX402_API_KEY!,
});
const apis = await client.apis.list();
await client.endpoints.create(apiId, {
method: "GET",
path_pattern: "/v1/*",
accepts: [buildUsdcAccept("exact", usdcToAtomic("0.10"))],
});Resources: auth (incl. MFA, passkeys), keys, apis (incl. batch overview/settings, apis.discovery), endpoints, domains, openapi, stats, settlements, billing, income, exchangeRates, config. Broadest SDK — includes facilitator stats and global payment history.
Discovery
await client.apis.create({
name: "Search",
slug: "search",
upstream_base_url: "https://upstream.example.com",
discovery_guidance: "Use POST /search with a query field.",
discovery_contact_email: "support@example.com",
});
const urls = await client.apis.discovery(apiId);
await client.endpoints.update(apiId, endpointId, {
request_schema: { type: "object", properties: { query: { type: "string" } } },
response_schema: { type: "object", additionalProperties: true },
});Full guide: API discovery.
Buyer module
Pay gateway hostnames, not the control plane. Full guide: Buyer clients.
import { buyerClientFromEnv } from "@ax402/sdk/buyer";
const client = await buyerClientFromEnv();
const { response, payment } = await client.pay({
url: "https://my-api.ax402.io/v1/foo",
});Batch-settlement gateways:
const client = await buyerClientFromEnv({ batch: { depositMultiplier: 5 } });Browser wallet: createEvmSignerFromBrowserProvider() + BuyerClient.create(signer).
Platform helpers
SCOPE_PRESETS,SCOPE_LABELS— API key scopesusdcToAtomic,buildUsdcAccept,buildBatchUsdcAcceptgatewayURL,setupApiWithDefaultDomainwrapOpenAPI— bulk endpoint import