OKX REST public JavaScript example for the Siebly OKX SDK, covering exchange REST API and WebSocket integration, setup, and production SDK docs.
We use environment variables in our examples for API keys. It is your responsibility to manage and secure your keys appropriately.
okx-api instead of hand-written HTTP request plumbing.OKX/Rest/rest-public.ts.RestClient.getInstruments().import { RestClient } from 'okx-api'; const client = new RestClient(); /** * This is a simple script wrapped in a immediately invoked function expression, designed to make public API calls without credentials */(async () => { try { const results = await client.getInstruments({ instType: 'SPOT' }); console.log( 'result: ', results.filter((row) => row.baseCcy === 'SUI'), ); return; } catch (e) { console.error('request failed: ', e); }})(); We use essential cookies and optional analytics. Read the Privacy Policy.
Essential cookies stay on. Toggle analytics if you want to share anonymous usage insights. You can revisit this anytime via Cookie Settings in the footer.