Query domain configuration

Last edited on 2026-03-16

This API should be called on the server side and cannot be called directly on the client side (Mini Program, web page, APP, etc.). For details, please refer to API Call Guide.

API English Name: getDomainInfo

This API is used to query the Mini Program domain configuration information.

1. Call Method

HTTPS Call

POST https://api.weixin.qq.com/wxa/getwxadevinfo?access_token=ACCESS_TOKEN

Encryption Support: This API supports secondary encryption and signature for service communication, which can effectively prevent data tampering and leakage. View Details

Cloud Call

  • Call Method: operation.getDomainInfo

  • Input and output parameters are the same as HTTPS call. For call method, please refer to Cloud Call documentation.

Third-party Call

  • This API supports third-party platforms on behalf of Merchant call.

  • The permission set ID of this API is: 18

  • After the service provider obtains one of the permission set authorizations, it can use authorizer_access_token to call on behalf of Merchant, for details please refer to Third-party Call documentation.

2. Request Parameters

Query Parameters Query String Parameters

ParameterTypeRequiredDescription
access_tokenstringYesAPI call credential, you can use authorizer_access_token

Request Body Request Payload

ParameterTypeRequiredDescription
actionstringNoThe type of domain configuration to query. Valid values are as follows: 1. `getbizdomain`: Returns business domains. 2. `getserverdomain`: Returns server domains. 3. If unspecified, all types are returned.

3. Response Parameters

Response Body Response Payload

ParameterTypeDescription
errcodenumberError code
errmsgstringError message
requestdomainarrayList of valid domains for `request`
wsrequestdomainarrayList of valid domains for `socket`
uploaddomainarrayList of valid domains for `uploadFile`
downloaddomainarrayList of valid domains for `downloadFile`
udpdomainarrayList of valid domains for `udp`
bizdomainarrayList of business domains

4. Notes

No special notes for this API

5. Code Example

5.1 HTTPS request example

Request Example

{
  "action": "getserverdomain"
}

Response Example

{
  "errcode": 0,
  "errmsg": "ok",
  "requestdomain": [
    "https://www.example.com"
  ],
  "wsrequestdomain": [
    "wss://www.qq.com"
  ],
  "uploaddomain": [],
  "downloaddomain": [
    "https://www.qq.com"
  ],
  "udpdomain": [
    "udp://www.example.com"
  ]
}

5.2 Cloud Function call example

Request Example

const cloud = require('wx-server-sdk')
cloud.init({
  env: cloud.DYNAMIC_CURRENT_ENV,
})
exports.main = async (event, context) => {
  try {
    const result = await cloud.openapi.operation.getDomainInfo({
        "action": ''
      })
    return result
  } catch (err) {
    return err
  }
}

Response Example

const cloud = require('wx-server-sdk')
cloud.init({
  env: cloud.DYNAMIC_CURRENT_ENV,
})
exports.main = async (event, context) => {
  try {
    const result = await cloud.openapi.operation.getDomainInfo({
        "errcode": 0,
        "errmsg": 'ok',
        "requestdomain": [
          "https://www.example.com"
        ],
        "wsrequestdomain": [
          "wss://www.qq.com"
        ],
        "uploaddomain": [],
        "downloaddomain": [
          "https://www.qq.com"
        ],
        "udpdomain": [
          "udp://www.example.com"
        ],
        "bizdomain": [
          "https://www.qq.com"
        ]
      })
    return result
  } catch (err) {
    return err
  }
}

6. Error Codes

The following is the error code list of this API, other error codes can refer to Common Error Codes; When encountering errors in calling the API, you can use the official API Diagnostic Tool to assist in locating and analyzing problems.

Error CodeError DescriptionSolution
40001invalid credential  access_token isinvalid or not latestThe AppSecret is incorrect when obtaining the `access_token`, or the `access_token` is invalid. Developers should carefully verify the correctness of the AppSecret, or check whether the API is being called for the appropriate Official Account.

7. Applicable Scope

API callable status for different account types:
Mini ProgramMini Game
✔ ✔
  • ✔:This account type can call this API。
  • Other account types not explicitly declared cannot call this API unless otherwise specified.