Skip to main content

Quickstart

A 60-second hello world: fetch server time, validate your keys, and list your open Spot orders.

1. Install dependencies

Python 3.9 or later. Install:

pip install cryptography requests

The Reference Client also uses python-socketio and websocket-client for WebSocket flows — install them when you get to that section.

2. Drop in the Reference Client

Copy the helper from Reference Client into your project and set your API_KEY and SECRET_KEY constants.

3. Run three calls

import requests
# sign_request, BASE_URL, etc. come from the Reference Client

# 1. Server time (unauthenticated)
print(requests.get(BASE_URL + "/trade/api/v2/time").json())

# 2. Validate your API key + signature
headers, path = sign_request("GET", "/trade/api/v2/validate/keys")
print(requests.get(BASE_URL + path, headers=headers).json())

# 3. List your open Spot orders on coinswitchx
headers, path = sign_request("GET", "/trade/api/v2/orders",
params={"open": "true", "exchanges": "coinswitchx"})
print(requests.get(BASE_URL + path, headers=headers).json())

What you should see

If all three calls return 200s, you're integrated:

{ "serverTime": 1719905777483 }
{ "message": "Valid Access" }
{ "data": { "orders": [ ... ] } }

The third call returns an empty orders array if you have no open orders, which is fine.

Troubleshooting

  • 401 Invalid Access on call 2 — your API key, secret, or signature is wrong. Double-check that the key in X-AUTH-APIKEY matches the one paired with the secret you're signing with. See Authentication.
  • Connection / TLS errors — verify your firewall allows outbound HTTPS to coinswitch.co.
  • 429 — rate limit exceeded. The Quickstart calls won't trigger this on a fresh key; if it happens, wait 10 seconds and retry.

Next steps

  • Recipes — the fastest path forward. Single-file clients for Spot / Futures / HFT with every endpoint pre-wrapped as a method.
  • Spot Reference — every spot endpoint, with request/response shapes and examples.
  • Futures Reference — perpetual futures.
  • Reference Client — the smaller, signing-only helper if you want to wrap endpoints yourself.