SDK reference
Clearing
pg.clearing — the participant a key acts for, obligations and proposals, positions and the queue, netting sets, periods and their signed reports.
Scope clearing. A key acts for the participant whose credentials include the key's credential.
A key that acts for no participant is 404 pathglobal.clearing.participant_unknown. Participants
and their caps are set by Path Global.
| Call | Returns | |
|---|---|---|
participant() | Participant | The participant the key acts for: its kind (provider, partner or client), status, settlement accounts, caps and collateral |
record(input, opts?) | Obligation & Partial<ClearingObligation> | Records an obligation. The debtor's call records it; a creditor's call stores a proposal its debtor accepts |
accept(id) | ClearingObligation | The debtor accepts a proposal |
obligation(id) | ClearingObligation | One obligation of which the participant is debtor or creditor |
positions() | ClearingNetPosition[] | The running net positions of the participant, per asset |
queue() | ClearingObligation[] | The participant's obligations that wait for cap headroom |
sets() | NettingSet[] | The netting sets: asset, settles_on_network (the network each settles on), cut-offs, status |
periods(set?) | ClearingPeriod[] | The periods, of one set or of all |
period(id) | ClearingPeriod | One period: state, gross, net positions, netting_efficiency, and in instructions the executions that settle it |
report(id) | ClearingReport | The signed report of a settled period |
cycles() | Cycle[] | The clearing cycles |
current() | Cycle | The open cycle |
cycle(id) | Cycle | One cycle, with its obligations |
close(id) | Cycle | Test mode only. Closes a cycle |
settle(id) | Cycle | Test mode only. Settles a closed cycle |
Recording an obligation
const me = await pg.clearing.participant();
const obligation = await pg.clearing.record(
{
debtor: me.id,
creditor: 'meridian-markets', // a sandbox participant
amount: { value: '25000.00', asset: 'USD' },
reference: 'inv-2026-114',
set: 'USD@book',
},
{ idempotencyKey: 'inv-2026-114' },
);
obligation.state; // 'accepted' (a creditor's call answers 'proposed'; past the cap the call fails with 422 pathglobal.clearing.cap_exceeded)record takes { set?, cycle?, debtor, creditor, amount, reference }. The caller's participant is
the debtor, or the creditor, whose call stores a proposed obligation. An obligation is proposed,
pending, accepted, queued, rejected or settled.
| Code | Status | When |
|---|---|---|
pathglobal.clearing.participant_unknown | 404 | The key acts for no participant |
pathglobal.clearing.not_debtor | 403 | record: the caller is not a party; accept: the caller is not the debtor of the proposal |
pathglobal.clearing.cap_exceeded | 422 | The obligation passes a cap of the participant |
pathglobal.clearing.participant_suspended | 409 | A party is suspended |
pathglobal.clearing.cycle_closed | 409 | The cycle is closed or settled |
Sets, periods and reports
A netting set is <ASSET>@<network>; the default set of an asset is <ASSET>@book. A period is
<set>#<seq>; pass it as it is, the client encodes it. A period is open, closed, settling,
settled or partially_settled. It closes at a cut-off of its set; in test mode,
operations.closeSet closes it now.
A net debtor pays its net position under the rail reference
ns.<asset>.<network>.<seq>.<participant>. A settled period has a signed ClearingReport: its net
positions, the transfers, netting_efficiency (between 0 and 1), the executions that settle it and
what is carried to the next period.
The guide is Clearing by period, the recipe Close a clearing period. The routes are on Clearing.