TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/tiagosiebler/gateio-api/llms.txt
Use this file to discover all available pages before exploring further.
RestClientOptions interface controls how the RestClient connects to Gate.io’s REST API. You pass a plain object that satisfies this interface as the first argument to the RestClient constructor. Every field is optional — the client works out of the box without any configuration for public endpoints, and only requires apiKey and apiSecret for authenticated calls.
Fields
Your Gate.io API key. Required for any signed (private) REST endpoint. Pair this with
apiSecret.Your Gate.io API secret. Used together with
apiKey to generate the HMAC-SHA512 request signature for authenticated endpoints.Maximum request window in milliseconds for signed API calls. If an individual request does not specify its own
recvWindow, this value is used as the default. When the server receives the request outside this window it rejects it with a timestamp error.When
true, the client throws an error immediately if any request parameter resolves to undefined before the request is serialised and signed. Useful during development to catch typos or missing required fields early.Fully override the API protocol and domain, e.g.
'https://api.gate.io'. Takes precedence over baseUrlKey. Use this when you need to point to a custom proxy or mirror.Select a named base URL alias that is built into the library instead of constructing a full URL yourself. The available values are:
Ignored if
| Key | URL |
|---|---|
live | https://api.gateio.ws/api/v4 (default) |
futuresLiveAlternative | https://fx-api.gateio.ws/api/v4 |
futuresTestnet | https://fx-api-testnet.gateio.ws/api/v4 |
baseUrl is also set.When
true (the default), the client post-processes failed requests and throws a structured exception containing the HTTP status, Gate.io error label, and message. Set to false to receive raw axios error objects instead.Enable HTTP keep-alive for REST requests via the underlying axios HTTP agent. Reusing TCP connections can reduce latency on workloads that make many sequential requests.
When
keepAlive is true, this controls how often (in milliseconds) TCP keep-alive packets are sent over idle sockets. Only relevant when keepAlive is enabled. Defaults to 1000 ms as provided by Node.js’s built-in HTTPS agent.Provide a custom HMAC-SHA512 signing function. The SDK’s built-in implementation uses the Web Crypto API for broad compatibility, but Node.js’s native
crypto.createHmac is significantly faster. Swap it in when throughput matters. See the example below.Full Configuration Example
Using customSignMessageFn with Node.js crypto
The Web Crypto API is portable across runtimes, but Node.js’s built-in crypto module is measurably faster for high-frequency signing. Pass a custom function to opt in:
Promise<string> containing the lowercase hex-encoded HMAC-SHA512 digest of message signed with secret.
Using the Futures Testnet
To run your integration tests against Gate.io’s futures testnet without touching live funds, setbaseUrlKey to 'futuresTestnet':