Public Rest API for WazirX
Introduction
This document details the use of Wazirx’s REST API for spot exchange. This helps you automate trades in real-time, stream live crypto rates and build other integrations for your trading journey.
Our REST API is organized into publicly accessible endpoints (market data, exchange status, etc.), and private authenticated endpoints (trading, funding, user data) which require requests to be signed.
API Key Setup
- Some endpoints will require an API Key. Please refer to this page regarding API key creation.
- Once API key is created, it is recommended to set IP restrictions on the key for security reasons.
- Never share your API key/secret key to ANYONE. If the API keys were accidentally shared, please delete them immediately and create a new key.
API Key Restrictions
- The default settings of the API key enable you to a Read-Only key. You can enable trading rights by explicity enabling SPOT Trade option under permissions for a key
- You can create 5 api keys for an account
Spot Account
A SPOT
account is provided by default upon creation of a WazirX Account.
Python connector
This is a lightweight library that works as a connector to WazirX public API, written in Python. - Python connector
Ruby connector
This is a lightweight library that works as a connector to WazirX public API, written in Ruby. - Ruby connector
Postman Collections
There is now a Postman collection containing the API endpoints for quick and easy use. This is recommended for new users who want to get a quick-start into using the API. For more information please refer to this page: WazirX API Postman
Contact Us
- WazirX Email
- Please email us at api@wazirx.com
- WazirX API Telegram Group
- For latest updates on new features, enhancements and maintenance/downtime activities.
API third party Integrations
These integrations will help you in increasing your speed to build bots
CCXT connector
- CCXT is a SDK provider and you may access the WazirX API through CCXT. For more information, please visit: https://ccxt.trade
Hummingbot
- For traders who want to get started with bot trading but are unsure how to use APIs, Hummingbot is the perfect solution as it is an automated trading bot with inbuilt trading strategies and automated market making services. Please refer here on how to get your Hummingbot trading set up.
General API Information
- The base endpoint is: https://api.wazirx.com
- All endpoints return either a JSON object or array.
- All time and timestamp related fields are in milliseconds.
HTTP Return Codes
- HTTP
4XX
return codes are used for malformed requests; the issue is on the sender's side. - HTTP
403
return code is used when the WAF Limit (Web Application Firewall) has been violated. - HTTP
429
return code is used when breaking a request rate limit. - HTTP
418
return code is used when an IP has been auto-banned for continuing to send requests after receiving429
codes. - HTTP
5XX
return codes are used for internal errors; the issue is on WazirX's side. It is important to NOT treat this as a failure operation; the execution status is UNKNOWN and could have been a success.
Error Codes and Messages
Sample Payload below:
{
"code": -1121,
"message": "Invalid symbol."
}
- If there is an error, the API will return an error with a message of the reason.
- Specific error codes and messages defined in Error Codes.
- Any endpoint can return an ERROR
General Information on Endpoints
- For
GET
endpoints, parameters must be sent as aquery string
. - For
POST
,PUT
, andDELETE
endpoints, the parameters must be sent as arequest body
with content typeapplication/x-www-form-urlencoded
. - Parameters may be sent in any order.
- If a parameter sent in both the
query string
andrequest body
, thequery string
parameter will be used.
Limits
General Info on Limits
- Limits are set on specific api endpoints. These will be mentioned in the description of the endpoint. For e.g the Ping api will have a limit of 1 request/sec while Place order api will have a limit of 10 requests/sec
- A 429 will be returned when rate limit is violated.
- The limits on the API are based on the API keys.
- We recommend using the websocket for getting data as much as possible, as this will not count to the request rate limit.
IP Limits
- When a 429 is received, it's your obligation as an API to back off and not spam the API.
- Repeatedly violating rate limits and/or failing to back off after receiving 429s will result in an automated IP ban (HTTP status 418).
- IP bans are tracked and scale in duration for repeat offenders, from 2 minutes to 3 days.
- A
Retry-After
header is sent with a 418 or 429 responses and will give the number of seconds required to wait, in the case of a 429, to prevent a ban, or, in the case of a 418, until the ban is over.
Websocket Limits
- WebSocket connections have a limit of 5 incoming messages per second. A message is considered:
- A PING frame
- A PONG frame
- A JSON controlled message (e.g. subscribe, unsubscribe)
- A connection that goes beyond the limit will be disconnected; IPs that are repeatedly disconnected may be banned.
- A single connection can listen to a maximum of 1024 streams.
Endpoint security type
- Each endpoint has a security type that determines the how you will
interact with it. This is stated next to the NAME of the endpoint.
- If no security type is stated, assume the security type is NONE.
- API-keys are passed into the Rest API via the
X-API-KEY
header. - API-keys and secret-keys are case sensitive.
- API-keys can be configured to only access certain types of secure endpoints. For example, one API-key could be used for TRADE only, while another API-key can access everything except for TRADE routes.
- By default, API-keys can access all secure routes.
Security Type | Description |
---|---|
NONE | Endpoint can be accessed freely. |
TRADE | Endpoint requires sending a valid API-Key and signature. |
USER_DATA | Endpoint requires sending a valid API-Key and signature. |
MARKET_DATA | Endpoint requires sending a valid API-Key. |
TRADE
andUSER_DATA
endpoints areSIGNED
endpoints.
SIGNED (TRADE and USER_DATA) Endpoint security
SIGNED
endpoints require an additional parameter,signature
, to be sent in thequery string
orrequest body
.- Endpoints use
HMAC SHA256
signatures. TheHMAC SHA256 signature
is a keyedHMAC SHA256
operation. Use yoursecretKey
as the key andtotalParams
as the value for the HMAC operation. - The
signature
is not case sensitive. totalParams
is defined as thequery string
concatenated with therequest body
.
Timing security
- A
SIGNED
endpoint also requires a parameter,timestamp
, to be sent which should be the millisecond timestamp of when the request was created and sent. - An additional parameter,
recvWindow
, may be sent to specify the number of milliseconds aftertimestamp
the request is valid for. IfrecvWindow
is not sent, it defaults to 5000.
The logic is as follows:
if (timestamp < (serverTime + 1000) && (serverTime - timestamp) <= recvWindow) {
// process request
} else {
// reject request
}
Serious trading is about timing. Networks can be unstable and unreliable,
which can lead to requests taking varying amounts of time to reach the
servers. With recvWindow
, you can specify that the request must be
processed within a certain number of milliseconds or be rejected by the
server.
It is recommended to use a small recvWindow of 5000 or less! The max cannot go beyond 60,000!
SIGNED Endpoint Examples for POST /sapi/v1/order
Here is a step-by-step example of how to send a vaild signed payload from the
Linux command line using echo
, openssl
, and curl
.
Key | Value |
---|---|
apiKey | vmPUZE6mv9SD5VNHk4HlWFsOr6aKE2zvsw0MuIgwCIPy6utIco14y7Ju91duEh8A |
secretKey | NhqPtmdSJYdKjVHjA7PZj4Mge3R5YNiP1e3UZjInClVN65XAbvqqM6A7H5fATj0j |
Parameter | Value |
---|---|
symbol | ltcbtc |
side | buy |
type | limit |
quantity | 1 |
price | 0.1 |
recvWindow | 5000 |
timestamp | 1499827319559 |
Example 1: As a request body
Request Body:
symbol=ltcbtc&side=buy&type=limit&quantity=1&price=0.1&recvWindow=5000×tamp=1499827319559
HMAC SHA256 signature:
[linux]$ echo -n "symbol=ltcbtc&side=buy&type=limit&quantity=1&price=0.1&recvWindow=5000×tamp=1499827319559" | openssl dgst -sha256 -hmac "Nh***0j"
(stdin)= a0***60
(HMAC SHA256)
[linux]$ curl -H "X-API-KEY: vm***8A" -X POST 'https://api.wazirx.com/sapi/v1/order' -d 'symbol=ltcbtc&side=buy&type=limit&quantity=1&price=0.1&recvWindow=5000×tamp=1499827319559&signature=a0***60'
Example 2: As a query string
Query String:
symbol=ltcbtc&side=buy&type=limit&quantity=1&price=0.1&recvWindow=5000×tamp=1499827319559
HMAC SHA256 signature:
[linux]$ echo -n "symbol=ltcbtc&side=buy&type=limit&quantity=1&price=0.1&recvWindow=5000×tamp=1499827319559" | openssl dgst -sha256 -hmac "Nh***0j"
(stdin)= a0***60
Curl Command:
[linux]$ curl -H "X-API-KEY: vm***8A" -X POST 'https://api.wazirx.com/sapi/v1/order?symbol=ltcbtc&side=buy&type=limit&quantity=1&price=0.1&recvWindow=5000×tamp=1499827319559&signature=a0***60'
Public API Endpoints
ENUM definitions
Order status (status):
- idle - The order is idle not yet triggered.
- wait - The order is still open and waiting to be filled completely.
- done - The order has been completely filled.
- cancel - The order has been canceled by the user.
Order types (orderTypes, type):
- limit
- stop_limit
Order side (side):
- buy
- sell
General endpoints
Test connectivity
GET /sapi/v1/ping
curl --location --request GET 'https://api.wazirx.com/sapi/v1/ping'
Response:
{}
Test connectivity to the Rest API.
Rate limit: 1 per second
Query Parameters: NONE
System status
GET /sapi/v1/systemStatus
curl --location --request GET 'https://api.wazirx.com/sapi/v1/systemStatus'
Response:
{
"status": "normal", // normal or system maintenance
"message": "System is running normally."
}
Fetch system status.
Rate limit: 1 per second
Query Parameters: NONE
Check server time
GET /sapi/v1/time
curl --location --request GET 'https://api.wazirx.com/sapi/v1/time'
Response:
{
"serverTime": 1499827319559
}
Test connectivity to the Rest API and get the current server time.
Rate limit: 1 per second
Query Parameters: NONE
Exchange Info
GET /sapi/v1/exchangeInfo
curl --location --request GET 'https://api.wazirx.com/sapi/v1/exchangeInfo'
Response:
{
"timezone": "UTC",
"serverTime": 1631531599247,
"symbols": [
{
"symbol": "btcinr",
"status": "trading",
"baseAsset": "btc",
"quoteAsset": "inr",
"baseAssetPrecision": 5,
"quoteAssetPrecision": 0,
"orderTypes": [
"limit",
"stop_limit"
],
"isSpotTradingAllowed": true,
"filters": [
{
"filterType": "PRICE_FILTER",
"minPrice": "1",
"tickSize": "1"
}
]
}
]
}
Fetch all exchange information
Rate limit: 1 per second
Query Parameters: NONE
Market Data endpoints
24hr tickers price change statistics
GET /sapi/v1/tickers/24hr
curl --location --request GET 'https://api.wazirx.com/sapi/v1/tickers/24hr'
Response:
[
{
"symbol": "btcinr",
"baseAsset": "btc",
"quoteAsset": "inr",
"openPrice": "704999.0",
"lowPrice": "702603.0",
"highPrice": "730001.0",
"lastPrice": "720101.0",
"volume": "891.8329",
"bidPrice": "720102.0",
"askPrice": "722999.0",
"at": 1588829734
}
]
24 hour rolling window price change statistics.
Rate limit: 1 per second
24hr ticker price change statistics
GET /sapi/v1/ticker/24hr
curl --location --request GET 'https://api.wazirx.com/sapi/v1/ticker/24hr?symbol=wrxinr'
Response:
{
"symbol": "wrxinr",
"baseAsset": "wrx",
"quoteAsset": "inr",
"openPrice": "704999.0",
"lowPrice": "702603.0",
"highPrice": "730001.0",
"lastPrice": "720101.0",
"volume": "891.8329",
"bidPrice": "720102.0",
"askPrice": "722999.0",
"at": 1588829734
}
24 hour rolling window price change statistics.
Rate limit: 1 per second
Query Parameters:
Name | Type | Mandatory | Description |
---|---|---|---|
symbol | STRING | YES |
Kline/Candlestick Data
GET /sapi/v1/klines
curl --location --request GET 'https://api.wazirx.com/sapi/v1/klines?symbol=btcinr&limit=5&interval=1m&startTime=1647822960&endTime=1647823020'
Response:
[
[
1647822960, // Kline start time
20, // Open price
20, // High price
20, // Low price
20, // Close price
0 // Base asset volume
],
[
1647823020, // Kline start time
20, // Open price
20, // High price
20, // Low price
20, // Close price
0 // Base asset volume
]
]
Request via this endpoint to get the klines data of the specified symbol.
Rate limit: 1 per second
Query Parameters:
Name | Type | Mandatory | Description |
---|---|---|---|
symbol | STRING | YES | |
limit | STRING | NO | default 500, max 2000 |
interval | STRING | NO | allowed values [1m,5m,15m,30m,1h,2h,4h,6h,12h,1d,1w] |
startTime | LONG | NO | |
endTime | LONG | NO |
Order book
GET /sapi/v1/depth
curl --location --request GET 'https://api.wazirx.com/sapi/v1/depth?symbol=wrxinr&limit=5'
Response:
{
"lastUpdateAt": 1588831243,
"asks":[
[
"9291.0", // PRICE
"0.0119" // QTY
]
],
"bids":[
[
"9253.0", // PRICE
"1.0456" // QTY
]
]
}
Rate limit: 2 per second
Query Parameters:
Name | Type | Mandatory | Description |
---|---|---|---|
symbol | STRING | YES | |
limit | INT | NO | Default 20; max 1000. Valid limits:[1, 5, 10, 20, 50, 100, 500, 1000] |
Recent trades list
GET /sapi/v1/trades
curl --location --request GET 'https://api.wazirx.com/sapi/v1/trades?symbol=wrxinr&limit=10'
Response:
[
{
"id": 28457,
"price": "4.00000100",
"qty": "12.00000000",
"quoteQty": "48.000012",
"time": 1499865549590,
"isBuyerMaker": true
}
]
Get recent trades.
Rate limit: 1 per second
Query Parameters:
Name | Type | Mandatory | Description |
---|---|---|---|
symbol | STRING | YES | |
limit | INT | NO | Default 500; max 1000. |
Old trade lookup (MARKET_DATA)
GET /sapi/v1/historicalTrades
curl --location --request GET 'https://api.wazirx.com/sapi/v1/historicalTrades?limit=10&symbol=wrxinr&signature=e0***cb&recvWindow=10000×tamp=1632376801204' \
--header 'X-Api-Key: Ry***n0'
Response:
[
{
"id": 28457,
"price": "4.00000100",
"qty": "12.00000000",
"quoteQty": "48.000012",
"time": 1499865549590,
"isBuyerMaker": true
}
]
Get older trades.
Rate limit: 1 per second
Headers:
Name | Type | Mandatory | Description |
---|---|---|---|
X-API-KEY | STRING | YES |
Query Parameters:
Name | Type | Mandatory | Description |
---|---|---|---|
symbol | STRING | YES | |
limit | INT | NO | Default 500; max 1000. |
fromId | LONG | NO | TradeId to fetch from. Default gets most recent trades. |
Trading Endpoints
New order (TRADE)
POST /sapi/v1/order (HMAC SHA256)
curl --location --request POST 'https://api.wazirx.com/sapi/v1/order' \
--header 'X-Api-Key: Ry***n0' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'symbol=wrxinr' \
--data-urlencode 'side=buy' \
--data-urlencode 'type=limit' \
--data-urlencode 'price=500' \
--data-urlencode 'quantity=1' \
--data-urlencode 'recvWindow=10000' \
--data-urlencode 'timestamp=1632376923837' \
--data-urlencode 'signature=11***6f' \
--data-urlencode 'clientOrderId=clientOrderIdSampl12'
Response:
{
"id": 28,
"clientOrderId":"clientOrderIdSampl12",
"symbol": "wrxinr",
"price": "9293.0",
"origQty": "10.0",
"executedQty": "8.2",
"status": "wait",
"type": "limit",
"side": "sell",
"createdTime": 1499827319559,
"updatedTime": 1499827319559
}
Send in a new order.
Rate limit: 10 per second
Headers:
Name | Type | Mandatory | Description |
---|---|---|---|
X-API-KEY | STRING | YES |
Body Parameters:
Name | Type | Mandatory | Description |
---|---|---|---|
symbol | STRING | YES | |
side | ENUM | YES | |
type | ENUM | YES | limit or stop_limit |
quantity | DECIMAL | NO | |
price | DECIMAL | NO | |
stopPrice | DECIMAL | NO | |
clientOrderId | STRING | NO | A unique id among open orders. Automatically generated if not sent. |
recvWindow | LONG | NO | The value cannot be greater than 60000 |
timestamp | LONG | YES | |
signature | STRING | YES |
Additional mandatory parameters based on type
:
Type | Additional mandatory parameters |
---|---|
limit |
quantity , price |
stop_limit |
quantity , price , stopPrice |
Test new order (TRADE)
POST /sapi/v1/order/test (HMAC SHA256)
curl --location --request POST 'https://api.wazirx.com/sapi/v1/order/test' \
--header 'X-Api-Key: Ry***n0' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'symbol=wrxinr' \
--data-urlencode 'side=buy' \
--data-urlencode 'type=limit' \
--data-urlencode 'price=500' \
--data-urlencode 'quantity=1' \
--data-urlencode 'recvWindow=10000' \
--data-urlencode 'timestamp=1632376923837' \
--data-urlencode 'signature=11***6f'
Response:
{}
Test new order creation and signature/recvWindow long. Validates a new order but does not send it into the matching engine.
Rate limit: 2 per second
Headers:
Name | Type | Mandatory | Description |
---|---|---|---|
X-API-KEY | STRING | YES |
Body Parameters:
Same as POST /sapi/v1/order
Query order (USER_DATA)
GET /sapi/v1/order (HMAC SHA256)
curl --location --request GET 'https://api.wazirx.com/sapi/v1/order/?orderId=1234&clientOrderId=clientOrderIdSampl12&recvWindow=20000×tamp=1632377057552&signature=91***f0' \
--header 'X-Api-Key: Ry***n0'
Response:
{
"id": 30,
"clientOrderId":"clientOrderIdSampl12",
"symbol": "wrxinr",
"price": "9293.0",
"stopPrice": "9200.0",
"origQty": "10.0",
"executedQty": "0.0",
"status": "idle",
"type": "stop_limit",
"side": "sell",
"createdTime": 1499827319559,
"updatedTime": 1507725176595
}
Check an order's status.
Rate limit: 2 per second
Headers:
Name | Type | Mandatory | Description |
---|---|---|---|
X-API-KEY | STRING | YES |
Query Parameters:
Name | Type | Mandatory | Description |
---|---|---|---|
orderId | LONG | NO | |
clientOrderId | STRING | NO | A unique clientOrderId among open orders. |
recvWindow | LONG | NO | The value cannot be greater than 60000 |
timestamp | LONG | YES | |
signature | STRING | YES |
Current open orders (USER_DATA)
GET /sapi/v1/openOrders (HMAC SHA256)
curl --location --request GET 'https://api.wazirx.com/sapi/v1/openOrders?symbol=wrxinr&limit=2&recvWindow=20000×tamp=1632377102391&signature=a1***af' \
--header 'X-Api-Key: Ry***n0'
Response:
[
{
"id": 28,
"clientOrderId":"clientOrderIdSampl12",
"symbol": "wrxinr",
"price": "9293.0",
"origQty": "10.0",
"executedQty": "8.2",
"status": "wait",
"type": "limit",
"side": "sell",
"createdTime": 1499827319559,
"updatedTime": 1499827319559
},
{
"id": 30,
"clientOrderId":"clientOrderIdSampl123",
"symbol": "btcusdt",
"price": "9293.0",
"stopPrice": "9200.0",
"origQty": "10.0",
"executedQty": "0.0",
"status": "idle",
"type": "stop_limit",
"side": "sell",
"createdTime": 1499827319559,
"updatedTime": 1507725176595
}
]
Get all open orders on a symbol.
Rate limit: 1 per second
Headers:
Name | Type | Mandatory | Description |
---|---|---|---|
X-API-KEY | STRING | YES |
Query Parameters:
Name | Type | Mandatory | Description |
---|---|---|---|
symbol | STRING | NO | |
orderId | LONG | NO | |
startTime | LONG | NO | Fetch orders after this time |
endTime | LONG | NO | Fetch orders before this time |
recvWindow | LONG | NO | The value cannot be greater than 60000 |
timestamp | LONG | YES | |
signature | STRING | YES |
Notes:
- If the symbol is not sent, orders for all symbols will be returned in an array.
- If
orderId
is set, it will get orders >= thatorderId
. Otherwise most recent orders are returned.
All orders (USER_DATA)
GET /sapi/v1/allOrders (HMAC SHA256)
curl --location --request GET 'https://api.wazirx.com/uapi/v1/allOrders?symbol=wrxinr&orderId=1234&startTime=1590148051000&endTime=1590148051000&limit=100&recvWindow=20000×tamp=1632377355091&signature=Ot***' \
--header 'X-Api-Key: Ry***n0'
Response:
[
{
"id": 28,
"clientOrderId":"clientOrderIdSampl12",
"symbol": "wrxinr",
"price": "9293.0",
"origQty": "10.0",
"executedQty": "8.2",
"status": "cancel",
"type": "limit",
"side": "sell",
"createdTime": 1499827319559,
"updatedTime": 1499827319559
},
{
"id": 30,
"clientOrderId":"clientOrderIdSampl12",
"symbol": "wrxinr",
"price": "9293.0",
"stopPrice": "9200.0",
"origQty": "10.0",
"executedQty": "0.0",
"status": "cancel",
"type": "stop_limit",
"side": "sell",
"createdTime": 1499827319559,
"updatedTime": 1507725176595
}
]
Get all account orders; "idle", "wait", "cancel" or "done".
Rate limit: 1 per second
Headers:
Name | Type | Mandatory | Description |
---|---|---|---|
X-API-KEY | STRING | YES |
Query Parameters:
Name | Type | Mandatory | Description |
---|---|---|---|
symbol | STRING | YES | |
orderId | LONG | NO | |
startTime | LONG | NO | Fetch order after this time |
endTime | LONG | NO | Fetch order before this time |
limit | INT | NO | Default 500; max 1000. |
recvWindow | LONG | NO | The value cannot be greater than 60000 |
timestamp | LONG | YES | |
signature | STRING | YES |
Notes:
- If
orderId
is set, it will get orders >= thatorderId
. Otherwise most recent orders are returned.
Cancel order (TRADE)
DELETE /sapi/v1/order (HMAC SHA256)
curl --location --request DELETE 'https://api.wazirx.com/sapi/v1/order' \
--header 'X-Api-Key: Ry***n0' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'symbol=wrxinr' \
--data-urlencode 'orderId=1234' \
--data-urlencode 'clientOrderId=clientOrderIdSampl12' \
--data-urlencode 'recvWindow=20000' \
--data-urlencode 'timestamp=1632377448564' \
--data-urlencode 'signature=c2***17'
Response:
{
"id": 30,
"clientOrderId":"clientOrderIdSampl12",
"symbol": "wrxinr",
"price": "9293.0",
"origQty": "10.0",
"executedQty": "0.0",
"status": "wait",
"type": "limit",
"side": "sell",
"createdTime": 1499827319559,
"updatedTime": 1507725176595
}
Cancel an active order.
Rate limit: 10 per second
Headers:
Name | Type | Mandatory | Description |
---|---|---|---|
X-API-KEY | STRING | YES |
Body Parameters:
Name | Type | Mandatory | Description |
---|---|---|---|
symbol | STRING | YES | |
orderId | LONG | NO | |
clientOrderId | STRING | NO | A unique clientOrderId among open orders. |
recvWindow | LONG | NO | The value cannot be greater than 60000 |
timestamp | LONG | YES | |
signature | STRING | YES |
Cancel All Open Orders on a Symbol (TRADE)
DELETE /sapi/v1/openOrders (HMAC SHA256)
curl --location --request DELETE 'https://api.wazirx.com/sapi/v1/openOrders' \
--header 'X-Api-Key: Ry***n0' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'symbol=wrxinr' \
--data-urlencode 'recvWindow=20000' \
--data-urlencode 'timestamp=1632377515580' \
--data-urlencode 'signature=5f***5e'
Response:
[
{
"id": 28,
"clientOrderId":"clientOrderIdSampl12",
"symbol": "btcusdt",
"price": "9293.0",
"origQty": "10.0",
"executedQty": "8.2",
"status": "cancel",
"type": "limit",
"side": "sell",
"createdTime": 1499827319559,
"updatedTime": 1499827319559
},
{
"id": 30,
"clientOrderId":"clientOrderIdSampl12",
"symbol": "btcusdt",
"price": "9293.0",
"stopPrice": "9200.0",
"origQty": "10.0",
"executedQty": "0.0",
"status": "cancel",
"type": "stop_limit",
"side": "sell",
"createdTime": 1499827319559,
"updatedTime": 1507725176595
}
]
Cancels all active orders on a symbol.
Rate limit: 1 per second
Headers:
Name | Type | Mandatory | Description |
---|---|---|---|
X-API-KEY | STRING | YES |
Body Parameters:
Name | Type | Mandatory | Description |
---|---|---|---|
symbol | STRING | YES | |
recvWindow | LONG | NO | The value cannot be greater than 60000 |
timestamp | LONG | YES | |
signature | STRING | YES |
My Trades (TRADE)
GET sapi/v1/myTrades
curl --location --request GET 'https://api.wazirx.com/sapi/v1/myTrades?limit=10&symbol=wrxinrt&signature=5f***5e&orderId=22394630&recvWindow=10000×tamp=1632377515580' \
--header 'X-Api-Key: Ry***n0'
Response:
[
{
"id": 22394630,
"symbol": "wrxinr",
"fee": "32.40551116",
"feeCurrency": "inr",
"quoteQty": "16202.75558",
"price": "22.0",
"qty": "736.48889",
"orderId": 22394630,
"side": "buy",
"isBuyerMaker": true,
"time": 1634898186000
}
]
Get trades for a specific orderId and symbol.
Rate limit: 2 per second
Headers:
Name | Type | Mandatory | Description |
---|---|---|---|
X-API-KEY | STRING | YES |
Query Parameters:
Name | Type | Mandatory | Description |
---|---|---|---|
symbol | STRING | NO | |
orderId | LONG | NO | Fetch all trades for a given orderId |
fromId | LONG | NO | Fetch all trades after a given tradeId including the given tradeId |
limit | INT | NO | Default 500; max 1000. |
recvWindow | LONG | NO | The value cannot be greater than 60000 |
timestamp | LONG | YES | |
signature | STRING | YES | |
startTime | LONG | NO | Fetch trades after this time |
endTime | LONG | NO | Fetch trades before this time |
Wallet Endpoints
All Coins' Information (USER_DATA)
GET /sapi/v1/coins (HMAC SHA256)
curl --location --request GET 'https://api.wazirx.com/sapi/v1/coins?recvWindow=10000&signature=91***f0×tamp=1663323414556' \
--header 'X-Api-Key: Ry***n0'
Response:
[
{
"coin": "BTC",
"rapidListed": true,
"name": "Bitcoin",
"binanceTransferEnable": true,
"binanceTransferFee": "0.0000010",
"minBinanceTransfer": "0.0000020",
"networkList": [
{
"coin": "BTC",
"depositEnable": false,
"isDefault": false,
"confirmations": 1,
"name": "BEP2",
"network": "BNB",
"withdrawEnable": false,
"withdrawFee": "0.00000220",
"withdrawMax": "9999999999.99999999",
"withdrawMin": "0.00000440",
"memoRequired": true
},
{
"coin": "BTC",
"depositEnable": true,
"isDefault": true,
"confirmations": 1,
"name": "BTC",
"network": "BTC",
"withdrawEnable": true,
"withdrawFee": "0.00050000",
"withdrawIntegerMultiple": "0.00000001",
"withdrawMax": "750",
"withdrawMin": "0.00100000",
"memoRequired": false
}
]
}
]
Get information of coins (available for deposit and withdraw) for user.
Rate limit: 5 per minute
Headers:
Name | Type | Mandatory | Description |
---|---|---|---|
X-API-KEY | STRING | YES |
Query Parameters:
Name | Type | Mandatory | Description |
---|---|---|---|
recvWindow | LONG | NO | The value cannot be greater than 60000 |
timestamp | LONG | YES | |
signature | STRING | YES |
Withdraw History (supporting network) (USER_DATA)
GET /sapi/v1/crypto/withdraws (HMAC SHA256)
curl --location --request GET 'https://api.wazirx.com/sapi/v1/crypto/withdraws?recvWindow=10000&transferType=2×tamp=1663323414556&signature=91***f0&startTime=1660301719&endTime=1652263206&coin=btc&offset=1&limit=5' \
--header 'X-Api-Key: Ry***n0'
Response:
[
{
"binanceTransfer": false,
"address": "0x94df8b352de7f46f64b01d3666bf6e936e44ce60",
"amount": "8.91000000",
"createdAt": "2019-10-12 09:12:02",
"lastUpdated": "2019-10-12 11:12:02",
"coin": "USDT",
"id": "b6ae22b3aa844210a7041aee7589627c",
"withdrawOrderId": "WITHDRAWtest123",
"network": "ETH",
"status": 1,
"transactionFee": "0.004",
"failureInfo":"The address is not valid. Please confirm with the recipient",
"txId": "0xb5ef8c13b968a406cc62a93a8bd80f9e9a906ef1b3fcf20a2e48573c17659268"
},
{
"binanceTransfer": true,
"transactionFee": "0.004",
"amount": "8.91000000",
"createdAt": "2019-10-12 09:12:02",
"lastUpdated": "2019-10-12 11:12:02",
"coin": "USDT",
"id": "b6ae22b3aa844210a7041aee7589627c",
"withdrawOrderId": "WITHDRAWtest123",
"status": 1,
"failureInfo":"The address is not valid. Please confirm with the recipient",
},
{
"binanceTransfer": "true",
"transactionFee": "0.004",
"address": "1FZdVHtiBqMrWdjPyRPULCUceZPJ2WLCsB",
"amount": "0.00150000",
"createdAt": "2019-09-24 12:33:45",
"lastUpdated": "2019-09-24 12:43:45",
"coin": "BTC",
"id": "156ec387f49b41df8724fa744fa82719",
"network": "BTC",
"status": 0,
"transactionFee": "0.004",
"failureInfo":"",
"txId": "60fd9007ebfddc753455f95fafa808c4302c836e4d1eebc5a132c36c1d8ac354"
}
]
Fetch crypto withdraw history. This includes both onchain and offchain (binance) transactions.
Rate limit: 5 per minute
Headers:
Name | Type | Mandatory | Description |
---|---|---|---|
X-API-KEY | STRING | YES |
Query Parameters:
Name | Type | Mandatory | Description |
---|---|---|---|
coin | STRING | NO | |
transferType | INT | NO | 1 - only onchain withdrawas; 2 - only binance transfers |
withdrawOrderId | STRING | NO | client id for withdraw |
status | INT | NO | Success, Failed, Pending, Cancelled |
offset | INT | NO | |
limit | INT | NO | Default: 100, Max: 1000 |
startTime | LONG | NO | Default: 90 days from current timestamp |
endTime | LONG | NO | Default: present timestamp |
recvWindow | LONG | NO | The value cannot be greater than 60000 |
timestamp | LONG | YES | |
signature | STRING | YES |
Notes:
- If both startTime and endTime are sent, time between startTime and endTime must be less than 90 days
Deposit Address (supporting network) (USER_DATA)
GET /sapi/v1/crypto/deposits/address (HMAC SHA256)
curl --location --request GET 'https://api.wazirx.com/sapi/v1/crypto/deposits/address?recvWindow=10000&signature=91***f0×tamp=1663323414556&coin=btc&network=btc' \
--header 'X-Api-Key: Ry***n0'
Response:
{
"address": "1HP...89wv",
"coin": "BTC",
"tag": "",
"url": "https://btc.com/1HP...89wv"
}
Fetch deposit address with network.
Rate limit: 1 per minute
Headers:
Name | Type | Mandatory | Description |
---|---|---|---|
X-API-KEY | STRING | YES |
Query Parameters:
Name | Type | Mandatory | Description |
---|---|---|---|
coin | STRING | YES | |
network | STRING | YES | |
recvWindow | LONG | NO | The value cannot be greater than 60000 |
timestamp | LONG | YES | |
signature | STRING | YES |
Notes:
- You can get network from networkList in the response of GET /sapi/v1/coins (HMAC SHA256).
Account Endpoints
Account information (USER_DATA)
GET /sapi/v1/account (HMAC SHA256)
curl --location --request GET 'https://api.wazirx.com/sapi/v1/account?recvWindow=20000×tamp=1632377552095&signature=3c***e5' \
--header 'X-Api-Key: Ry***n0'
Response:
{
"accountType": "default",
"canTrade": true,
"canWithdraw": true,
"updateTime": 123456789
}
Get current account information.
Rate limit: 1 per second
Headers:
Name | Type | Mandatory | Description |
---|---|---|---|
X-API-KEY | STRING | YES |
Query Parameters:
Name | Type | Mandatory | Description |
---|---|---|---|
recvWindow | LONG | NO | The value cannot be greater than 60000 |
timestamp | LONG | YES | |
signature | STRING | YES |
Fund details (USER_DATA)
GET /sapi/v1/funds (HMAC SHA256)
curl --location --request GET 'https://api.wazirx.com/sapi/v1/funds?recvWindow=20000×tamp=1632377552095&signature=3c***e5' \
--header 'X-Api-Key: Ry***n0'
Response:
[
{
"asset": "btc",
"free": "4723846.89208129",
"locked": "0.0"
},
{
"asset": "wrx",
"free": "4763368.68006011",
"locked": "0.0",
"reservedFee": "12.5"
}
]
Get fund details for current account.
Rate limit: 1 per second
Headers:
Name | Type | Mandatory | Description |
---|---|---|---|
X-API-KEY | STRING | YES |
Query Parameters:
Name | Type | Mandatory | Description |
---|---|---|---|
recvWindow | LONG | NO | The value cannot be greater than 60000 |
timestamp | LONG | YES | |
signature | STRING | YES |
Sub-Account Endpoints
Transfer Funds
POST /sapi/v1/sub_account/fund_transfer (HMAC SHA256)
curl --location --request POST 'https://api.wazirx.com/sapi/v1/sub_account/fund_transfer' \
--header 'X-Api-Key: Ry***n0' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'amount=5' \
--data-urlencode 'currency=btc' \
--data-urlencode 'fromEmail=abc@abc.com' \
--data-urlencode 'toEmail=xyz@xyz.com' \
--data-urlencode 'recvWindow=10000' \
--data-urlencode 'signature=11***6f' \
--data-urlencode 'timestamp=1659607794977'
Response:
{
"status": "success",
"txnId": 163
}
- Transfer funds between the main account and a sub account.
- Can be initiated only from the parent account API key, not sub-account.
Headers:
Name | Type | Mandatory | Description |
---|---|---|---|
X-API-KEY | STRING | YES |
Body Parameters:
Name | Type | Mandatory | Description |
---|---|---|---|
currency | STRING | YES | |
amount | DECIMAL | YES | |
fromEmail | STRING | YES | |
toEmail | STRING | YES | |
recvWindow | LONG | NO | The value cannot be greater than 60000 |
timestamp | LONG | YES | |
signature | STRING | YES |
Get Transfer History
GET /sapi/v1/sub_account/fund_transfer/history (HMAC SHA256)
curl --location --request GET 'https://api.wazirx.com/sapi/v1/sub_account/fund_transfer/history?recvWindow=10000&signature=3c***e5×tamp=1672204922962' \
--header 'X-Api-Key: Ry***n0'
Response:
[
{
"asset": "wrx",
"from": "abc@abc.xom",
"qty": "1.2222",
"status": "success",
"time": 1672144988,
"to": "xyx@xyz.com",
"txnId": 200
},
{
"asset": "wrx",
"from": "xyx@xyz.com",
"qty": "1.2222",
"status": "success",
"time": 1672144812,
"to": "abc@abc.xom",
"txnId": 199
},
]
Fetch transfer history between main account and sub-accounts
Headers:
Name | Type | Mandatory | Description |
---|---|---|---|
X-API-KEY | STRING | YES |
Query Parameters:
Name | Type | Mandatory | Description |
---|---|---|---|
recvWindow | LONG | NO | The value cannot be greater than 60000 |
timestamp | LONG | YES | |
signature | STRING | YES |
Get Fund Details
GET /sapi/v1/sub_account/accounts (HMAC SHA256)
curl --location --request GET 'https://api.wazirx.com/sapi/v1/sub_account/accounts?recvWindow=20000&signature=3c***e5×tamp=1672204922962' \
--header 'X-Api-Key: Ry***n0'
Response:
[
{
"action": "Freeze",
"balance": [
{
"balance": "50.0",
"symbol": "inr"
}
],
"created_at": 1637757662,
"email": "abc@abc.com",
"emailVerification": "Completed",
"portfolio": "50.0",
"status": "Active"
},
{
"action": "Freeze",
"balance": [
{
"balance": "18.072",
"symbol": "wrx"
}
],
"created_at": 1637757677,
"email": "xyz@xyz.com",
"emailVerification": "Completed",
"portfolio": "162.648",
"status": "Active"
},
]
Get funds details of sub-accounts from parent account API key
Headers:
Name | Type | Mandatory | Description |
---|---|---|---|
X-API-KEY | STRING | YES |
Query Parameters:
Name | Type | Mandatory | Description |
---|---|---|---|
recvWindow | LONG | NO | The value cannot be greater than 60000 |
timestamp | LONG | YES | |
signature | STRING | YES |
Websocket Auth Tokens
Create Auth Token
POST /sapi/v1/create_auth_token (HMAC SHA256)
curl --location --request POST 'https://api.wazirx.com/sapi/v1/create_auth_token?recvWindow=20000×tamp=1632377552095&signature=3c***e5' \
--header 'X-Api-Key: Ry***n0'
Response:
{
"auth_key": "Xx***dM",
"timeout_duration": 900
}
Create your auth token for subscription to private socket streams. The stream will close after 30 minutes unless a ping
event is sent. If the account has an active auth_key
, the api will return the same auth_key
and its validity will be extended for another 30 minutes.
Rate limit: 1 per second
Headers:
Name | Type | Mandatory | Description |
---|---|---|---|
X-API-KEY | STRING | YES |
Query Parameters:
Name | Type | Mandatory | Description |
---|---|---|---|
recvWindow | LONG | NO | The value cannot be greater than 60000 |
timestamp | LONG | YES | |
signature | STRING | YES |
Websocket Market Streams
- The base endpoint is: wss://stream.wazirx.com/stream
- Streams can be accessed as a combined stream
- Combined stream events are wrapped as follows: {"event":"
","streams":[" "]} - A single connection to stream.wazirx.com is only valid for 30 minutes, expect to be disconnected at the 30 minutes mark
- The client will send a
ping frame
every 30 minutes. If the client does not receive apong frame
back from the connection within a 10 minute period, the connection will be disconnected.
Sample ping request
{"event":"ping"}
Sample pong response
{"data":{"timeout_duration":1800},"event":"pong","id":0}
Live Subscribing/Unsubscribing to streams
- The following data can be sent through the websocket instance in order to subscribe/unsubscribe from streams. Examples can be seen below.
- The
id
used in the JSON payloads is an unsigned INT used as an identifier to uniquely identify the messages going back and forth. - In the response, if the
result
received isnull
this means the request sent was a success.
Subscribe to public streams
{"event":"subscribe","streams":["!ticker@arr"]}
Subscribe to private streams
{"event":"subscribe","streams":["orderUpdate"], "auth_key": "***"}
Payload (same for both public and private):
{
"data":
{
"streams":
[
"!ticker@arr"
]
},
"event":"subscribed",
"id":0
}
Subscribe to a stream
Unsubscribing from any stream
{"event":"unsubscribe","streams":["!ticker@arr"]}
Payload:
{
"data":
{
"streams":
[
"!ticker@arr"
]
},
"event":"unsubscribed",
"id":0
}
Unsubscribe to a stream
Error Messages
Error Message | Description |
---|---|
{"data":{"code":400,"message":"Invalid request: streams must be an array"},"event":"error","id":0} | This is when key-pair is not valid |
{"data":{"code":401,"message":"Invalid request: unauthorized access"},"event":"error","id":0} | This is when your auth_key does not have access for a private stream |
{"data":{"code":400,"message":"Invalid request: unsupported method","id":0} | This is when method is not correct |
{"data":{"code":500,"message":"Invalid request: could not parse message","id":0} | This is when message cannot be parsed |
{"data":{"code":400,"message":"Invalid request: ID must be an unsigned integer","id":0} | This is when ID is invalid |
{"data":{"code":400,"message":"Invalid request: auth_key must be a string","id":0} | This is when auth_key is not a string |
{"data":{"code":429,"message":"Too many request: max streams subscription limit reached","id":0} | This is when limit reached of maximum requests |
Trade Streams
Request
{"event":"subscribe","streams":["btcinr@trades"]}
Payload:
{
"data":
{
"trades":
[
{
"E":1631681323000, // Event time
"S":"buy", // Side
"a":26946138, // Buyer order ID
"b":26946169, // Seller order ID
"m":true, // Is buyer maker?
"p":"7.0", // Price
"q":"15.0", // Quantity
"s":"btcinr", // Symbol
"t":17376030 // Trade ID
}
]
},
"stream":"btcinr@trades"
}
The Trade Streams push raw trade information; each trade has a unique buyer and seller.
Stream Name: <symbol>@trades
All Market Tickers Stream
Request
{"event":"subscribe","streams":["!ticker@arr"]}
Payload:
{
"data":
[
{
"E":1631625534000, // Event time
"T":"SPOT", // Type
"U":"wrx", // Quote unit
"a":"0.0", // Best sell price
"b":"0.0", // Best buy price
"c":"5.0", // Last price
"h":"5.0", // High price
"l":"5.0", // Low price
"o":"5.0", // Open price
"q":"0.0", // Quantity
"s":"btcwrx", // Symbol
"u":"btc" // Base unit
}
],
"stream":"!ticker@arr"
}
24hr rolling window ticker statistics for all symbols that changed in an array. These are NOT the statistics of the UTC day, but a 24hr rolling window for the previous 24hrs. Note that only tickers that have changed will be present in the array.
Stream Name: !ticker@arr
Kline/Candlestick Stream
Request
{"event":"subscribe","streams":["btcinr@kline_1m"]}
Payload:
{
"data": {
"E":1631683058904, // Event time
"s": "btcinr", // Symbol
"t": 1638747660000, // Kline start time
"T": 1638747719999, // Kline close time
"i": "1m", // Interval
"o": "0.0010", // Open price
"c": "0.0020", // Close price
"h": "0.0025", // High price
"l": "0.0015", // Low price
"v": "1000", // Base asset volume
},
"stream": "btcinr@kline_1m"
}
The Kline/Candlestick Stream pushes update of current klines/candlestick every few second.
Kline intervals:
Key | Value |
---|---|
m | Minutes |
h | Hours |
d | Days |
w | Weeks |
M | Months |
Stream Name: <symbol>@kline_<interval>
Update Speed: 5 seconds
Depth Stream
Request
{"event":"subscribe","streams":["btcinr@depth"]}
Payload:
{
"data":
{
"E":1631682370000, // Event time
"a": [ // Asks to be updated
[
"10.0", // Price level to be updated
"75.0" // Quantity
]
],
"b": [ // Bids to be updated
[
"6.0", // Price level to be updated
"50.0" // Quantity
]
],
"s":"btcinr" // Symbol
},
"stream":"btcinr@depth"
}
Order book price and quantity depth updates.
Stream Name: <symbol>@depth
Update Speed: 3 seconds, or 10 seconds if no changes in the order book.
Partial Depth Stream
Request
{"event":"subscribe","streams":["btcinr@depth10@100ms"]}
Payload:
{
"data":
{
"E":1631682370000, // Event time
"a": [ // Asks to be updated
[
"10.0", // Price level to be updated
"75.0" // Quantity
],
...
],
"b": [ // Bids to be updated
[
"6.0", // Price level to be updated
"50.0" // Quantity
],
...
],
"s":"btcinr" // Symbol
},
"stream":"btcinr@depth10@100ms"
}
Order book price and quantity depth updates.
Supported levels - 5, 10 or 20.
Stream Name: <symbol>@depth<level>@100ms
Update Speed: 100 ms
Account Update
Request
{"event":"subscribe","streams":["outboundAccountPosition"], "auth_key":"***"}
Payload:
{
"data":
{
"B": [ // Balances Array
{
"a":"wrx", // Asset
"b":"2043856.426455209", // Free
"l":"3001318.98" // Locked
}
],
"E":1631683058909 // Event time
},
"stream":"outboundAccountPosition"
}
outboundAccountPosition
is sent any time an account balance has changed and contains the assets that were possibly changed by the event that generated the balance change.
Stream Name: outboundAccountPosition
Requires: auth_key
Order Update
Request
{"event":"subscribe","streams":["orderUpdate"], "auth_key":"***"}
Payload:
{
"data":
{
"E":1631683058904, // Event time
"O":1631683058000, // Updated time
"S":"sell", // Kind
"V":"70.0", // Original volume
"X":"wait", // State
"i":26946170, // Order ID
"c":"my_clientorder_1", // Client Order ID
"m":true, // Is market maker?
"o":"limit", // Type
"p":"5.0", // Price
"q":"70.0", // Balance Volume
"s":"wrxinr", // Symbol
"v":"0.0" // Average price
"z":"0.0" // Filled Volume
},
"stream":"orderUpdate"
}
Orders are updated with the orderUpdate
event.
Stream Name: orderUpdate
Requires: auth_key
Trade Update
Request
{"event":"subscribe","streams":["ownTrade"], "auth_key":"***"}
Payload:
{
"data":
{
"E":1631683058000, // Event time
"S":"ask", // Kind
"U":"inr", // Fee currency
"a":114144050, // Seller ID
"b":114144121, // Buyer ID
"f":"0.2", // Fee
"m":true, // Is market maker?
"o":26946170, // Order ID
"c":"my_clientorder_1", // Client Order ID
"p":"5.0", // Price
"q":"20.0", // Quantity
"s":"btcinr", // Symbol
"t":17376032, // Trade ID
"w":"100.0" // Funds
},
"stream":"ownTrade"
}
Trades are updated with the ownTrade
event.
Stream Name: ownTrade
Requires: auth_key