SDK reference
Risk
pg.risk — corridors, limits, exposures and breakers, approvals and their decision signature, approval rules, operators, identities, cases and the audit log.
pg.risk is an operator product: it acts on the whole deployment. Every call needs the risk scope;
deciding an approval needs the approver scope of its action as well. Exercise it in the sandbox with
test keys. In live mode it is available to a key whose agreement includes operator access, and every
request carries the signature of a registered operator
(operator).
A change that tightens applies at once. A change that loosens is requested without an approval id and applied with the id of its approval, once a second person has approved it.
What a payment is refused with is on Routing.
Corridors
A corridor runs from one asset on a network to another, ASSET@network>ASSET@network. A corridor is
open, throttled or closed.
| Call | Returns | |
|---|---|---|
corridors() | RiskCorridor[] | Every corridor and its bounds |
corridor(id) | RiskCorridor | One corridor |
putCorridor(id, corridor) | RiskCorridor | ApprovalWaiting | Writes a corridor (RiskCorridorRequest) under an approval corridor_open |
closeCorridor(id, reason?) | RiskCorridor | Closes it. Applies at once |
throttleCorridor(id, throttle, { approval?, reason? }) | RiskCorridor | ApprovalWaiting | Sets { per_minute, amount_per_hour }, at or above the corridor's throttle floor. A tightening applies at once; a loosening waits for an approval corridor_open |
openCorridor(id, { approval?, reason? }) | RiskCorridor | ApprovalWaiting | Opens it under an approval corridor_open |
In the sandbox, a pair with no corridor gets one on first use, which advances recallable pay-ins
under a limit (bounded_exposure). The values of live corridors are set by Path Global.
Limits, exposures and breakers
| Call | Returns | |
|---|---|---|
limits() | ExposureLimit[] | Every limit, <scope>:<subject>:<measure>[:<window>] |
setLimit(id, limit, approval?) | ExposureLimit | ApprovalWaiting | A lower limit applies at once; a higher one under an approval limit_raise |
exposures() | Exposure[] | Each limit with its value and utilisation_bps |
breakers() | Breaker[] | Every breaker, <scope>:<subject>: closed, half_open or open |
tripBreaker(id, cause) | Breaker | Opens a breaker. Applies at once |
resetBreaker(id, { approval?, probe? }) | Breaker | ApprovalWaiting | Resets a breaker under an approval breaker_reset: to half_open with a probe amount, then closed |
Breaker scopes: corridor, partner, network, asset, account, client, provider,
system.
halt, stop, resume and switchLog are reserved to Path Global. A client reads
503 pathglobal.risk.halted: new work is paused.
Approvals
| Call | Returns | |
|---|---|---|
approvals(filter?) | Approval[] | Filter { state?, action?, subject?, after?, limit? } |
approval(id) | Approval | One approval, signed |
approve(id, signature?) | Approval | Approves. In live mode signature is the checker's decision signature |
reject(id, signature?) | Approval | Rejects, under the same rule |
An approval applies once, to the change it names (action, subject), at the version it names
(target_version). It is requested, then approved or rejected, then consumed when the change
applies, or expired.
The checker is another credential and another operator than the maker, and its key carries risk
and the approver scope of the action:
| Approver scope | Actions |
|---|---|
treasury_approve | treasury_transfer, allowlist_add, policy_change, funding_expect, break_resolve, rule_change, collateral_withdraw, pool_resume |
risk_approve | corridor_open, limit_raise, breaker_reset, operator_register, identity_restore, case_decide, bounds_change, instruction_resolve, participant_onboard, cap_raise |
Approvals gives the full contract.
The decision signature
In live mode the body of a decision carries signature: the checker's Ed25519 signature, in
hexadecimal (128 characters), over the hexadecimal SHA-256 of the canonical JSON
{ approval, decision, payload_digest } (keys sorted, no whitespace). approval is the id,
payload_digest is read from the approval, and decision is approve or reject. Test mode asks
for no signature.
import { createHash, createPrivateKey, sign } from 'node:crypto';
import type { Approval } from '@pathglobal/sdk';
const checkerKey = createPrivateKey(process.env.OPERATOR_KEY_PEM!);
function decisionSignature(approval: Approval, decision: 'approve' | 'reject'): string {
const canonical = JSON.stringify({ approval: approval.id, decision, payload_digest: approval.payload_digest });
const digest = createHash('sha256').update(canonical).digest('hex');
return sign(null, Buffer.from(digest), checkerKey).toString('hex');
}
const approval = await checker.risk.approval(approvalId);
await checker.risk.approve(approval.id, checker.mode === 'live' ? decisionSignature(approval, 'approve') : undefined);| Code | Status | When |
|---|---|---|
pathglobal.risk.self_approval | 403 | The checker is the maker's credential or operator |
pathglobal.risk.approval_pending | 409 | The change waits for a decision |
pathglobal.risk.approval_invalid | 409 | The approval is absent, not approved, expired, already used, or for another change |
pathglobal.risk.operator_required | 403 | Live mode: the request or the decision is not signed by an operator who carries the scope |
pathglobal.auth.scope_missing | 403 | The key does not carry the approver scope of the action |
Rules and operators
| Call | Returns | |
|---|---|---|
rule(id) | ApprovalRule | One approval rule |
putRule(id, rule) | ApprovalRule | ApprovalWaiting | Writes a rule under an approval rule_change |
operators() | Operator[] | The registered operators: id, public key, scopes, status |
registerOperator({ id, public_key, scopes, approval? }) | Operator | ApprovalWaiting | Registers an operator under an approval operator_register. public_key is the Ed25519 public key, 64 hexadecimal characters |
revokeOperator(id) | Operator | Revokes an operator. Applies at once |
Identities and cases
| Call | Returns | |
|---|---|---|
identity(subject) | Identity | pending, verified, restricted or blocked |
restrictIdentity(subject, reason) | Identity | Applies at once |
blockIdentity(subject, reason) | Identity | Applies at once |
restoreIdentity(subject, approval?) | Identity | ApprovalWaiting | Restores it under an approval identity_restore |
cases(filter?) | RiskCase[] | Filter { state?, subject?, after?, limit? }; a case is open, assigned or decided |
assignCase(id) | RiskCase | Assigns the case to the caller |
decideCase(id, decision, approval?) | RiskCase | ApprovalWaiting | pass, fail or file, under an approval case_decide |
In the sandbox, an unknown client reads as a verified identity with verdict sandbox.
The audit log
| Call | Returns | |
|---|---|---|
audit(from, to, page?) | RiskDecision[] | The decisions recorded between two instants; page is { after?, limit? } |
No intelligence advice and no MCP tool approves, halts or resumes, opens, closes or throttles a corridor, or changes a limit.
The guide is Risk, limits and approvals. The routes are on Risk.
Settlement
pg.settlement — SETTLs, signed receipts, executions, guarantee levels, and payment versus payment or delivery versus payment exchanges.
Intelligence
pg.intelligence — net outflow forecasts, corridor health, the state reading, advice measured against its baseline, the evaluation, and the bounds of automatic application.