NAV
shell

Introductions

Bitmax provides some RESTful API for developers that allows developers to access and manage orders.To access the APIs, you must first enter to your profile settings and create the API key and security key. Remember These keys never expire, So it's better to revoke them if you don't need them

Authentication

Request:

curl --location --request GET 'https://api.bitmax.ir/any..
--header 'Authorization: Basic nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEJ6OY97LuO1NgEEtd9u85mYUNo3SADvU6zL/MpAOKVZwPa4a3po3B7f5k0zWliZC4TWHqMOY2W3tnPtyKXYbI7Q

encoding your api and secret key with this format: base64(api key:secretkey) <-- this is your basic token now

Add Authorization key in header and set your token for example:

Authorization: Basic nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEJ6OY97LuO1NgEEtd9u85mYUNo3SADvU6zL/MpAOKVZwPa4a3po3B7f5k0zWliZC4TWHqMOY2W3tnPtyKXYbI7Q

Public

Request:

curl --location --request GET "https://api.bitmax.ir/coins/market/"

This endpoint retrieve all the markets for the client

GET 'https://api.bitmax.ir/market/

Request: shell curl --location --request GET 'https://api.bitmax.ir/otc/swap/' This endpoint retrieve all swap pairs

Request: shell curl --location --request POST 'https://api.bitmax.ir/otc/swap/preorder' \ --header 'Content-Type: application/json' \ --data-raw '{ "from_symbol" : "USDT", "to_symbol": "IRT", "amount": 10 }' This endpoint send you a preorder_id and price

Private

To see your open orders

Request:

curl --location --request GET 'https://api.bitmax.ir/order/api/order/{market}
--header 'Authorization: Basic nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEJ6OY97LuO1NgEEtd9u85mYUNo3SADvU6zL/MpAOKVZwPa4a3po3B7f5k0zWliZC4TWHqMOY2W3tnPtyKXYbI7Q

Response:

[
    {
    "error": false,
    "message": [
        {
            "amount": 0.2,
            "average_price": 0,
            "created_at": "2022-04-23 10:52:56.641901+00:00",
            "currency": "USDT",
            "fee": 0.0,
            "filed_amount": 0.0,
            "id": 167,
            "market": "BTC-USDT",
            "order_id": 167,
            "price": 39650.0,
            "side": "BID",
            "status": "OPEN",
            "symbol": "BTC",
            "total": 0,
            "type": "LIMIT",
            "updated_at": null,
            "user_id": 296
        }
    ],
    "number": 1
}]

GET 'https://api.bitmax.ir/order/api/order/market

to add new orders

Request

curl --location --request POST 'https://api.bitmax.ir/order/api/order/{market}' \
--header 'Authorization: Basic your basic token' \
--header 'Content-Type: application/json' \
--data-raw '{
  "amount": 0,
  "price": 0,
  "side": "BID",
  "type": "LIMIT"
}'
[
    {
    "error": false,
    "message": [],
    "number": null
}]

post 'https://api.bitmax.ir/order/api/order/market

Response 200 ok

to cancel your open order

Request

curl --location --request DELETE 'https://api.bitmax.ir/order/api/order/{market}' \
--header 'Authorization: Basic your basic token' \
--header 'Content-Type: application/json' \
--data-raw '{
  "order_id": 0
}'

Response 200 ok

[
    {
    "error": false,
    "message": [],
    "number": null
}]

delet 'https://api.bitmax.ir/order/api/order/market

url path

path Description
market The market you want to see open orders for example BTC-USDT.

Swap API:

for create pre order >>>

curl --location --request POST 'https://api.bitmax.ir/otc/api/swap/preorder' \
--header 'Authorization: Basic YjgwNDFlZGRhNjFiOGQxMDAwOWJmNmIxNTMwZGMwZDVmNGJlMmNhZDBlYWMxMTFiOjE1MjE1NmNmODAzN2M2YjE2YTZhNjIwNjhlYWM3MjJiNDk3OWQ0MmIyODdhODUwODZiYmZiZjVkZGY2ZDQzYTk=' \
--header 'Content-Type: application/json' \
--data-raw '{
    "from_symbol": "USDT",
    "to_symbol": "IRT",
    "amount": 10
}'

for commit order

