# Setting Server Domain Name

The server domain name of a Mini Program authorized to a third-party platform must be that of the third-party platform. After the code of the Mini Program is released via the third-party platform, the original server domain name configured for the Mini Program is deleted, and only the server domain name of the third-party platform is retained. Therefore, before releasing the code for the Mini Program, the third-party platform needs to add the server domain name of the third-party platform to the Mini Program by calling this API.

Note: This API can be called only after the domain name is registered as the Mini Program server domain name of the third-party platform.

# Request Address

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

# Request Parameters

Parameter Type Required Description
access_token string Yes Mini Program API Call Token
action string Yes Operation type
requestdomain string array Yes Valid request domain name. This field is not required when the value of action is get.
wsrequestdomain string array Yes Valid socket domain name. This field is not required when the value of action is get.
uploaddomain string array Yes Valid uploadFile domain name. This field is not required when the value of action is get.
downloaddomain string array Yes Valid downloadFile domain name. This field is not required when the value of action is get.

# Available values of action

Available Value Description
add Add
delete Delete
set Overwrite
get Obtain

POST data example:

{
  "action": "add",
  "requestdomain": ["https://www.qq.com", "https://www.qq.com"],
  "wsrequestdomain": ["wss://www.qq.com", "wss://www.qq.com"],
  "uploaddomain": ["https://www.qq.com", "https://www.qq.com"],
  "downloaddomain": ["https://www.qq.com", "https://www.qq.com"]
}

# Response Parameters

Parameter Type Description
errcode number Error code
errmsg string Error message
requestdomain string array Valid request domain name
wsrequestdomain string array Valid socket domain name
uploaddomain string array Valid uploadFile domain name
downloaddomain string array Valid downloadFile domain name

Example of returned result

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

# Error Codes

Error Code Description
0 Successful
85015 This account is not a Mini Program account.
85016 The number of domain names exceeds the limit.
85017 No domain name is added. Check whether the domain name has been added for the Mini Program, or whether the domain name is not added for the third-party platform.
85018 The domain name is not set for the third-party platform.