Coinlocally Docs
API Document
API Document
  • Introduction
    • API Basic Information
    • HTTP Error Codes
    • General Information
    • Limits
    • Endpoint Security Type
    • Signature Authentication
    • Timing Security
    • SIGNED Endpoint Example
  • Changelog
  • Spot
    • Public
    • Market
    • Trade
    • Account
  • Futures
    • Public
    • Market
    • Trade
    • Account
  • Margin
  • Withdraw
  • WebSocket
    • Spot
    • Futures
  • Official SDK
  • Enums
  • Error
  • FAQ
Powered by GitBook
On this page
  • ⏱ Timestamp & recvWindow
  • 🚫 X-CH-TS Header Missing
  • ❌ Invalid Signature Issues
  • ⚠ ILLEGAL_CONTENT_TYPE (-1017)
  • 📊 API Rate Limits
  • 🔌 WebSocket Connection Issues
  • ⏳ Timeout Errors
  • 🔄 Batch Order Limits
  • 🆔 Custom Order ID
  • 💱 Currency Pairs & Market Data

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

      bashCopyEdit1588591856950GET/sapi/v1/account
    • POST

      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:

    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.


PreviousError

Last updated 17 days ago

Need more help? Contact or refer to our .

Coinlocally Support
Full API Documentation