curl --location --request POST 'https://api.bitmax.ir/otc/api/swap/commit' \
--header 'Authorization: Basic YjgwNDFlZGRhNjFiOGQxMDAwOWJmNmIxNTMwZGMwZDVmNGJlMmNhZDBlYWMxMTFiOjE1MjE1NmNmODAzN2M2YjE2YTZhNjIwNjhlYWM3MjJiNDk3OWQ0MmIyODdhODUwODZiYmZiZjVkZGY2ZDQzYTk=' \
--header 'Content-Type: application/json' \
--data-raw '{
    "preorder_id": "db7a7700-1c9b-48c9-8f12-dd4246810ef5",
    "amount": 100
}'

for get all swap>>>

curl --location --request GET 'https://api.bitmax.ir/otc/swap/

Websocket

connecting

Connection to public and private channels are available through the path wss://api.bitmax.ir/ws/ws Websocket connections will disconnect if a message is not sent within 20 seconds. To keep a connection alive, you can sent a ping message every ~10 seconds.

ping message format: ‍{"event":"ping","data":""}‍

Response:

{"M":[
      {"id":"DOT-USDT",
       "lp":5.394605394605396,
       "pp":-2.43,"cu":"USDT",
       "n":{"en":"Dot/تتر",
            "fa":"پولکادات/تتر"}
        },
       {"id":"LINK-USDT",
        "lp":6.331668331668332,
        "pp":5.49,"cu":"USDT",
         "n":{"en":"ChainLink/Tether",
         "fa":"چین لینک/تتر"}
         }]
 "m":[ 
          {"n": "BTC-USDT"
           "a":{
                "p": "16474.98853",
                "a": "0.00062"
                }
           "b":{
                "p": "16440.119880119884",
                "a": "0.06592"
                }
           "f":{
                "p": "16440.119880119884",
                "a": "0.06592",
                "t": "1669184014",
                "s": "b"
                }
           "s": {
                "sa24": "16440.119880119884",
                "sp24": "194918.73436371484",
                "mip24": "15708.352659999999",
                "map24": "16587.230659999997",
                "lo": "16469.26281",
                "pp": "0.045"
                }
         }
  ]
}

response guid

parametr Description
M key of markets
id market id
lp last price
pp price persent change
n name in en and fa language
m key of market detail
a In the market detail means ask
b In the market detail means bids
f In the market detail means Filled
s In the market detail means market stat
p price
a amount
t Time
s Side
sa24 Sum of the amount in the last 24 hours
sp24 Sum of the price in the last 24 hours
mip24 Minimum of the price in the last 24 hours
map24 Maximum of the price in the last 24 hours
lo Last Order Price

Sending/Receiving Messages

Receive :

{"m":[ 
          {"n": "BTC-USDT"
           "a":{
                "p": "16474.98853",
                "a": "0.00062"
                }
           "b":{
                "p": "16440.119880119884",
                "a": "0.06592"
                }
           "f":{
                "p": "16440.119880119884",
                "a": "0.06592",
                "t": "1669184014",
                "s": "b"
                }
           "s": {
                "sa24": "16440.119880119884",
                "sp24": "194918.73436371484",
                "mip24": "15708.352659999999",
                "map24": "16587.230659999997",
                "lo": "16469.26281",
                "pp": "0.045"
                }
         }
  ]
}

After connecting to the socket, market information including market ID, latest price, price change percentage, currency and market name and BTC-USDT market details will be sent to you by default.

To get the details of the markets, you need to send a message in the following format in the socket:

{"event":"market","data":" market_id"}

for example : {"event":"market","data":"BTC-USDT"}

Error

Error code Meaning
1940090017 You can not do this action with this kyc level
1940490003 market not found
1940490001 order not found
1940490008 can not cancel order
400 Bad Request -- Your request is invalid.
403 Unauthorized/Forbidden -- Your api key or secret key is not valid.
404 Not Found -- The specified request could not be found.
405 Method Not Allowed -- You tried to access a request with an invalid method.
410 Gone -- The request has been removed from our servers.
429 Too Many Requests -- You're requesting too many requests! Slow down!
500 Internal Server Error -- We had a problem with our server. Try again later.
503 Service Unavailable -- We're temporarily offline for maintenance. Please try again later.