Python SDK

Install and start using the Python 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

Add the SDK to your project from its folder, with whichever package manager your project uses. Give each tool a path containing a slash, such as ../pay-pilot-api — a bare folder name is looked up on PyPI instead, and resolves to whatever project holds that name there:

Terminal
pip install <path-to-sdk>
Terminal
uv add <path-to-sdk>
Terminal
poetry add <path-to-sdk>

Quick Start

Synchronous client

Construct PayPilotApiClient with keyword arguments, and call close() when you are done. Every argument is optional.

Python
from pay_pilot_api import PayPilotApiClient

client = PayPilotApiClient(http_bearer="YOUR_BEARER_TOKEN", environment="production")

client.close()

Alternatively, scope it — with PayPilotApiClient(...) as client: closes the pool on exit.

Asynchronous client

AsyncPayPilotApiClient mirrors PayPilotApiClient with identical method names, and every endpoint method is a coroutine. It takes the same arguments, with some differences — for example, the transport argument is custom_async_http_client.

Python
from asyncio import run

from pay_pilot_api import AsyncPayPilotApiClient


async def main() -> None:
    client = AsyncPayPilotApiClient(http_bearer="YOUR_BEARER_TOKEN", environment="production")
    await client.aclose()


run(main())

Alternatively, scope it — async with AsyncPayPilotApiClient(...) as client: closes the pool on exit.

On this page