Overview
This example covers:- Positions —
GET /v2/wallets/{address}?include=earn - Poll an action —
GET /actions/{id}(INITIAL → PENDING → SUCCESS/FAILED/REFUNDED/EXPIRED) - Webhook — receive
ACTION_UPDATEevents (push) - WebSocket — subscribe to
wss://api.pods.finance/updates(push)
Prerequisites
- Node.js 18+
- Pods API key
- For webhook/WebSocket modes:
npm install express ws
Installation
Environment Variables
Step-by-Step Walkthrough
1. Check Positions
2. Poll an Action
3. Webhook (push alternative)
Register the default URL with Pods support, or passwebhookURL on a quote to override it. Pods signs every delivery. Verify the signature over the raw body before trusting it, then consume the { messageType, data } envelope (the WebSocket event is { type, action }). The contract is Webhooks.
The five-minute timestamp window and the in-memory id set below are checks in your handler. Pods signs and sends each delivery; it does not reject an old timestamp, and a non-2xx response is stored without an automatic retry. Acknowledge quickly and do the slow work after the response.
4. WebSocket (push alternative)
Connect, subscribe to the wallet channel, and handleaction_update events. Re-subscribe on
reconnect.
Running the Example
track-and-positions.js.
Next Steps
Strategy Deposit
Deposit into yield strategies
Ondo Global Markets
Buy/sell tokenized stocks with async orders
Check Positions Guide
Full wallet/position response shape
API Reference
View complete API documentation