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/sdkTypeScript, 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.
| Namespace | Scope | Page |
|---|---|---|
accounts, addresses, endpoints | accounts, addresses, endpoints | Accounts, addresses and endpoints |
catalogue, router, decision, proof | router (for catalogue too), decision, proof | Catalogue, router, decision and proof |
liquidity | liquidity; treasury as well for the operator calls | Liquidity |
clearing | clearing | Clearing |
settlement | settlement | Settlement |
treasury | treasury; treasury_approve for a decision | Treasury |
risk | risk; the approver scope of the action for a decision | Risk |
intelligence | intelligence | Intelligence |
connect, ramp, crossway, tools | connect, ramp, crossway, tools | Connect, ramp, Crossway and tools |
connectivity, operations | operations; risk as well for clearing | Path 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.
Client
Options, modes, operator signing, idempotency, timeouts.
Open →Accounts
Omni Accounts, holdings, subjects, PATH addresses, endpoints.
Open →Routing
The catalogue, quotes and routes, decision, Proof verdicts.
Open →Liquidity
Provider quotes, pools, positions and discovery.
Open →Clearing
Obligations, positions, netting sets and periods.
Open →Settlement
SETTLs, receipts, instructions, guarantees, exchanges.
Open →Treasury
Positions, policies, transfers, fundings, refuel, the ledger.
Open →Risk
Corridors, limits, breakers, approvals, identities, cases.
Open →Intelligence
Forecasts, corridor health, the state reading and advice.
Open →Connect
Path Connect, ramp, Crossway and Path Tools.
Open →Operator calls
Calendars, capabilities, sandbox scripts, closing a set.
Open →Errors
PathGlobalApiError and the codes to handle.
Open →