> For the complete documentation index, see [llms.txt](https://docs.koinbay.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.koinbay.com/api/overview.md).

# Overview

This document is the consolidated, live-verified API reference for the Koinbay spot and futures REST APIs plus the market WebSocket.&#x20;

## Live hosts

| Surface           | Base URL                                  |
| ----------------- | ----------------------------------------- |
| Spot REST         | <https://openapi.koinbay.com>             |
| Futures REST      | <https://futuresopenapi.koinbay.com>      |
| Spot WebSocket    | wss\://ws.koinbay.com/kline-api/ws        |
| Futures WebSocket | wss\://futuresws.koinbay.com/kline-api/ws |

## Authentication & signing

Trade and account endpoints require three headers:

| Header      | Value                                      |
| ----------- | ------------------------------------------ |
| X-CH-APIKEY | Your API key                               |
| X-CH-TS     | Request timestamp, Unix epoch MILLISECONDS |
| X-CH-SIGN   | HMAC-SHA256 signature, LOWERCASE HEX       |

The signature is computed over the pre-hash string:

```
timestamp + METHOD + requestPath [+ "?" + queryString] [+ body]
```

* METHOD is uppercase (GET / POST).
* **For GET with query params, append \`?\` + the exact query string.**
* For POST, append the exact JSON body string you send.
* HMAC key = your API secret. Output = **hex**.
* recvWindow (default 5000ms) bounds clock skew. Content-Type is always application/json.

**Three distinct error envelopes** (all confirmed live — clients must handle all three):

* Spot business error: \`{"code": \<int>, "msg": \<str>}\`
* Futures business error: \`{"code": "\<str>", "succ": false, "msgData": null, "msg": \<str>}\` (string code).
* Infrastructure / 404: \`{"timestamp","status","error","message","path"}\` (Spring-style) — returned by paths that don't exist.

**Order-ID precision warning:** orderId values exceed 2^53, so 64-bit-float JSON parsers (e.g. JavaScript JSON.parse) silently corrupt them. Always use the string form — spot returns orderId (number) AND orderIdString (string); futures POST /order and POST /cancel return orderId as a string. Treat all order IDs as strings.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.koinbay.com/api/overview.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
