---
title: "OKX REST Public JavaScript SDK Example | Siebly"
description: "OKX REST public JavaScript example for the Siebly OKX SDK, covering exchange REST API and WebSocket integration, setup, and production SDK docs."
canonical: "https://siebly.io/examples/OKX/Rest/rest-public"
robots: "index,follow"
---

# OKX REST Public JavaScript SDK Example

OKX REST public JavaScript example for the Siebly OKX SDK, covering exchange REST API and WebSocket integration, setup, and production SDK docs.

**Path:** [Home](/) / [Examples](/examples) / [OKX](/examples/OKX) / [Rest](/examples/OKX/Rest) / [rest-public.ts](/examples/OKX/Rest/rest-public)

[View source on GitHub](https://github.com/sieblyio/crypto-api-examples/blob/master/examples/OKX/Rest/rest-public.ts)

[Open the OKX JavaScript SDK guide](/sdk/okx/javascript)

## rest-public.ts

```typescript
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);
  }
})();
```
