Skip to content

API Docs

Introduction

Through the aaPanel API, you can fully control all the functions of the aaPanel Linux panel.

In fact, all the functions used after the user logs in to the panel are also connected through the same interface, which means that if you are familiar with the browser debugger, you can easily complete a third-party front-end integration based on the operational parameters of the aaPanel Linux panel.

API List

Turn on the API in aaPanel

  1. Find API in Settings and enable it

    Settings --> API --> Modify

  2. Enter your IP address (the IP of the computer using the API to access aaPanel) into the IP whitelist

    • Access will be denied if the entered IP is incorrect

alt text

Using API in Postman

  1. First, enable the API in aaPanel, add the IP to the IP whitelist, and obtain the API secret key

  2. Download and install Postman, and register an account

  3. Add a Blank collection named aaPanel

    alt textalt text

  4. Add the following script content to Pre-request under the Script of aaPanel:

    var now = Date.now();
    API_secret_key = pm.collectionVariables.get("API_secret_key");
    request_token = CryptoJS.MD5(now+CryptoJS.MD5(API_secret_key));
    pm.request.addQueryParams("request_time="+now);
    pm.request.addQueryParams("request_token="+request_token.toString());

    alt text

  5. Add preset environment variables with the following names:

    • API_secret_key: The API secret key of aaPanel, which must be set.

    • panel_address: The access address of aaPanel, optional. It is convenient for multiple interfaces to reference the same port.

    • panel_port: The access port of aaPanel, optional. It is convenient for multiple interfaces to reference the same port.

    alt text

  6. Create a request for testing:

    • Get token
    {{panel_address}}:{{panel_port}}/config?action=get_token

    alt text

    • Get 50 pieces of data of PHP Projects
    {{panel_address}}:{{panel_port}}/v2/data?action=getData&p=1&limit=50&table=sites&search=&order=&type=-1

How to obtain API in Browser

Browser's developer mode (F12) --> Network --> XHR (Fetch/XHR) --> Requests and Parameters

For example, to get the website list of PHP Projects in Website:

Parsing result (Form-data): alt text

Request source code (Raw): alt text