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: getCallbackIp
This interface is used to obtain the IP address of WeChat's push server (the source address of the WeChat server that sends messages to the developer's server).
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/getcallbackip?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 Supplier call.Third-party Service Provider Call Mode Introduction
-
After the service provider obtains any permission set authorization, it can use authorizer_access_token to call on behalf of Supplier, 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 (Supplier), component_access_token (Service Provider), authorizer_access_token (Service Provider Proxy Call) |
Request Body Request Payload
None
3. Response Parameters
Response Body Response Payload
| Parameter | Type | Description |
|---|---|---|
| ip_list | string | List of WeChat server IP addresses |
| errcode | number | Error codes |
| errmsg | string | Error messages |
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 times. - 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": [
"106.55.206.146",
"106.55.206.211"
]
}
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 |
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 Supplier, please refer to the Call Method section。