---
title: "Gate REST Futures Get Orders JavaScript SDK Example | Siebly"
description: "Gate REST Futures get orders JavaScript example for the Siebly Gate SDK, covering exchange REST API and WebSocket integration, setup, and production SDK docs."
canonical: "https://siebly.io/examples/Gate/Rest/futures/getOrders"
robots: "index,follow"
---

# Gate REST Futures Get Orders JavaScript SDK Example

Gate REST Futures get orders JavaScript example for the Siebly Gate SDK, covering exchange REST API and WebSocket integration, setup, and production SDK docs.

**Path:** [Home](/) / [Examples](/examples) / [Gate](/examples/Gate) / [Rest](/examples/Gate/Rest) / [futures](/examples/Gate/Rest/futures) / [getOrders.ts](/examples/Gate/Rest/futures/getOrders)

[View source on GitHub](https://github.com/sieblyio/crypto-api-examples/blob/master/examples/Gate/Rest/futures/getOrders.ts)

[Open the Gate JavaScript SDK guide](/sdk/gate/javascript)

## getOrders.ts

```typescript
import { RestClient } from 'gateio-api';

// Define the account object with API key and secret
const account = {
  key: process.env.API_KEY || 'yourApiHere', // Replace 'yourApiHere' with your actual API key or use environment variables
  secret: process.env.API_SECRET || 'yourSecretHere', // Replace 'yourSecretHere' with your actual API secret or use environment variables
};

// Initialize the RestClient with the API credentials
const gateRestClient = new RestClient({
  apiKey: account.key,
  apiSecret: account.secret,
});

async function getFuturesOrders() {
  try {
    console.log('Using API keys:', account);

    // Fetch open futures orders with USDT settlement
    const openOrders = await gateRestClient.getFuturesOrders({
      settle: 'usdt', // Specify the settlement currency
      status: 'open', // Specify the status of the orders to fetch
    });
    console.log('openOrders: ', openOrders); // Log the response to the console

    // Fetch finished futures orders with USDT settlement
    const finishedOrders = await gateRestClient.getFuturesOrders({
      settle: 'usdt', // Specify the settlement currency
      status: 'finished', // Specify the status of the orders to fetch
    });
    console.log('finishedOrders: ', finishedOrders); // Log the response to the console
  } catch (e) {
    console.error('Error in execution: ', e); // Log any errors that occur
  }
}

// Execute the function to get futures orders
getFuturesOrders();
```
