> ## Documentation Index
> Fetch the complete documentation index at: https://docs.monochrome.exchange/llms.txt
> Use this file to discover all available pages before exploring further.

# Endpoints

> Third-party OAuth API: endpoints.

## User Registration

If you do not have a Monochrome account, please register in advance, register address：`http(s)://{URL}/{language}/accounts/register?client_id={clientId}` **Parameter** **1. URL** The domain name of the Monochrome authorization page, the official environment is: [www.monochrome.exchange](http://www.monochrome.exchange) **2. language** Authorization page language, the currently supported content is as follows： en：English ja：Japanese hi：Hindi id：Indonesian ru：Russian es：spanish tr：turkish zh-HK：traditional Chinese zh-CN：Simplified Chinese vi：vietnamese th：Thai **3. clientId** The unique identification of the organization, please apply to Monochrome in advance **For Example:** [http://www.monochrome.exchange/en/accounts/register?client\_id=DDJ7BLK49YUCL97S](http://www.monochrome.exchange/en/accounts/register?client_id=DDJ7BLK49YUCL97S) Users registered through this url will belong to the institution:DDJ7BLK49YUCL97S

## Authorization Link

When the third-party platform requires Monochrome users to authorize certain operations, please jump from the third-party platform page to `http(s)://{URL}/{language}/accounts/oauth2?response_type=code&client_id={clientId}&redirect_uri={redirectUri}&scope={scope}`
**Parameter**
**1. URL**
The domain name of the Monochrome authorization page, the official environment is: [www.monochrome.exchange](http://www.monochrome.exchange)
**2. language**
Authorization page language, the currently supported content is as follows：
en：English
ja：Japanese
hi：Hindi
id：Indonesian
ru：Russian
es：spanish
tr：turkish
zh-HK：traditional Chinese
zh-CN：Simplified Chinese
vi：vietnamese
th：Thai
**3. clientId**
The unique identification of the organization, please apply to Monochrome in advance
**4. redirectUri**
The redirected address after successful authorization
**5. scope**
Authorization scope, obtained from Monochrome together with clientId
**For example:**
[http://www.monochrome.exchange/zh-CN/accounts/oauth2?response\_type=code\&client\_id=DDJ7BLK49YUCL97S\&redirect\_uri=https%3A%2F%2Fwww.baidu.com\&scope=userinfo](http://www.monochrome.exchange/zh-CN/accounts/oauth2?response_type=code\&client_id=DDJ7BLK49YUCL97S\&redirect_uri=https%3A%2F%2Fwww.baidu.com\&scope=userinfo)

## Apply Token

`GET` `/public/uaa/oauth2/token?client_id={client_id}&client_secret=${client_secret}&grant_type={grant_type}&code={code}`

**Parameters**

| Parameter | Type | mandatory | Default | Description | Ranges |
| - | - | - | - | - | - |
| client\_id | string | true | | Institutional identity | Please apply to Monochrome |
| client\_secret | string | true | | Institutional Secret Key | Please apply to Monochrome |
| grant\_type | string | true | | authorization type, fixed value | authorization\_code |
| code | string | true | | The user is redirected to the institution page after authorization, and the code field will be carried in the url | |

```json Response theme={null}
{
    "rc": 0,
    "mc": "SUCCESS",
    "ma": [],
    "result": {
        "user_id":"12345678",
        "access_token": "eyJhbGciOiJSUzI1NiJ9.eyJzdWIiOiIxIiwidXNlci1pZCI6MSwic2NvcGUiOiJ1c2VyaW5mbyIsImlzcyI6Inh0LmNvbSIsImV4cCI6MTY5MTU2MTA3NiwiY2xpZW50X2lkIjoiMzVMRjJGU0xIWDVJUlFBNCJ9.vkSTiFLcQuO0qJqdm21MfmoLKb38wwhsKPCJI3x1xmOxYouH5GtmcYglk0XRxPeOMVZ-6E6tM3HGn1yMQdqTgHOVeAbtLSBBIqyUh6y-8j_MF8GyBwcEaRK2hfWBNOHw06B-0jLO_mKEduUWZXYHjNiAN2jenbj7Ba6MX7rcENk",//Token used to access the authorization interface.The default validity period is one day
        "refresh_token": "eyJhbGciOiJSUzI1NiJ9.eyJzdWIiOiIxIiwidXNlci1pZCI6MSwic2NvcGUiOiJ1c2VyaW5mbyIsImlzcyI6Inh0LmNvbSIsImV4cCI6MTY5NDE1MzA3NiwiY2xpZW50X2lkIjoiMzVMRjJGU0xIWDVJUlFBNCJ9.UIeGGDiiybfEUEPFAteN3TtCxz5PyZxGDIULaNJjO3mCck7s28nRpXWSxONMGYMXG03XxJVUJs5WfdpNEmKUmmoQQuy-UOCuvV7zLdFmwUHd5e5tDMA7mgTCxbCeyxYE4L8Vr8StEEhxwWbDFxG_-2wdNEgEIvlgg9bI87Qcy9s",//The token used to refresh the access token.The default validity period is 180 days
        "expires_in": 15551999,//The number of milliseconds before the access_token expires
        "refresh_expires_in": 18143999,//The number of milliseconds before refresh_token expires
        "client_id": "35LF2FSLHX5IRQA4",//Institutional identity
        "scope": "userinfo"//authorized scope
    }
}
```

## Refresh Token

`GET` `/public/uaa/oauth2/token?client_id={client_id}&client_secret=${client_secret}&grant_type={grant_type}&refresh_token={refresh_token}`

**Parameters**

| Parameter | Type | mandatory | Default | Description | Ranges |
| - | - | - | - | - | - |
| client\_id | string | true | | Institutional identity | Please apply to Monochrome |
| client\_secret | string | true | | Institutional Secret Key | Please apply to Monochrome |
| grant\_type | string | true | | authorization type, fixed value | refresh\_token |
| refresh\_token | string | true | | The refresh\_token field returned when applying for token | |

```json Response theme={null}
{
    "rc": 0,
    "mc": "SUCCESS",
    "ma": [],
    "result": {
        "user_id":"12345678",
        "access_token": "eyJhbGciOiJSUzI1NiJ9.eyJzdWIiOiIxIiwidXNlci1pZCI6MSwic2NvcGUiOiJ1c2VyaW5mbyIsImlzcyI6Inh0LmNvbSIsImV4cCI6MTY5MTU2MTA3NiwiY2xpZW50X2lkIjoiMzVMRjJGU0xIWDVJUlFBNCJ9.vkSTiFLcQuO0qJqdm21MfmoLKb38wwhsKPCJI3x1xmOxYouH5GtmcYglk0XRxPeOMVZ-6E6tM3HGn1yMQdqTgHOVeAbtLSBBIqyUh6y-8j_MF8GyBwcEaRK2hfWBNOHw06B-0jLO_mKEduUWZXYHjNiAN2jenbj7Ba6MX7rcENk",//token used to access the authorization interface
        "refresh_token": "eyJhbGciOiJSUzI1NiJ9.eyJzdWIiOiIxIiwidXNlci1pZCI6MSwic2NvcGUiOiJ1c2VyaW5mbyIsImlzcyI6Inh0LmNvbSIsImV4cCI6MTY5NDE1MzA3NiwiY2xpZW50X2lkIjoiMzVMRjJGU0xIWDVJUlFBNCJ9.UIeGGDiiybfEUEPFAteN3TtCxz5PyZxGDIULaNJjO3mCck7s28nRpXWSxONMGYMXG03XxJVUJs5WfdpNEmKUmmoQQuy-UOCuvV7zLdFmwUHd5e5tDMA7mgTCxbCeyxYE4L8Vr8StEEhxwWbDFxG_-2wdNEgEIvlgg9bI87Qcy9s",//The token used to refresh the access token
        "expires_in": 15551999,//The number of milliseconds before the access_token expires
        "refresh_expires_in": 18143999,//The number of milliseconds before refresh_token expires
        "client_id": "35LF2FSLHX5IRQA4",//Institutional identity
        "scope": "userinfo"//authorized scope
    }
}
```

## Create apiKey

`POST` `/user/account/api-key`

```json Response theme={null}
{
  "rc": 0,
  "mc": "SUCCESS",
  "ma": [
    {}
  ],
  "result": {
     "userId": 12345678,                                        //user id
     "accessKey": "99258227-f053-46a2-9b10-66c155eb705c",       //encryption key
     "secretKey": "4b1839e11bf7a1c6de5f078bd9f4b6e0850da3cf"    //encryption string
  }
}
```

## Get single

`GET` `/spot/v4/order/{orderId}`

**Parameters**

| Parameter | Type | mandatory | Default | Description | Ranges |
| - | - | - | - | - | - |
| orderId | number | true | | | |

```json Response theme={null}
{
  "rc": 0,
  "mc": "string",
  "ma": [
    {}
  ],
  "result": {
    "symbol": "BTC_USDT",   
    "orderId": "6216559590087220004",  
    "clientOrderId": "16559590087220001",  
    "baseCurrency": "string",   
    "quoteCurrency": "string",   
    "side": "BUY",                          //order side:BUY,SELL
    "type": "LIMIT",                        //order type  LIMIT,MARKET 
    "timeInForce": "GTC",                   //effective way:GTC,IOC,FOK,GTX
    "price": "40000",   
    "origQty": "2",                         //original quantity
    "origQuoteQty": "48000",                //original amount
    "executedQty": "1.2",                   //executed quantity
    "leavingQty": "string",                 //The quantity to be executed (if the order is cancelled or the order is rejected, the value is 0)
    "tradeBase": "2",                       //transaction quantity
    "tradeQuote": "48000",                  //transaction amount
    "avgPrice": "42350",                    //average transaction price
    "fee": "string",                        //handling fee
    "feeCurrency": "string",   
    "state": "NEW",                         //order stat NEW,PARTIALLY_FILLED,FILLED,CANCELED,REJECTED,EXPIRED
    "time": 1655958915583,                  //order time
    "updatedTime": 1655958915583  
  }
}
```

## Query single

`GET` `/spot/v4/order`

**Parameters**

| Parameter | Type | mandatory | Default | Description | Ranges |
| - | - | - | - | - | - |
| orderId | number | false | | | |
| clientOrderId | string | false | | | |

```json Response theme={null}
{
  "rc": 0,
  "mc": "string",
  "ma": [
    {}
  ],
  "result": {
    "symbol": "BTC_USDT",   
    "orderId": "6216559590087220004",  
    "clientOrderId": "16559590087220001",  
    "baseCurrency": "string",   
    "quoteCurrency": "string",   
    "side": "BUY",                      //order side:BUY,SELL
    "type": "LIMIT",                    //order type  LIMIT,MARKET 
    "timeInForce": "GTC",               //effective way:GTC,IOC,FOK,GTX
    "price": "40000",   
    "origQty": "2",                     //original quantity
    "origQuoteQty": "48000",            //original amount
    "executedQty": "1.2",               //executed quantity
    "leavingQty": "string",             //The quantity to be executed (if the order is cancelled or the order is rejected, the value is 0)
    "tradeBase": "2",                   //transaction quantity
    "tradeQuote": "48000",              //transaction amount
    "avgPrice": "42350",                //average transaction price
    "fee": "string",                    //handling fee
    "feeCurrency": "string",   
    "state": "NEW",                     //order stat NEW,PARTIALLY_FILLED,FILLED,CANCELED,REJECTED,EXPIRED
    "time": 1655958915583,              //order time
    "updatedTime": 1655958915583  
  }
}
```

## Submit order

`POST` `/spot/v4/order`

**Parameters**

| Parameter | Type | mandatory | Default | Description | Ranges |
| - | - | - | - | - | - |
| symbol | string | true | | | |
| clientOrderId | string | false | | Pattern: ^\[a-zA-Z0-9\_]\{4,32}\$ | |
| side | string | true | | BUY,SELL | |
| type | string | true | | order type:LIMIT,MARKET | |
| timeInForce | string | true | | effective way:GTC, FOK, IOC, GTX | |
| bizType | string | true | | SPOT, LEVER | |
| price | number | false | | price. Required if it is the LIMIT price; blank if it is the MARKET price | |
| quantity | number | false | | quantity. Required if it is the LIMIT price or the order is placed at the market price by quantity | |
| quoteQty | number | false | | amount. Required if it is the LIMIT price or the order is the market price when placing an order by amount | |

### Remark

Create a BUY order based on market price, quantity must be null, quoteQty required; Create a SELL order based on market price, quoteQty must be null, quantity required.

### Limit Flow Rules

20/s/apikey

```json Response theme={null}
{
  "rc": 0,
  "mc": "string",
  "ma": [
    {}
  ],
  "result": {
    "orderId": "6216559590087220004"  
  }
}
```

## Cancell order

`DELETE` `/spot/v4/order/{orderId}`

**Parameters**

| Parameter | Type | mandatory | Default | Description | Ranges |
| - | - | - | - | - | - |
| orderId | number | true | | | |

```json Response theme={null}
{
  "rc": 0,
  "mc": "string",
  "ma": [
    {}
  ],
  "result": {
    "cancelId": "6216559590087220004"
  }
}
```

## Get batch

`GET` `/spot/v4/batch-order`

**Parameters**

| Parameter | Type | mandatory | Default | Description | Ranges |
| - | - | - | - | - | - |
| orderIds | string | true | | order Ids eg: 6216559590087220004, 6216559590087220004 | |

reponse field information, refer to the Get single interface

```json Response theme={null}
{
  "rc": 0,
  "mc": "string",
  "ma": [
    {}
  ],
  "result": [
    {
      "symbol": "BTC_USDT",
      "orderId": "6216559590087220004",
      "clientOrderId": "16559590087220001",
      "baseCurrency": "string",
      "quoteCurrency": "string",
      "side": "BUY",
      "type": "LIMIT",
      "timeInForce": "GTC",
      "price": "40000",
      "origQty": "2",
      "origQuoteQty": "48000",
      "executedQty": "1.2",
      "leavingQty": "string",
      "tradeBase": "2",
      "tradeQuote": "48000",
      "avgPrice": "42350",
      "fee": "string",
      "feeCurrency": "string",
      "state": "NEW",
      "time": 1655958915583,
      "updatedTime": 1655958915583
    }
  ]
}
```

## Cancell batch order

`DELETE` `/spot/v4/batch-order`

**Parameters**

| Parameter | Type | mandatory | Default | Description | Ranges |
| - | - | - | - | - | - |
| clientBatchId | string | false | | client batch id | |
| orderIds | array | true | | 6216559590087220004, 6216559590087220005 | |

Note: The parameters should be placed in the request body in the form of json

```json Response theme={null}
{
  "rc": 0,
  "mc": "string",
  "ma": [
    {}
  ],
  "result": {}
}
```

## Query the current pending order

`GET` `/spot/v4/open-order`

**Parameters**

| Parameter | Type | mandatory | Default | Description | Ranges |
| - | - | - | - | - | - |
| symbol | string | false | | Trading pair, if not filled in, represents all | |
| bizType | string | false | | SPOT, LEVER | |
| side | string | false | | BUY,SELL | |

### Limit Flow Rules

10/s/apikey

```json Response theme={null}
{
  "rc": 0,
  "mc": "string",
  "ma": [
    {}
  ],
  "result": [      //For field information, refer to the Get single interface
    {
      "symbol": "BTC_USDT",
      "orderId": "6216559590087220004",
      "clientOrderId": "16559590087220001",
      "baseCurrency": "string",
      "quoteCurrency": "string",
      "side": "BUY",
      "type": "LIMIT",
      "timeInForce": "GTC",
      "price": "40000",
      "origQty": "2",
      "origQuoteQty": "48000",
      "executedQty": "1.2",
      "leavingQty": "string",
      "tradeBase": "2",
      "tradeQuote": "48000",
      "avgPrice": "42350",
      "fee": "string",
      "feeCurrency": "string",
      "state": "NEW",
      "time": 1655958915583,
      "updatedTime": 1655958915583
    }
  ]
}
```

## Cancel the current pending order

`DELETE` `/spot/v4/open-order`

**Parameters**

| Parameter | Type | mandatory | Default | Description | Ranges |
| - | - | - | - | - | - |
| symbol | string | true | | Trading pair, if not filled in, represents all | |
| bizType | string | true | | SPOT, LEVER | |
| side | string | true | | BUY,SELL | |

### Limit Flow Rules

10/s/apikey Note: The parameters should be placed in the request body in the form of json

```json Response theme={null}
{
  "rc": 0,
  "mc": "string",
  "ma": [
    {}
  ],
  "result": {}
}
```

## Query historical orders

`GET` `/spot/v4/history-order`

**Parameters**

| Parameter | Type | mandatory | Default | Description | Ranges |
| - | - | - | - | - | - |
| symbol | string | false | | Trading pair, if not filled in, represents all | |
| bizType | string | false | | SPOT, LEVER | |
| side | string | false | | BUY,SELL | |
| type | string | false | | LIMIT, MARKET | |
| state | string | false | | order [state](#orderStatus), PARTIALLY\_FILLED, FILLED, CANCELED, REJECTED,EXPIRED | |
| fromId | number | false | | start id | |
| direction | string | false | | query direction:PREV, NEXT | |
| limit | number | false | 20 | Limit number, max 100 | |
| startTime | number | false | | eg:1657682804112 | |
| endTime | number | false | | | |
| hiddenCanceled | bool | false | | | |

### Limit Flow Rules

10/s/apikey

```json Response theme={null}
{
  "rc": 0,
  "mc": "string",
  "ma": [
    {}
  ],
  "result": {
    "hasPrev": true,
    "hasNext": true,
    "items": [   //For field information, refer to the Get single interface
      {
        "symbol": "BTC_USDT",
        "orderId": "6216559590087220004",
        "clientOrderId": "16559590087220001",
        "baseCurrency": "string",
        "quoteCurrency": "string",
        "side": "BUY",
        "type": "LIMIT",
        "timeInForce": "GTC",
        "price": "40000",
        "origQty": "2",
        "origQuoteQty": "48000",
        "executedQty": "1.2",
        "leavingQty": "string",
        "tradeBase": "2",
        "tradeQuote": "48000",
        "avgPrice": "42350",
        "fee": "string",
        "feeCurrency": "string",
        "state": "NEW",
        "time": 1655958915583,
        "updatedTime": 1655958915583
      }
    ]
  }
}
```

## Query trade

`GET` `/spot/v4/trade`

**Parameters**

| Parameter | Type | mandatory | Default | Description | Ranges |
| - | - | - | - | - | - |
| symbol | string | false | | Trading pair, if not filled in, represents all | |
| bizType | string | false | | SPOT, LEVER | |
| orderSide | string | false | | BUY,SELL | |
| orderType | string | false | | LIMIT, MARKET | |
| orderId | number | false | | | |
| fromId | number | false | | start id | |
| direction | string | false | | query direction:PREV, NEXT | |
| limit | number | false | 20 | Limit number, max 100 | |
| startTime | number | false | | start time eg:1657682804112 | |
| endTime | number | false | | | |

```json Response theme={null}
{
  "rc": 0,
  "mc": "string",
  "ma": [
    {}
  ],
  "result": {
    "hasPrev": true,
    "hasNext": true,
    "items": [
      {
        "symbol": "BTC_USDT",  
        "tradeId": "6316559590087222001",  
        "orderId": "6216559590087220004",  
        "orderSide": "BUY",    
        "orderType": "LIMIT",  
        "bizType": "SPOT",    
        "time": 1655958915583,  
        "price": "40000",     
        "quantity": "1.2",    
        "quoteQty": "48000",   //amount
        "baseCurrency": "BTC",  
        "quoteCurrency": "USDT",  
        "fee": "0.5",   
        "feeCurrency": "USDT", 
        "takerMaker": "taker"  //takerMaker
      }
    ]
  }
}
```

## Get a single currency asset

`GET` `/spot/v4/balance`

**Parameters**

| Parameter | Type | mandatory | Default | Description | Ranges |
| - | - | - | - | - | - |
| currency | string | true | | eg:usdt | |

```json Response theme={null}
{
  "rc": 0,
  "mc": "string",
  "ma": [
    {}
  ],
  "result": {
    "currency": "usdt",  
    "currencyId": 0,   
    "frozenAmount": 0,  
    "availableAmount": 0,  
    "totalAmount": 0,    
    "convertBtcAmount": 0  //Converted BTC amount
  }
}
```

## Get a list of currency assets

`GET` `/spot/v4/balances`

**Parameters**

| Parameter | Type | mandatory | Default | Description | Ranges |
| - | - | - | - | - | - |
| currencies | string | false | | List of currencies, comma separated,eg: usdt,btc | |

### Limit Flow Rules

10/s/apikey

```json Response theme={null}
{
  "rc": 0,
  "mc": "string",
  "ma": [
    {}
  ],
  "result": {
    "totalBtcAmount": 0,
    "assets": [    
      {        
        "currency": "string",
        "currencyId": 0,
        "frozenAmount": 0,
        "availableAmount": 0,
        "totalAmount": 0,
        "convertBtcAmount": 0
      }
    ]
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.