# FAQ

This guide covers common issues, best practices, and tips for integrating with our API in a smooth and secure manner.

***

### ⏱ Timestamp & recvWindow

**Q: What is the maximum allowed time difference between the request timestamp and the server's time?**

* The default allowed time difference is **5000 milliseconds (5 seconds)**.
* Requests with timestamps older than this will be rejected as **invalid**.
* You can **customize** this window using the optional `recvWindow` parameter.

***

### 🚫 X-CH-TS Header Missing

**Q: What should I do if the request header `X-CH-TS` is empty or missing?**

* The `X-CH-TS` (timestamp) header is **mandatory**.
* Before each request, **verify that `X-CH-TS` is correctly set**.
* If issues persist, **print/log `X-CH-TS`** for debugging and ensuring your code initializes this field properly.

***

### ❌ Invalid Signature Issues

**Q: Why do I get an “Invalid Signature” error?**

1. **Check Your Headers**\
   Compare your request headers with the example:

   ```
   makefileCopyEditContent-Type: application/json
   X-CH-APIKEY: 44c541a1-****-****-****-10fe390df2
   X-CH-SIGN: ssseLeefrffraoEQ3yI9qEtI1CZ82ikZ4xSG5Kj8gnl3uw=
   X-CH-TS: 1574327555669
   ```
2. **Verify Your API Key**\
   Make sure your API key is **correctly configured** in your environment.
3. **Ensure Proper String for Signing**\
   Construct your pre-sign string correctly. The **timestamp, method, endpoint, and body** must be in the correct order.

   Examples:

   * **GET**

     ```bash
     bashCopyEdit1588591856950GET/sapi/v1/account
     ```
   * **POST**

     ```bash
     bashCopyEdit1588591856950POST/sapi/v1/order/test{"symbol":"BTCUSDT","price":"9300","volume":"1","side":"BUY","type":"LIMIT"}
     ```

***

### ⚠ ILLEGAL\_CONTENT\_TYPE (-1017)

**Q: Why do I get the error code -1017 “ILLEGAL\_CONTENT\_TYPE”?**

* Always include the header:

  ```json
  pgsqlCopyEditContent-Type: application/json
  ```

***

### 📊 API Rate Limits

**Q: How often can I call the API?**

* **Rate limits vary** by endpoint.
* **Personal data** endpoints are rate-limited **per API key**.
* **Public data** endpoints are rate-limited **per IP address**.
* If valid API information is passed in public data requests, API key limits will be applied.

**Q: What does HTTP 429 mean?**

* You’ve hit the **rate limit**. Reduce the request frequency.

**Q: Will my IP get banned if I exceed the limit?**

* Normally, no. The server will throttle your requests. Just slow down your call rate.

***

### 🔌 WebSocket Connection Issues

**Q: Why does my WebSocket disconnect unexpectedly?**

* WebSocket requires a **heartbeat (ping/pong)** to maintain a connection.
* If the server **doesn’t receive your pong**, it may close the connection.
* Implement a **reconnection mechanism** to ensure stability in the event of disconnections.

***

### ⏳ Timeout Errors

**Q: What causes a timeout when calling the API?**

* Usually due to **network issues** or inability to reach the server.
* Check your **network connectivity** and server availability.

***

### 🔄 Batch Order Limits

**Q: How many orders can I submit or cancel in a batch?**

* The batch interface supports **up to 10 orders per request**.

***

### 🆔 Custom Order ID

**Q: What is `newClientOrderId` and how is it used?**

* It's your **custom order identifier**.
* Use it to **track and manage orders**.
* Ensure **uniqueness**. Duplicate IDs may cause unexpected behavior in querying or canceling.

***

### 💱 Currency Pairs & Market Data

**Q: How can I get all trading pairs?**

* Use the endpoint:

  ```
  bashCopyEditGET /sapi/v1/symbols
  ```

**Q: How do I get the latest trade price?**

* Use the **ticker endpoint**, where `last` represents the **latest trade price**.

**Q: Can the 24-hour trading volume be negative?**

* **Yes**, because the data uses a **rolling 24-hour window**, which can decrease over time depending on market activity.

***

Need more help? Contact [Coinlocally Support](mailto:support@Coinlocally.com) or refer to our [Full API Documentation](https://docs.coinlocally.com/).


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.coinlocally.com/faq.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
