TypeScript SDK
Install and start using the TypeScript SDK.
Intro
The PayPilot API SDK provides access to the PayPilot API REST APIs.
PayPilot is an AI operating system for small merchants on PayPal: a Growth Scientist that finds revenue opportunities in PayPal transactions, Supply Agents that source and negotiate stock with independent supplier agents, and PayPal financial operations (Orders v2 supplier settlement, Invoicing, Payouts, Subscriptions, verified webhooks, reconciliation).
Money never moves without a person. Every limit is computed by a deterministic engine before any agent speaks; purchases and payments need a recorded human approval bound to a SHA-256 hash of the exact terms; agent tools refuse to approve or pay.
Authentication. POST /api/v1/auth/login returns an access token; send it as
Authorization: Bearer <token>. Every resource is scoped to the caller's merchant and permissions
(Owner, Admin, Analyst, Staff, Viewer).
Installation
The SDK compiles to dist/ before it can be referenced — run its build script once in the SDK folder, then add it to your project by path:
npm install <path-to-sdk>Quick Start
Create one client and reuse it. Configure its behaviour through ClientOptions.
import { PayPilotApiClient, ServerEnvironment } from "pay-pilot-api";
const client = new PayPilotApiClient({
serverEnvironment: ServerEnvironment.Production,
httpBearer: "YOUR_BEARER_TOKEN",
});Nothing in ClientOptions is required — new PayPilotApiClient() compiles — and each option left out falls back to its default. serverEnvironment is spelled out above so the environment a call reaches is visible where the client is built rather than inherited silently.
From CommonJS
The package ships both dialects from a single entry, so require works with full types. In a TypeScript CommonJS file use the import ... = require(...) form — a plain destructuring require runs fine but gives you any.
import sdk = require("pay-pilot-api");
const client = new sdk.PayPilotApiClient({
serverEnvironment: sdk.ServerEnvironment.Production,
httpBearer: "YOUR_BEARER_TOKEN",
});