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: getApiDomainIp
This interface is used to retrieve the IP address of the WeChat API server (the remote address that the developer's server accesses actively via api.weixin.qq.com).
If developers need to know the list of WeChat server IP addresses for security or other reasons, so as to implement relevant restrictions, they can use this interface to obtain the list of WeChat server IP addresses or IP range information.
1. Call Method
HTTPS Call
GET https://api.weixin.qq.com/cgi-bin/get_api_domain_ip?access_token=ACCESS_TOKEN
Cloud Call
- This API does not support cloud call.
Third-party Call
-
This API supports third-party platforms to call using component_access_token, and also supports calling on behalf of Merchant call.
-
After the service provider obtains any permission set authorization, 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
| Parameter | Type | Required | Description |
|---|---|---|---|
| access_token | string | Yes | API call credential, you can use access_token, component_access_token, authorizer_access_token |
Request Body Request Payload
None
3. Response Parameters
Response Body Response Payload
| Parameter | Type | Description |
|---|---|---|
| ip_list | array | List of WeChat server IP addresses |
| errcode | number | Error code |
| errmsg | string | Error message |
4. Notes
- Since the outbound and inbound IP addresses may change, it is recommended that users request this interface once a day to keep the IP list up-to-date. To avoid single-point failures, it is strongly advised not to use an old IP list as the access point for
api.weixin.qq.comfor an extended period. - When using a fixed IP to access
api.weixin.qq.com, developers should pay attention to operator compatibility, as cross-operator access may experience packet loss during peak periods. - Since the outbound and inbound IP addresses may change, it is recommended that users request this interface once a day to keep the IP list up-to-date. To avoid single-point failures, it is strongly advised not to use an old IP list as the access point for
api.weixin.qq.comfor an extended period.
5. Code Example
5.1 Successful response
Request Example
{}
Response Example
{
"ip_list": [
"101.89.47.18",
"101.91.34.103"
]
}
5.2 Error response
Request Example
{}
Response Example
{
"errcode": 40013,
"errmsg": "invalid appid"
}
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 Code | Error Description | Solution |
|---|---|---|
| 40013 | invalid appid | Invalid AppID. Developers should check the correctness of the AppID, avoiding special characters and paying attention to case sensitivity. |
7. Applicable Scope
| Mini Program | Official Account | Service Account | Mini Game | WeChat Shop | Alliance Agency | Influencer | Shop Supplier | Third-party Platform | Mobile App | Website App | Channels Window | Multi-platform App |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | 〇 | ✔ | ✔ | ✔ | ✔ |
- ✔:This account type can call this API。
- 〇:Third-party platforms can use component_access_token to call. For calling on behalf of Merchant, please refer to the Call Method section。