> For the complete documentation index, see [llms.txt](https://docs.compendium.finance/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.compendium.finance/pendax/using-pendax-sdk/mexc-functions/sub-account.md).

# Sub-Account

## Create a Sub-account(For Master Account)

{% hint style="info" %}
Please refer to the official Mexc API Docs for the Required parameters.

<https://mxcdevelop.github.io/apidocs/spot_v3_en/#create-a-sub-account-for-master-account>
{% endhint %}

#### Function Name:

```javascript
createSubAccountSpot()
```

#### Usage:

```javascript
import { createExchange } from "./exchanges/exchange.js";

   let myMexcExchanges  = createExchange({
      exchange: "mexc",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      label: "mexc"
  });

async function createSubAccountSpot(exchange, options) {
    try {
        let result = await exchange.createSubAccountSpot(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await createSubAccountSpot(myMexcExchanges,
     {
         subAccount: "mikwdn443ksnsadasd",
         note: "1"
     });
```

## Query Sub-account List (For Master Account)

{% hint style="info" %}
Please refer to the official Mexc API Docs for the Required parameters.

<https://mxcdevelop.github.io/apidocs/spot_v3_en/#query-sub-account-list-for-master-account>
{% endhint %}

#### Function Name:

```javascript
getSubaccountListSpot()
```

#### Usage:

```javascript
import { createExchange } from "./exchanges/exchange.js";

   let myMexcExchanges  = createExchange({
      exchange: "mexc",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      label: "mexc"
  });

async function getSubaccountListSpot(exchange, options) {
    try {
        let result = await exchange.getSubaccountListSpot(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await getSubaccountListSpot(myMexcExchanges);
```

## Create an APIKey for a sub-account (For Master Account)

{% hint style="info" %}
Please refer to the official Mexc API Docs for the Required parameters.

<https://mxcdevelop.github.io/apidocs/spot_v3_en/#create-an-apikey-for-a-sub-account-for-master-account>
{% endhint %}

#### Function Name:

```javascript
createSubaccountApiKeySpot()
```

#### Usage:

```javascript
import { createExchange } from "./exchanges/exchange.js";

   let myMexcExchanges  = createExchange({
      exchange: "mexc",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      label: "mexc"
  });

async function createSubaccountApiKeySpot(exchange, options) {
    try {
        let result = await exchange.createSubaccountApiKeySpot(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await createSubaccountApiKeySpot(myMexcExchanges,
         {
             subAccount: "mikwdn443ksnsadasd",
             note: "meat",
             permissions: "SPOT_ACCOUNT_READ"
         });
```

## Query the APIKey of a sub-account (For Master Account)

{% hint style="info" %}
Please refer to the official Mexc API Docs for the Required parameters.

<https://mxcdevelop.github.io/apidocs/spot_v3_en/#query-the-apikey-of-a-sub-account-for-master-account>
{% endhint %}

#### Function Name:

```javascript
getSubaccountApiKeySpot()
```

#### Usage:

```javascript
import { createExchange } from "./exchanges/exchange.js";

   let myMexcExchanges  = createExchange({
      exchange: "mexc",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      label: "mexc"
  });

async function getSubaccountApiKeySpot(exchange, options) {
    try {
        let result = await exchange.getSubaccountApiKeySpot(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}


let result = await getSubaccountApiKeySpot(myMexcExchanges,
         {
             subAccount: "yourSubAccountName"
         });
```

## Delete the APIKey of a sub-account (For Master Account)

{% hint style="info" %}
Please refer to the official Mexc API Docs for the Required parameters.

<https://mxcdevelop.github.io/apidocs/spot_v3_en/#delete-the-apikey-of-a-sub-account-for-master-account>
{% endhint %}

#### Function Name:

```javascript
deleteSubaccountApiKeySpot()
```

#### Usage:

```javascript
import { createExchange } from "./exchanges/exchange.js";

   let myMexcExchanges  = createExchange({
      exchange: "mexc",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      label: "mexc"
  });

async function deleteSubaccountApiKeySpot(exchange, options) {
    try {
        let result = await exchange.deleteSubaccountApiKeySpot(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await deleteSubaccountApiKeySpot(myMexcExchanges,
         {
             subAccount: "22nj5499sn2nv",
             apiKey: "nfl4nfl34nrt3lku4nrl3in4"
         });
```

## Universal Transfer (For Master Account)

{% hint style="info" %}
Please refer to the official Mexc API Docs for the Required parameters.

<https://mxcdevelop.github.io/apidocs/spot_v3_en/#universal-transfer-for-master-account>
{% endhint %}

#### Function Name:

```javascript
universalTransferSpot()
```

#### Usage:

```javascript
import { createExchange } from "./exchanges/exchange.js";

   let myMexcExchanges  = createExchange({
      exchange: "mexc",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      label: "mexc"
  });

async function universalTransferSpot(exchange, options) {
    try {
        let result = await exchange.universalTransferSpot(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await universalTransferSpot(myMexcExchanges,
         {
             toAccount: "ddddw3g",
             fromAccountType: "SPOT",
             toAccountType: "SPOT",
             asset: "USDT",
             amount: "10"
         });
```

## Query Universal Transfer History (For Master Account)

{% hint style="info" %}
Please refer to the official Mexc API Docs for the Required parameters.

<https://mxcdevelop.github.io/apidocs/spot_v3_en/#query-universal-transfer-history-for-master-account>
{% endhint %}

#### Function Name:

```javascript
getUniversalTransferHistorySpot()
```

#### Usage:

```javascript
import { createExchange } from "./exchanges/exchange.js";

   let myMexcExchanges  = createExchange({
      exchange: "mexc",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      label: "mexc"
  });

async function getUniversalTransferHistorySpot(exchange, options) {
    try {
        let result = await exchange.getUniversalTransferHistorySpot(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await getUniversalTransferHistorySpot(myMexcExchanges,
         {
             toAccount: "22df3tg4yh45y",
             fromAccountType: "SPOT",
             toAccountType: "SPOT"
         });
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.compendium.finance/pendax/using-pendax-sdk/mexc-functions/sub-account.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
