SDK reference

@pathglobal/sdk

The TypeScript client of the Path Global API — one class, one namespace per product, and the wire types of the API.

Path Global is an operator on the PATH network. Access to its API is on request at pathglobal.finance.

npm install @pathglobal/sdk

TypeScript, ESM, Node 20+, no runtime dependency. The client runs wherever fetch, Web Crypto (crypto.subtle) and AbortSignal.timeout exist. Run it on your server: a key stays there.

A first call

import { PathGlobal } from '@pathglobal/sdk';

const pg = new PathGlobal({ apiKey: process.env.PATHGLOBAL_API_KEY! });

pg.mode; // 'test' for a key_test_… key

const account = await pg.accounts.openOmni(
  { holder: { name: 'Acme Treasury' }, holdings: [{ kind: 'virtual_account', currency: 'USD' }] },
  { idempotencyKey: 'open-acme' },
);
const holding = account.holdings[0]!;
await pg.accounts.fund(holding.id, { value: '1000.00', asset: 'USD' }); // test mode only

const quote = await pg.router.quote({
  amount: { value: '250.00', asset: 'USD' },
  source: { omni_account: account.id },
  destination: { network: 'sepa-inst', identifier: 'DE89370400440532013000' },
  deliver: { asset: 'EUR' },
});
quote.guarantee;  // the guarantee level of the chosen route
quote.expires_at; // a quote executes once, before this instant

const route = await pg.router.execute(quote.id, { idempotencyKey: 'payout-42' });

Namespaces

Each product of the API is a namespace of the client. A namespace needs the scope of its product on the key.

NamespaceScopePage
accounts, addresses, endpointsaccounts, addresses, endpointsAccounts, addresses and endpoints
catalogue, router, decision, proofrouter (for catalogue too), decision, proofCatalogue, router, decision and proof
liquidityliquidity; treasury as well for the operator callsLiquidity
clearingclearingClearing
settlementsettlementSettlement
treasurytreasury; treasury_approve for a decisionTreasury
riskrisk; the approver scope of the action for a decisionRisk
intelligenceintelligenceIntelligence
connect, ramp, crossway, toolsconnect, ramp, crossway, toolsConnect, ramp, Crossway and tools
connectivity, operationsoperations; risk as well for clearingPath Global operator calls

treasury, treasury_approve, risk and risk_approve are operator scopes. A call that needs one is an operator call: in live mode it carries the signature of a registered operator, which the client adds when it is built with operator.

Conventions

Amounts are Money: { value: '250.00', asset: 'USD' }, a decimal string in major units.

Lists resolve to the array. The API answers a list in a named key ({ "routes": [ … ] }); the client returns its content.

References in a path are passed as they are. The client encodes them: an account reference such as client:-:<holding>:<asset>, a corridor id ASSET@network>ASSET@network, a period id <set>#<seq>.

A change that waits for a second person resolves to the approval it waits for, with status 202. It is not an error. Client shows how to tell the two answers apart.

Errors reject with PathGlobalApiError. Switch on code.

Everything exported

import { PathGlobal, PathGlobalApiError, PATHGLOBAL_BASE_URL } from '@pathglobal/sdk';

import type {
  OperatorSigner,
  PathGlobalOptions,
  // and every wire type of the API: Money, Intent, Quote, Route, Settlement,
  // Instruction, Approval, TreasuryTransfer, …
} from '@pathglobal/sdk';

The wire types are listed on Types. The HTTP contract of each call is in the API reference.

On this page