# Get WeChat API Server IP
Interface should be called on the server side, not in the front end (Weixin Mini Program, web pages, APP, etc.) directly called, specific reference interface call guide
Interface name: getApiDomainIp
This interface is used to get the WeChat api server IP address (the remote address where the developer server actively accesses api.weixin.qq.com)
If developers need to know the IP address list of the WeChat server for security reasons in order to restrict it, they can obtain the IP address listing or IP segment information of the WeChat server through this interface.
# 1. How to call
# HTTPS calls
GET https://api.weixin.qq.com/cgi-bin/get_api_domain_ip?access_token=ACCESS_TOKEN
# Cloud Calls
- This interface does not support cloud calls
# Third party invocation
- This interface supports Third Party Platform calling itself using component_access_token .
# 2. Request parameters
# Query parametersQuery String parameters
Parameter Name | type | Required to fill in | Introductions |
---|---|---|---|
access_token | string | yes | Interface invoke credentials, using access_token |
# Request BodyRequest Payload
nothing
# 3. Return Parameters
# Response Payload
Parameter Name | type | Introductions |
---|---|---|
ip_list | array | WeChat Server IP address list |
errcode | number | Error code |
errmsg | string | Error message |
# 4. Note
- Since the export IP and the entrance IP may change, it is recommended that users request the interface once a day to update the IP list in time.To avoid causing a single point of failure, users are strongly advised not to use the old IP list as an entry point for
api.weixin.qq.com
for a long time. - When accessing
api.weixin.qq.com
using a fixed IP, please developers be aware of carrier adaptation. Cross-carrier access may have peak packet loss. - Since the export IP and the entrance IP may change, it is recommended that users request the interface once a day to update the IP list in time.To avoid causing a single point of failure, users are strongly advised not to use the old IP list as an entry point for
api.weixin.qq.com
for a long time.
# 5. Code examples
# 5.1 A successful response
Example Requests
{}
Return an example
{
"ip_list": [
"101.89.47.18",
"101.91.34.103"
]
}
# 5.2 Error response
Example Requests
{}
Return an example
{
"errcode": 40013,
"errmsg": "invalid appid"
}
# 6. Error code
The following is a list of error codes for this interface, other error codes can refer to General error codes
Error code | Error Description | Solutions |
---|---|---|
40013 | invalid appid | Invalid AppID, please check the correctness of the AppID, avoid abnormal characters, pay attention to the case |
# 7. Scope of application
How this interface can be invoked under different account types:
Weixin Mini Program | Official Account | Service Account | MiniGame | Weixin Store | Alliance Shipping Agency | Delivery Assistant | Third Party Platform | Mobile App | Website App | Weixin Channels Assistant | Multi-platform App |
---|---|---|---|---|---|---|---|---|---|---|---|
✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | 〇 | ✔ | ✔ | ✔ | ✔ |
- ✔: The account can call this interface
- 〇: Third Party Platform can be invoked using component_access_token . See this document for support for invoking on behalf of the merchant Methods of Invoking sections