SDK reference
Errors
PathGlobalApiError — the status, the stable code, the request id and the details of an error the API answers, and the codes worth handling by name.
PathGlobalApiError
An answer outside 2xx rejects with one.
import { PathGlobalApiError } from '@pathglobal/sdk';
try {
await pg.router.execute(quote.id, { idempotencyKey: 'payout-42' });
} catch (e) {
if (e instanceof PathGlobalApiError) {
e.status; // 409
e.code; // 'pathglobal.router.quote_expired'
e.message; // for a person and a log; do not parse it
e.requestId; // PathGlobal-Request-Id: quote it to Path Global support
e.details; // structured, optional
}
}| Property | Type | |
|---|---|---|
status | number | The HTTP status |
code | string | pathglobal.<product>.<condition>. Stable: switch on it |
message | string | For a person |
requestId | string | undefined | The request_id of the error envelope |
details | Record<string, unknown> | undefined | The details of the envelope, when the API gives them |
The API answers { "error": { "code", "message", "details", "request_id" } }. A body that is not
JSON, or an error without a code, becomes pathglobal.core.internal with the status of the answer.
A timeout or a failed connection is not a PathGlobalApiError: it is the error of fetch or of
AbortSignal.timeout (Client).
Handling by code
if (e instanceof PathGlobalApiError) {
switch (e.code) {
case 'pathglobal.router.quote_expired':
// Quote again; a quote executes once, before expires_at.
break;
case 'pathglobal.core.idempotency_in_progress':
// The first request with this key is still running: send it again later, with the same key.
break;
case 'pathglobal.core.idempotency_conflict':
// The same key was sent with another body: this is a bug in the caller.
break;
case 'pathglobal.risk.approval_pending':
// The change waits for a decision on its approval: details.approval names it.
break;
case 'pathglobal.risk.halted':
// New work is paused. Nothing was started.
break;
case 'pathglobal.core.mode_unavailable':
// The mode of the key is not available now.
break;
case 'pathglobal.core.unsupported_version':
// apiVersion is not a version of the API: details.latest names the latest.
break;
}
}A 429 is a rate limit, which carries the standard RateLimit headers, or one of the codes below:
a corridor throttle, a velocity bound, a spent Crossway budget. Read code before sending again. A
5xx answer is not kept against the idempotency key: the request may be
sent again with the same key.
Codes
PATHGLOBAL_ERROR_CODES, also reachable as PathGlobalApiError.codes, names the codes of
addresses, subjects, aliases, endpoints and Path Tools, of the payment of a PATH address or an
alias, and of the choice of a router; PathGlobalErrorCode is their type.
| Code | Status | When |
|---|---|---|
pathglobal.core.malformed_request | 400 | The body or the query does not match the route; a body that is not JSON |
pathglobal.core.unsupported_version | 400 | Path-Version is not a version of the API; details.latest names the latest |
pathglobal.core.not_found | 404 | No such object for this caller, a route that is not part of the API, or a test mode call on a live key |
pathglobal.core.conflict | 409 | The object changed meanwhile, or other content under the same reference |
pathglobal.core.reference_taken | 409 | The client's reference names another object |
pathglobal.core.idempotency_conflict | 409 | The same idempotency key with another body |
pathglobal.core.idempotency_in_progress | 409 | A request with this key is running |
pathglobal.core.mode_unavailable | 503 | The mode of the key is not available |
pathglobal.core.internal | 500 | An error of the API |
pathglobal.auth.unauthenticated | 401 | No key, or a key that is revoked, expired or used outside its address ranges |
pathglobal.auth.scope_missing | 403 | The key does not carry the scope of the call |
pathglobal.accounts.insufficient_funds | 422 | The holding or the position does not hold the amount |
pathglobal.accounts.frozen | 409 | The holding is frozen |
pathglobal.accounts.asset_not_held | 422 | The holding does not hold that asset |
pathglobal.addresses.subject_not_verified | 422 | The subject is not verified |
pathglobal.addresses.alias_unavailable | 409, 422 | The alias is not available, or the address cannot carry one |
pathglobal.addresses.alias_held | 409 | The subject holds an alias in this network; release it first |
pathglobal.addresses.alias_change_limit | 409 | The subject has made the alias changes the network allows in a year |
pathglobal.addresses.revoked | 409, 410 | The address is revoked. A quote or a route to it answers 410 with details.rotated: false |
pathglobal.addresses.moved | 410 | A quote or a route names a PATH address its holder replaced. The answer does not name the new address |
pathglobal.addresses.registrar_unavailable | 503 | The PATH network did not take a write of a subject, an address or an alias. Send the same request again |
pathglobal.accounts.holder_unknown | 422 | holder.path_id names no subject of the client |
pathglobal.addresses.rail_not_on_address | 422 | The address does not carry that rail; on a pledge, details.index names the entry |
pathglobal.endpoints.anchor_incompatible | 422 | The anchor does not receive what the endpoint receives |
pathglobal.endpoints.issuer_unavailable | 422 | No endpoint of that type is issued for that asset, network or country, or the format is not issued on that network on this date (details.status) |
pathglobal.networks.identifier_invalid | 422 | The identifier is not one of the network |
pathglobal.networks.operation_unsupported | 422 | The network does not offer the operation |
pathglobal.networks.not_connected | 503 | The network is not reachable for the operation now |
pathglobal.networks.closed | 409 | The network is closed now |
pathglobal.networks.circuit_open | 503 | The connection to the network is not available now |
pathglobal.networks.timeout | 504 | The network did not answer in time |
pathglobal.router.no_route | 422 | No route delivers the intent within its constraints |
pathglobal.router.router_unknown | 400, 404 | router is neither path-flash-1.0 nor a router of the catalogue; details.routers lists them, path-flash-1.0 first |
pathglobal.router.payee_unknown | 404 | The PATH address or the alias does not resolve. One answer for every case, with no details |
pathglobal.router.payee_unavailable | 503 | The payee's member did not answer; details.path_code when it answered. Send the same request again later |
pathglobal.router.terms_unverifiable | 502 | What the payee's member published does not verify; details.check is sonar, discovery, signature, answer, commitment or instruction. Nothing moves |
pathglobal.router.instruction_refused | 409 | The payee's member refused the payment instruction (details.path_code), or its amount or limits do not fit the route (details.reason: amount or limits). Nothing moves |
pathglobal.router.quote_expired | 409 | The quote is past expires_at |
pathglobal.router.quote_already_used | 409 | The quote has been executed |
pathglobal.decision.model_unknown | 400 | No such decision model |
pathglobal.proof.failed | 422 | The payment does not pass Proof |
pathglobal.proof.review | 409 | The verdict is in review |
pathglobal.liquidity.no_liquidity | 400 | No provider or pool fills the pair for the amount |
pathglobal.liquidity.pool_unavailable | 400, 409 | The pool is paused or cannot pay out the amount now |
pathglobal.liquidity.lock_expired | 400 | A liquidity lock or quote has expired |
pathglobal.clearing.participant_unknown | 404 | The key acts for no participant |
pathglobal.clearing.not_debtor | 403 | The caller is not the party the call needs |
pathglobal.clearing.cap_exceeded | 422 | The obligation passes a cap |
pathglobal.clearing.participant_suspended | 409 | A party is suspended |
pathglobal.clearing.cycle_closed | 409 | The cycle is closed or settled |
pathglobal.settlement.not_funded | 422 | The source of the route is neither collected nor held |
pathglobal.settlement.invalid_transition | 409 | The object is not in a state that allows the call |
pathglobal.settlement.guarantee_unavailable | 422 | A leg cannot be secured at the level it needs |
pathglobal.settlement.rail_unavailable | 503 | The network of a leg is not answering |
pathglobal.settlement.in_doubt | 409 | The outcome of a leg is not known yet |
pathglobal.settlement.leg_not_secured | 409 | A leg is not secured yet |
pathglobal.settlement.deadline | 409 | The deadline of the execution has passed |
pathglobal.connect.capability_denied | 403 | The connection does not grant the capability |
pathglobal.connect.limit_exceeded | 422 | The amount passes a limit of the connection |
pathglobal.connect.inactive | 409 | The connection or the delegation is not active |
pathglobal.connect.not_due | 409 | No charge is due |
pathglobal.connect.account_not_found | 422 | The account could not be verified |
pathglobal.connect.holder_mismatch | 422 | The holder does not match the account |
pathglobal.ramp.provider_unavailable | 422 | The provider does not serve the session |
pathglobal.ramp.step_invalid | 409 | The session is not at a step that advances |
pathglobal.crossway.registry_not_granted | 403, 429 | The registry is not granted for the operation, or its budget is spent |
pathglobal.crossway.key_unresolvable | 404 | The registry does not resolve the key |
pathglobal.tools.unavailable | 503 | The tool is not available |
pathglobal.tools.refused | varies | The PATH protocol refused the call; details.path_code names why |
pathglobal.tools.answer_unverifiable | 502 | A signed answer of the PATH network does not verify, or does not answer the question asked |
pathglobal.addresses.membership_unverified | 409 | A membership of your own requires a proof of membership, not available in this version |
pathglobal.treasury.destination_not_allowed | 403 | The destination is not one the transfer may pay |
pathglobal.treasury.out_of_policy | 422 | The change is outside the policy |
pathglobal.treasury.reconciliation_break | 409 | The source takes no debit until its break is resolved |
pathglobal.refuel.cycle_state | 409 | No cycle has started, or the cycle has no report yet |
pathglobal.ledger.insufficient_position | 422 | The account does not hold what the change takes |
pathglobal.ledger.limit_exceeded | 422 | The change passes a limit of an account |
pathglobal.ledger.account_frozen | 409 | The account is frozen or closed |
pathglobal.risk.halted | 503 | New work is paused |
pathglobal.risk.corridor_closed | 422 | The corridor is closed |
pathglobal.risk.corridor_throttled | 429 | The corridor is throttled and has reached its rate |
pathglobal.risk.exposure_exceeded | 422 | A bound of the corridor or a limit |
pathglobal.risk.velocity_exceeded | 429 | A bound of the client or the destination for the window |
pathglobal.risk.breaker_open | 503 | A breaker is open |
pathglobal.risk.verdict_invalid | 422 | The verdict is not valid for this payment or subject |
pathglobal.risk.identity_restricted | 403 | A party is restricted or blocked |
pathglobal.risk.operator_required | 403 | Live mode: no valid signature of an operator who carries the scope |
pathglobal.risk.self_approval | 403 | The checker is the maker, or the decider of a verdict asked for it |
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.intelligence.out_of_bounds | 422 | The bounds asked for are not admitted |
The HTTP contract of each route, with its codes, is in the API reference.
What an error does not say
A negative answer cannot be told apart from another: an object of another client answers as one
that does not exist. Errors carry no internal detail. Give Path Global the requestId to look into
one.
Types
The wire types @pathglobal/sdk exports, grouped by product — the shapes the API sends and receives, with amounts as decimal strings.
Path Global operator calls
pg.connectivity and pg.operations — network calendars, capabilities and compatibility, sandbox scripts, closing a netting set and settling a period.