# Get WeChat API Server IP

Debugging Tools

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

# 2. Request parameters

# Query parametersQuery String parameters

Parameter NametypeRequired to fill inIntroductions
access_tokenstringyesInterface invoke credentials, using access_token

# Request BodyRequest Payload

nothing

# 3. Return Parameters

# Response Payload

Parameter NametypeIntroductions
ip_listarrayWeChat Server IP address list
errcodenumberError code
errmsgstringError message

# 4. Note

  1. 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 forapi.weixin.qq.comfor a long time.
  2. When accessingapi.weixin.qq.comusing a fixed IP, please developers be aware of carrier adaptation. Cross-carrier access may have peak packet loss.
  3. 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 forapi.weixin.qq.comfor 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 codeError DescriptionSolutions
40013invalid appidInvalid 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