Ax402Docs
SDKS

TypeScript

@axlabs/ax402-sdk + /buyer + batch

@axlabs/ax402-sdk mirrors the control-plane OpenAPI contract and includes a /buyer module for paying gateway URLs. Subpaths: main entry, /buyer, /platform.

Install

pnpm add @axlabs/ax402-sdk
# Buyer deps (required for /buyer)
pnpm add @x402/fetch @x402/evm viem

Buyer module

Pay gateway hostnames, not the control plane. Full guide: Buyer clients .

import { buyerClientFromEnv } from "@axlabs/ax402-sdk/buyer";
// One-shot
await client.apis.create({
  name: "My API",
  slug: "myapi",
  upstream_base_url: "https://api.example.com",
});
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), endpoints, domains, openapi, stats, settlements, billing, income, config. Broadest SDK — includes facilitator stats and global payment history.

Platform helpers

  • SCOPE_PRESETS, SCOPE_LABELS — API key scopes
    • usdcToAtomic, buildUsdcAccept, buildBatchUsdcAccept
    • gatewayURL, setupApiWithDefaultDomain
    • wrapOpenAPI — bulk endpoint import

Tests

cd packages/typescript && pnpm test

On this page