API

Network

Download

API 说明
wx.downloadFile When downloading file resources to a local directory, the client will directly initiate an HTTP GET request, and the local temporary path of the file will be returned. Read Related Instructions before use.
Note: Specify a reasonable Content-Type field in the header responded by the server to ensure the client processes the file type correctly.

DownloadTask

API 说明
DownloadTask.abort Interrupt download task
DownloadTask.onProgressUpdate 监听Download progress change event

Request

API 说明
wx.request Initiate HTTPS network requests. Read Related Instructions before use.

RequestTask

API 说明
RequestTask.abort Interrupt request task

Upload

API 说明
wx.uploadFile To upload local resources to the developer server, the client initiates a HTTPS POST request in which the value of content-type is multipart/form-data. Read Related Instructions before use.

UploadTask

API 说明
UploadTask.abort Interrupt upload task
UploadTask.onProgressUpdate 监听Upload progress change event

Websocket

API 说明
wx.closeSocket Disable WebSocket connection
wx.connectSocket Create a WebSocket connection. Read Related Instructions before use.
wx.onSocketClose 监听WebSocket connection disabling event
wx.onSocketError 监听WebSocket error event
wx.onSocketMessage 监听"WebSocket receives messages from the server" event
wx.onSocketOpen 监听WebSocket connection enabling event
wx.sendSocketMessage To send data through WebSocket, users first need to call wx.connectSocket, and then callback wx.onSocketOpen.

SocketTask

API 说明
SocketTask.close Close WebSocket connection
SocketTask.onClose 监听WebSocket connection disabling event
SocketTask.onError 监听WebSocket error event
SocketTask.onMessage 监听"WebSocket receives messages from the server" event
SocketTask.onOpen 监听WebSocket connection enabling event
SocketTask.send Send data via WebSocket connection

Media

Audio

API 说明
wx.createAudioContext Create the AudioContext object of the audio context
wx.createInnerAudioContext Create the InnerAudioContext object of the inner audio context
wx.getAvailableAudioSources Acquire currently supported audio input source
wx.pauseVoice Current voice playback paused. When wx.playVoice is called to play the same file for a second time, it will start playing from where it was paused. To play from the beginning, wx.stopVoice has to be called first.
wx.playVoice Begin playing voice, only one voice file is allowed to be played at one time, if the previous voice file has not finished playing, it will be cut off.
wx.setInnerAudioOption Set the playback options for InnerAudioContext, which will be available in the current Mini Program after being set.
wx.stopVoice End voice playback.

AudioContext

API 说明
AudioContext.pause Pause audio
AudioContext.play Play audio
AudioContext.seek Jump to the specified position
AudioContext.setSrc Set the audio address

InnerAudioContext

API 说明
InnerAudioContext.destroy Destroy current instance
InnerAudioContext.offCanplay 取消监听Event in which audio enters the playable status. Smooth play is not guaranteed
InnerAudioContext.offEnded 取消监听"Audio naturally plays till the end" event
InnerAudioContext.offError 取消监听Audio play error event
InnerAudioContext.offPause 取消监听Audio pause event
InnerAudioContext.offPlay 取消监听Audio play event
InnerAudioContext.offSeeked 取消监听"Audio completes jump operation" event
InnerAudioContext.offSeeking 取消监听"Audio performs jump operation" event
InnerAudioContext.offStop 取消监听Audio stop event
InnerAudioContext.offTimeUpdate 取消监听Audio play progress update event
InnerAudioContext.offWaiting 取消监听Audio loading event. Triggered when the audio data is insufficient and needs to stop to load
InnerAudioContext.onCanplay 监听Event in which audio enters the playable status. Smooth play is not guaranteed
InnerAudioContext.onEnded 监听"Audio naturally plays till the end" event
InnerAudioContext.onError 监听Audio play error event
InnerAudioContext.onPause 监听Audio pause event
InnerAudioContext.onPlay 监听Audio play event
InnerAudioContext.onSeeked 监听"Audio completes jump operation" event
InnerAudioContext.onSeeking 监听"Audio performs jump operation" event
InnerAudioContext.onStop 监听Audio stop event
InnerAudioContext.onTimeUpdate 监听Audio play progress update event
InnerAudioContext.onWaiting 监听Audio loading event. Triggered when the audio data is insufficient and needs to stop to load
InnerAudioContext.pause Pause. The audio will continue playing from where it was paused
InnerAudioContext.play Play
InnerAudioContext.seek Jump to the specified position
InnerAudioContext.stop Stop. The audio will start playing from the beginning if it was stopped.

Background Audio

API 说明
wx.getBackgroundAudioManager Get globally unique background audio manager.

After the Mini Program is moved to the background, if the audio is playing, it will continue to play. But in the background, the audio play status cannot be controlled through calling the API. From WeChat 6.7.2, if you want the Mini Program to continue playing audio after it is moved to the background, you need to go into app.json to configure the requiredBackgroundModes attribute. This takes immediate effect in the development version and trial version. However, it needs review in the official version. | | wx.getBackgroundAudioPlayerState | Retrieve background music playback status. | | wx.onBackgroundAudioPause | 监听Music pause event. | | wx.onBackgroundAudioPlay | 监听Music playback event. | | wx.onBackgroundAudioStop | 监听Music stop event. | | wx.pauseBackgroundAudio | Pause music playback. | | wx.playBackgroundAudio | For the WeChat client, only one background music can be played at a time when there is a music player that is running in the background. When the user leaves the Mini Program, music will be paused; when the user uses the music player on another Mini Program, playback will be stopped on the original Mini Program. | | wx.seekBackgroundAudio | Control the music playback progress. | | wx.stopBackgroundAudio | Stop music playback. |

BackgroundAudioManager

API 说明
BackgroundAudioManager.onCanPlay 监听Background audio enters playable status but smooth play is not guaranteed
BackgroundAudioManager.onEnded 监听Background audio play naturally ends event
BackgroundAudioManager.onError 监听Background audio play error event
BackgroundAudioManager.onNext 监听"User presses 'Next track' in the system's music playing interface" event (iOS only)
BackgroundAudioManager.onPause 监听Background audio pause event
BackgroundAudioManager.onPlay 监听Background audio play event
BackgroundAudioManager.onPrev 监听"User presses 'Previous track' in the system's music playing interface event" (iOS only)
BackgroundAudioManager.onSeeked 监听"Background audio completes jump operation" event
BackgroundAudioManager.onSeeking 监听"Background audio starts jump operation" event
BackgroundAudioManager.onStop 监听Background audio stop event
BackgroundAudioManager.onTimeUpdate 监听Background audio play progress update event
BackgroundAudioManager.onWaiting 监听Audio loading event. Triggered when the audio data is insufficient and needs to stop to load
BackgroundAudioManager.pause Pause music
BackgroundAudioManager.play Play music
BackgroundAudioManager.seek Jump to the specified position
BackgroundAudioManager.stop Stop music

Camera

API 说明
wx.createCameraContext Create the CameraContext object of the camera context.

CameraContext

API 说明
CameraContext.startRecord Start video recording
CameraContext.stopRecord Stop recording
CameraContext.takePhoto Take photos

Font

API 说明
wx.loadFontFace Load network font dynamically. The file address must be of the download type. File addresses only in the https format are supported on iOS.

Image

API 说明
wx.chooseImage Select image from local album or take photo with camera.
wx.getImageInfo Obtain image information. If it is an online image, the download domain must be configured to take effect.
wx.previewImage Preview the image in full screen on a new page. During the preview, users can save or send the image to their friends.
wx.saveImageToPhotosAlbum Save image to system album.

Live Audio/Video

API 说明
wx.createLivePlayerContext Create the LivePlayerContext object of the live-player context.
wx.createLivePusherContext Create the LivePusherContext object of the live-pusher context.

LivePlayerContext

LivePusherContext

Recorder

API 说明
wx.getRecorderManager Acquire globally unique recording manager RecorderManager
wx.startRecord Start recording. When wx.stopRecord is called, or recording exceeds one minute, the recording ends. When the user exits the Mini Program, this interface cannot be called.
wx.stopRecord Stop recording.

RecorderManager

API 说明
RecorderManager.onError 监听Recording error event
RecorderManager.onFrameRecorded 监听"Specified frame size of file is recorded" event. If frameSize is set, it calls back this event.
RecorderManager.onInterruptionBegin 监听Recording is occupied and interruption starts event. The following scenarios trigger this event: WeChat voice chat, WeChat video chat. After this event is triggered, recording pauses. The pause event is triggered after this event
RecorderManager.onInterruptionEnd 监听Recording interruption ends event. After receiving the interruptionBegin event, all recordings in the Mini Program will stop. Only after receiving this event can recording be started again.
RecorderManager.onPause 监听Recording pause event
RecorderManager.onResume 监听Recording continue event
RecorderManager.onStart 监听Recording start event
RecorderManager.onStop 监听Recording end event
RecorderManager.pause Pause recording
RecorderManager.resume Continue recording
RecorderManager.start Start recording
RecorderManager.stop Stop recording

Video

API 说明
wx.chooseVideo Shoot a video or select a video from the album.
wx.createVideoContext Create the VideoContext object of the video context
wx.saveVideoToPhotosAlbum Save the video to the system album

VideoContext

API 说明
VideoContext.exitFullScreen Exit full screen
VideoContext.hideStatusBar Hide status bar. Only effect in iOS full screen mode
VideoContext.pause Pause video
VideoContext.play Play video
VideoContext.playbackRate Set play speed
VideoContext.requestFullScreen Enter full screen
VideoContext.seek Jump to the specified position
VideoContext.sendDanmu Play video
VideoContext.showStatusBar Display status bar. Only effective in iOS full screen mode
VideoContext.stop Stop video

File

API 说明
wx.getFileInfo Acquire file information
wx.getFileSystemManager Obtain the only file system manager globally
wx.getSavedFileInfo Obtain file information of the local file. This API is only applicable to files that are saved locally. To obtain file information of temporary files, use wx.getFileInfo().
wx.getSavedFileList Obtain the saved local cache file list under this Mini Program
wx.openDocument Open the file in a new page
wx.removeSavedFile Delete local cache file
wx.saveFile Save the file locally. Note: saveFile will move the temporary file. Therefore after the API is called, the incoming tempFilePath will no longer be available

FileSystemManager

API 说明
FileSystemManager.access Judge whether the file/directory exists
FileSystemManager.accessSync FileSystemManager.access 的同步版本
FileSystemManager.appendFile Add content at the end of the file
FileSystemManager.appendFileSync FileSystemManager.appendFile 的同步版本
FileSystemManager.copyFile Copy file
FileSystemManager.copyFileSync FileSystemManager.copyFile 的同步版本
FileSystemManager.getFileInfo Obtain information of the local temporary file or cache file under this Mini Program
FileSystemManager.getSavedFileList Obtain the saved local cache file list under this Mini Program
FileSystemManager.mkdir Create directory
FileSystemManager.mkdirSync FileSystemManager.mkdir 的同步版本
FileSystemManager.readdir Read the file list in the directory
FileSystemManager.readdirSync FileSystemManager.readdir 的同步版本
FileSystemManager.readFile Read local file content
FileSystemManager.readFileSync FileSystemManager.readFile 的同步版本
FileSystemManager.removeSavedFile Delete the saved local cache file under this Mini Program
FileSystemManager.rename Rename file. Then the file can be moved from oldPath to newPath
FileSystemManager.renameSync FileSystemManager.rename 的同步版本
FileSystemManager.rmdir Delete directory
FileSystemManager.rmdirSync FileSystemManager.rmdir 的同步版本
FileSystemManager.saveFile Save the temporary file locally. This API will move the temporary file. Therefore, after the API is called, tempFilePath will no longer be available.
FileSystemManager.saveFileSync FileSystemManager.saveFile 的同步版本
FileSystemManager.stat Obtain the file Stats object
FileSystemManager.statSync FileSystemManager.stat 的同步版本
FileSystemManager.unlink Delete a file
FileSystemManager.unlinkSync FileSystemManager.unlink 的同步版本
FileSystemManager.unzip Decompress file
FileSystemManager.writeFile Write file
FileSystemManager.writeFileSync FileSystemManager.writeFile 的同步版本

Stats

API 说明
Stats.isDirectory Judge whether the current file is a directory
Stats.isFile Judge whether the current file is a normal file

Storage

API 说明
wx.clearStorage Clear local data cache
wx.clearStorageSync wx.clearStorage 的同步版本
wx.getStorage Asynchronously acquire the contents of a specified key from the local cache
wx.getStorageInfo Asynchronously acquire the relevant information of the current storage
wx.getStorageInfoSync wx.getStorageInfo 的同步版本
wx.getStorageSync wx.getStorage 的同步版本
wx.removeStorage Remove the specified key from the local cache
wx.removeStorageSync wx.removeStorage 的同步版本
wx.setStorage Storing data in the specified key in the local cache will override the original contents corresponding to the key.
wx.setStorageSync wx.setStorage 的同步版本

Location

API 说明
wx.chooseLocation Open a map and select a location.
wx.getLocation Obtain the current location and speed. When the user exits the Mini Program, this API cannot be called.
wx.openLocation Use maps in WeChat to check the location.

Device

Accelerometer

API 说明
wx.onAccelerometerChange 监听Acceleration data event. Frequency depends on the interval parameter of wx.startAccelerometer(). wx.stopAccelerometer() can be used to stop monitoring.
wx.startAccelerometer Start monitoring acceleration data.
wx.stopAccelerometer Stop monitoring acceleration data.

Battery

API 说明
wx.getBatteryInfo Obtain device battery. The synchronizing API, wx.getBatteryInfoSync, is unavailable on iOS.
wx.getBatteryInfoSync wx.getBatteryInfo 的同步版本

Bluetooth

API 说明
wx.closeBLEConnection Disconnect to low power Bluetooth devices.
wx.closeBluetoothAdapter Turn off the Bluetooth module. Calling this method disconnects all established links and frees system resources. It is recommended to call in pairs with wx.openBluetoothAdapter after using the Bluetooth process.
wx.createBLEConnection Connect to low power Bluetooth devices.
If the Mini Program has searched for a Bluetooth device before and successfully established a link, it can directly import the previously found deviceId to try to connect to the device without searching.
wx.getBLEDeviceCharacteristics Get all the characteristics in a service of the Bluetooth device.
wx.getBLEDeviceServices Gets all services of the Bluetooth device
wx.getBluetoothAdapterState Get the status of the native Bluetooth adapter.
wx.getBluetoothDevices Get all Bluetooth devices that have been discovered during the validity of the Bluetooth module, including the devices that have been connected to the device.
wx.getConnectedBluetoothDevices Gets devices in connected state according to uuids.
wx.notifyBLECharacteristicValueChange To enable the notify function when the characteristics of low power Bluetooth devices change, please subscribe characteristics. Note: the device characteristics must support notify or indicate before they can be called successfully.
In addition, notifyBLECharacteristicValueChange must be enabled before the device characteristicValueChange event can be monitored
wx.onBLECharacteristicValueChange 监听Changes in characteristics values of the low-power Bluetooth device. The notifyBLECharacteristicValueChange interface must first be enabled in order to receive device notifications.
wx.onBLEConnectionStateChange 监听Status change events of low-power Bluetooth connections, including developers actively connecting or disconnecting, device loss, abnormal disconnection, etc.
wx.onBluetoothAdapterStateChange 监听Status change events of Bluetooth adapter
wx.onBluetoothDeviceFound 监听New device event found
wx.openBluetoothAdapter Initialize Bluetooth module
wx.readBLECharacteristicValue Read the binary data value of a low-power Bluetooth device's characteristic value. Note: The device's characteristic value must support reading in order to be called.
wx.startBluetoothDevicesDiscovery Start searching for nearby Bluetooth peripherals. This operation consumes a relatively large amount of system resources. After searching for and connecting to a device, call the wx.stopBluetoothDevicesDiscovery method to stop searching.
wx.stopBluetoothDevicesDiscovery Stop searching for nearby Bluetooth peripherals. If you have found the desired Bluetooth device and do not need to continue searching, it is recommended to call this interface to stop the Bluetooth search.
wx.writeBLECharacteristicValue Write binary data into a low-power Bluetooth device's characteristic value. Note: The device's characteristic value must support writing in order to be called.

Clipboard

API 说明
wx.getClipboardData Obtain system clipboard content
wx.setClipboardData Set system clipboard content

Compass

API 说明
wx.onCompassChange 监听Compass data change event (frequency: 5 times/second). Monitoring automatically starts after the API is called and can be stopped by wx.stopCompass.
wx.startCompass Start monitoring compass data
wx.stopCompass Stop monitoring compass data

Contact

API 说明
wx.addPhoneContact Add mobile phone contact. Users can choose to write this form into the system contact of the phone in the form of "Add New Contact" or "Add to Existing Contact".

Gyroscope

API 说明
wx.onGyroscopeChange Monitor gyroscope data. Frequency depends on the interval parameter of wx.startGyroscope(). Users can use wx.stopGyroscope() to stop monitoring.
wx.startGyroscope Start monitoring gyroscope data
wx.stopGyroscope Stop monitoring gyroscope data

iBeacon

API 说明
wx.getBeacons Obtain all searched iBeacon devices
wx.onBeaconServiceChange 监听iBeacon service status changes
wx.onBeaconUpdate 监听iBeacon device update event
wx.startBeaconDiscovery Start searching nearby iBeacon devices
wx.stopBeaconDiscovery Stop searching nearby iBeacon devices
IBeaconInfo

Device Motion

API 说明
wx.onDeviceMotionChange 监听Device direction change event. Frequency depends on the interval parameter of wx.startDeviceMotionListening(). Users can use wx.stopDeviceMotionListening() to stop monitoring.
wx.startDeviceMotionListening Start monitoring device direction changes
wx.stopDeviceMotionListening Stop monitoring device direction changes

Network

API 说明
wx.getNetworkType Acquire network type
wx.onNetworkStatusChange 监听Network status change event

NFC

API 说明
wx.getHCEState Decide if the current device supports HCE capabilities.
wx.onHCEMessage 监听NFC device message callback
wx.sendHCEMessage Send NFC message. Only effective under Android systems.
wx.startHCE Initialize NFC module.
wx.stopHCE Close NFC module. Only effective under Android systems.

Performance

API 说明
wx.onMemoryWarning 监听Insufficient memory warning event

Phone

API 说明
wx.makePhoneCall Make a phone call

Scan Code

API 说明
wx.scanCode Call the client code scanning interface to scan the code

Screen

API 说明
wx.getScreenBrightness Acquire screen brightness
wx.onUserCaptureScreen 监听The user's manual screenshot event, which will be triggered when the user uses the built-in screenshot button to capture the screen
wx.setKeepScreenOn Whether Settings maintain "always on" status or not. Effective only in the current Mini Program, it will no longer be in effect once the Mini Program exits.
wx.setScreenBrightness Set screen brightness

Vibrate

API 说明
wx.vibrateLong Make the phone vibrate for a long period of time (400 ms)
wx.vibrateShort Make the phone vibrate for a short period of time (15 ms). Only valid on iPhone 7/7 Plus and above and Android models

Wi-Fi

API 说明
wx.connectWifi Connect to Wi-Fi. If Wi-Fi information is already known, the interface can directly be used to connect. Only supported by Android and iOS above version 11.
wx.getConnectedWifi Retrieve Wi-Fi information of the active connection
wx.getWifiList Request to acquire the Wi-Fi list. In the onGetWifiList registration callback returns wifiList data.
iOS will jump to the system's Wi-Fi interface but Android will not. This method fails on iOS 11.0 and iOS 11.1 because of system problems with these two versions. But it is already fixed on iOS 11.2.
wx.onGetWifiList 监听Acquire Wi-Fi list data event
wx.onWifiConnected 监听"Connected to Wi-Fi" event
wx.setWifiList After a onGetWifiList callback, set AP's related information in the wifiList. iOS-specific interface.
wx.startWifi Initialize Wi-Fi module.
wx.stopWifi Close Wi-Fi module.
WifiInfo Wi-Fi information

UI

Animation

API 说明
wx.createAnimation Create an animation instance Call the example method to describe the animation. Finally, the animation data is exported through the export method of the animation instance and passed to the animation property of the component.

Animation

API 说明
Animation.backgroundColor Set the background color
Animation.bottom Set bottom value
Animation.export Export animation queue
Animation.height Set the height
Animation.left Set left value
Animation.matrix The same with transform-function matrix
Animation.matrix3d The same with transform-function matrix3d
Animation.opacity Set the transparency
Animation.right Set right value
Animation.rotate Rotate clockwise from the origin
Animation.rotate3d Rotate clockwise from the X axis
Animation.rotateX Rotate clockwise from the X axis
Animation.rotateY Rotate clockwise from the Y axis
Animation.rotateZ Rotate clockwise from the Z axis
Animation.scale Zoom
Animation.scale3d Zoom
Animation.scaleX Scale the X axis
Animation.scaleY Scale the Y axis
Animation.scaleZ Sale the Z axis
Animation.skew Tilt the X and Y axis coordinates
Animation.skewX Tilt the X axis coordinates
Animation.skewY Tilt the Y axis coordinates
Animation.step It means a group of animations is complete. Any number of animation methods can be called in a group of animations to make all the animations in the group simultaneously start. After one group is complete, the next group will start.
Animation.top Set top value
Animation.translate Translation transformation
Animation.translate3d Perform translation transformation of the xyz coordinates
Animation.translateX Perform translation transformation of the X axis
Animation.translateY Perform translation transformation of the Y axis
Animation.translateZ Perform translation transformation of the Z axis
Animation.width Set the width

Background

API 说明
wx.setBackgroundColor Dynamically set window background color
wx.setBackgroundTextStyle Dynamically set font and "loading" image style of pull-down background

Custom Component

API 说明
wx.nextTick Used to defer some operations until the next time slice (similar to setTimeout)

Interaction

API 说明
wx.hideLoading Hide loading prompt box
wx.hideToast Hide message prompt box
wx.showActionSheet
wx.showLoading Display loading prompt box, and it needs to call wx.hideLoading actively to close the prompt box
wx.showModal Display the modal dialog box
wx.showToast Display message prompt box
API 说明
wx.hideNavigationBarLoading Hide navigation bar and load animation on current page
wx.setNavigationBarColor
wx.setNavigationBarTitle Dynamically set current page title
wx.showNavigationBarLoading Display navigation bar and load animation on current page

Pulldown Refresh

API 说明
wx.startPullDownRefresh Begin to refresh by pulling down. Once called, it triggers pulling-down refresh animation with the same effect as the user's manual refresh by pulling down.
wx.stopPullDownRefresh Stop the pulling-down refresh on the current page.

Scroll

API 说明
wx.pageScrollTo Scroll the page to the target position

Sticky

API 说明
wx.setTopBarText Dynamically set text contents of the Move to Top bar, which can only take effect when the current Mini Program is moved to the top. If the current Mini Program is not moved to the top, it can also be successfully called, but it will not take effect immediately. The text content set will be appeared only when the user moves this Mini Program to the top.

Tab Bar

API 说明
wx.hideTabBar
wx.hideTabBarRedDot Hide red dot at the top right corner of a particular item of tabBar
wx.removeTabBarBadge Remove text at the top right corner of a particular item of tabBar
wx.setTabBarBadge Add text for the top right corner of a particular item of tabBar
wx.setTabBarItem Dynamically set the content of a particular item on tabBar
wx.setTabBarStyle Dynamically set the overall style of tabBar
wx.showTabBar
wx.showTabBarRedDot Display red dot at the top right corner of a particular item of tabBar

Window

API 说明
wx.offWindowResize 取消监听The window size change event
wx.onWindowResize 监听The window size change event

Open API

Access Token

API 说明
auth.getAccessToken Get Mini Program access_token

Account Info

API 说明
wx.getAccountInfoSync Obtain information of the current account

Address

API 说明
wx.chooseAddress Calls the user editing delivery address native interface and returns the user selected address after editing.

Authorize

API 说明
wx.authorize Initiate authorization requests to users in advance. Immediately after the call, a pop-up is shown to ask the user whether agree to authorize the Mini Program to use a function or get some user data, but the corresponding interface is not actually called. If the user has previously agreed to authorize, there will be no pop-up and success is returned directly. For more instructions, see User Authorization.

Card

API 说明
wx.addCard Add coupons in batch. Only authenticated Mini Programs can be used. For more documents, please refer to the WeChat coupon interface documentation.
wx.openCard View the coupons in WeChat Cards Offers. Only authenticated Mini Programs can be used. For more documents, please refer to the WeChat coupon interface documentation.

Customer Message

API 说明
customerServiceMessage.setTyping Issue the current input status of the customer service to users. For details, see Customer Service Message Input Status
customerServiceMessage.getTempMedia Mini Programs can use this interface to retrieve temporary materials (downloading temporary multimedia files) for customer service messages. Currently Mini Programs only support downloading of image files.
customerServiceMessage.send Send a customer service message to the user. For detailed rules, see Send Customer Service Messages
customerServiceMessage.uploadTempMedia Mini Programs can use this interface to upload media files (currently only supports images) to the WeChat server, messages that the user sends to customer service or messages that are passively replied to the user.

Data Analysis

API 说明
wx.reportAnalytics Custom analysis data reporting interface. Before use, it is required to create a new event in the custom analysis of the Mini Program admin console, configuring the event name and field.
analysis.getDailyRetain Obtain the daily retention of users accessing the Mini Program
analysis.getDailySummary Obtain the data overview of users accessing the Mini Program
analysis.getDailyVisitTrend Obtain the daily data trend of users accessing the Mini Program
analysis.getMonthlyRetain Obtain the weekly retention of users accessing the Mini Program
analysis.getMonthlyVisitTrend Obtain the monthly data trend of users accessing the Mini Program
analysis.getUserPortrait Obtain the portrait distribution data of new/active users of the Mini Program. The time period can be yesterday, last 7 days, or last 30 days. Number of new users is the number of users who accessed the Mini Program within the set time period for the first time, with duplicated users deleted. Number of active users is the number of users who had accessed the Mini Program within the set time period, with duplicated users deleted.
analysis.getVisitDistribution Obtain the distributed data of users accessing the Mini Program
analysis.getVisitPage Accessed page. Currently, only the top 200 sorted by page_visit_pv are provided.
analysis.getWeeklyRetain Obtain the weekly retention of users accessing the Mini Program
analysis.getWeeklyVisitTrend Obtain the weekly data trend of users accessing the Mini Program

Invoice

API 说明
wx.chooseInvoice Select the user owned fapiaos
wx.chooseInvoiceTitle Select user's fapiao title

Login

API 说明
wx.checkSession The user login status obtained through the wx.login interface has a certain timeliness. The longer the user does not use the Mini Program, the more likely the user login state will fail. Otherwise, if the user has been using the Mini Program, the user login state is always valid. The specific timeliness logic is maintained by WeChat and is transparent to developers. Developers only need to call the wx.checkSession interface to check whether the current user login status is valid. After the login status is expired, developers can call wx.login again to get new user login status. A successful call indicates the current session_key is not expired, and a failed call indicates the session_key is expired. See the Mini Program Login for more instructions.
wx.login Call the interface to get the login credentials (code) and then exchange the user login state information, including the user's unique identity (openid) and the session key (session_key) of the login. The encryption and decryption communication of user data depends on the session key. See the Mini Program Login for more instructions.
code2accessToken To check login credentials, acquire a temporary login credential code via the wx.login() interface, then pass it to the developer server and call the interface to complete the login process. See the Mini Program Login for more instructions.

Miniprogram Navigate

API 说明
wx.navigateBackMiniProgram Return to the previous Mini Program. The current Mini Program can only be successfully debugged when opened by another Mini Program
Note: Supported by WeChat iOS 6.5.9 and Android 6.5.10 and above.
wx.navigateToMiniProgram Open another Mini Program associated with the same Official Account (note: it must be the same Official Account and not the same Open Account)
Note: This interface will soon be abandoned. Please use the <navigator> module to use this feature.

Nearby MiniProgram

API 说明
nearbyPoi.add Add location
nearbyPoi.delete Delete location
nearbyPoi.getList View location list
nearbyPoi.setShowStatus Display/cancel display of Nearby Mini Program

Payment

API 说明
wx.faceVerifyForPay Face verification on each payment security scenario
wx.requestPayment Initiate WeChat payment. To find out more, please check WeChat Payment Interface Documentation

Plugin Management

API 说明
pluginManager.applyPlugin Request to use the plugin from the plugin developer
pluginManager.getPluginDevApplyList Obtain all current users of the plugin (called by the plugin developer)
pluginManager.getPluginList Query added plugins
pluginManager.setDevPluginApplyStatus Modify the status of request for using plugins (called by the plugin developer)
pluginManager.unbindPlugin Delete added plugins

QR-Code

API 说明
wxacode.createQRCode Obtain the Mini Program QR code, suitable for service scenarios that require a small number of codes. Mini Program QR codes generated by this API are permanently valid and limited in quantity. For details, see Obtain QR Code.
wxacode.get Obtain the Mini Program code, suitable for service scenarios that require a small number of codes. Mini Program QR codes generated by this API are permanently valid and limited in quantity. For details, see Obtain QR Code.
wxacode.getUnlimited Obtain the Mini Program code, suitable for service scenarios that require a large number of codes. **Mini Program QR codes generated by this API are permanently valid and currently not limited in quantity. ** For details, see Obtain QR Code.

Security Check

API 说明
security.imgSecCheck Detect whether a photo contains illegal content. Examples of application scenarios: (1) Intelligent detection of pornographic images: detection of photos taken and uploaded by users on tool-type apps related to photo-taking (such as Meipai or picture recognition apps), detection of product pictures on e-commerce platforms, detection of pictures in media users' articles; (2) Sensitive face recognition: users' profile photos, detection of pictures in media users' articles, detection of pictures uploaded by social media users. Frequency limitation: a single appId can be called up to 1,000 times per minute or 100,000 times per day
security.msgSecCheck Check whether a text segment contains illegal content. Examples of application scenarios: illegal text detection of users' personal profiles, detection of articles published by media and news users and comments, detection of materials edited and uploaded by game users (such as questions and answers submitted by users on Q&A games). Frequency limitation: a single appId can be called up to 2,000 times per minute or 1,000,000 times per day.

Setting

API 说明
wx.getSetting Retrieve the user's current settings. Only permissions that the Mini Program has requested from the user will be shown in the return value.
wx.openSetting Call up Mini Program Settings interface on the client to return the result of user settings. Only permissions that the Mini Program has requested from the user will be shown in the Settings interface.
Note: This interface will soon be abandoned. Please use the<button> component to use this feature.
AuthSetting

Bio-Auth

API 说明
wx.checkIsSoterEnrolledInDevice An interface to obtain whether biological information such as fingerprints is entered into the device
wx.checkIsSupportSoterAuthentication Acquire the SOTER biometric authentication method supported by this device
wx.startSoterAuthentication Start SOTER biometric authentication. For the verification process, please refer to Explanation.

Template Message

API 说明
templateMessage.addTemplate Group the templates and add to personal template library in the account
templateMessage.deleteTemplate Delete certain template under the account
templateMessage.getTemplateLibraryById Obtaining the keyword library under a certain template title from the template library
templateMessage.getTemplateLibraryList Obtain the Mini Program template library title list
templateMessage.getTemplateList Retrieve the existing template list under the account
templateMessage.send Send Templated Messages

Uniform Message

API 说明
uniformMessage.send Issue unified service information for Mini Programs and Official Accounts

User Info

API 说明
wx.getUserInfo Get user information.
UserInfo

Werun

API 说明
wx.getWeRunData Retrieving user's WeRun step counts over the last 30 days requires calling the wx.login interface first.

Update

API 说明
wx.getUpdateManager Acquire globally unique version update manager for managing Mini Program updates. For the update mechanism of Mini Programs, refer to the Operating Mechanism document.

UpdateManager

API 说明
UpdateManager.applyUpdate When a new version of a Mini Program is downloaded (i.e. get the onUpdateReady callback), the Mini Program is forced to restart and uses the new version
UpdateManager.onCheckForUpdate 监听Request the update results checking event to the WeChat background. WeChat automatically checks updates when Mini programs are cold start, without being triggered by developers.
UpdateManager.onUpdateFailed 监听The Mini Program update failure event When there is a new version of a Mini Program, clients will actively trigger downloads (without triggered by developers), and conduct callbacks after downloads fail (possibly due to network reasons, etc.)
UpdateManager.onUpdateReady 监听Mini Programs have a version update event. Clients actively trigger downloads (without triggered by developers), and conduct callbacks after downloads succeed.

Worker

API 说明
wx.createWorker Create a [Worker thread] (Multi-thread Worker). Currently a maximum of one Worker can only be created, so please call Worker.terminate before creating the next Worker.

Worker

API 说明
Worker.onMessage 监听The event of the message sent by the main thread/worker thread to the current thread
Worker.postMessage The message sent to the main thread/worker thread
Worker.terminate End the current worker thread. The method can only be called on the worker object on the main thread.

Report

API 说明
wx.reportMonitor Customized business data monitor reporting interface.

Base

API 说明
wx.canIUse Determine whether a Mini Program's API, callbacks, parameters, components etc. can be used in the current version.

Canvas

API 说明
wx.canvasGetImageData Return one array, used for describing pixel data implied in the "canvas". Under custom components, the second parameter is passed to the custom component instance "this" to operate the <canvas> component.
wx.canvasPutImageData Method for drawing pixel data on canvas. Under custom components, the second parameter is passed to the custom component instance "this" to operate the <canvas> component
wx.canvasToTempFilePath Export the content in the specified area of the canvas and generate an image of the specified size, and return the file path. Only calling this method in draw() callback can guarantee the successful output of the image. Under custom components, the second parameter is passed to the custom component instance "this" to operate the <canvas> component.
wx.createCanvasContext Drawing context of the <canvas> component creation

CanvasContext

API 说明
CanvasContext.arc Draw an arc.
CanvasContext.arcTo Render circular arc path according to control point and radius.
CanvasContext.beginPath Start creating a path. Only when "fill" or "stroke" is called, the path is used for filling or stroking.
CanvasContext.bezierCurveTo Create cubic Bezier curve path.
CanvasContext.clearRect Clear the content in the rectangular area on the canvas
CanvasContext.clip The clip() method cuts any shape and size from the original canvas. Once an area is cut, all subsequent drawings will be limited to within the cut area (other areas of the canvas will not be accessible). The current canvas area can be saved using the save() method before using clip() method, it can be recovered anytime after then (using the restore() method).
CanvasContext.closePath Close a path
CanvasContext.createCircularGradient Create a round gradient color. The starting point is the circle center and the end point is on the circle. Returned gradient object requires CanvasGradient.addColorStop() to specify the gradient points (two at least).
CanvasContext.createLinearGradient Create a linear gradient color. Returned gradient object requires CanvasGradient.addColorStop() to specify the gradient points (two at least).
CanvasContext.createPattern For the method that creating mode for specified image, meta images can be repeated in the specified direction
CanvasContext.draw Draw previous description (path, distortion, style) in the drawing context onto "canvas".
CanvasContext.drawImage Draw the image to the canvas
CanvasContext.fill Fill in content for the current path. The default fill color is black.
CanvasContext.fillRect Fill a rectangle
CanvasContext.fillText Draw filled text on the canvas
CanvasContext.lineTo lineTo method, which adds a new point and creates a line from the last specified point to the target point
CanvasContext.measureText Dimensions of measurement, currently only returns text width. Sync interface.
CanvasContext.moveTo Move path to assigned point within the canvas; do not create lines.
CanvasContext.quadraticCurveTo Create quadratic Bezier curve path
CanvasContext.rect Create a rectangular path
CanvasContext.restore Restore previously saved drawing context.
CanvasContext.rotate Use the original point as the center, which can be modified by the translate() method. Rotate the current coordinate axis clockwise. The rotation angle will be overlaid if rotate() is called for multiple times.
CanvasContext.save Save the drawing context.
CanvasContext.scale After the scale() method is called, horizontal coordinates of the path created later will be scaled. The scale factors will be multiplied if scale() is called for multiple times.
CanvasContext.setFillStyle Set the fill color. The default color is black
CanvasContext.setFontSize Set the font size
CanvasContext.setGlobalAlpha Set the global transparency of a brush.
CanvasContext.setLineCap Set the line end style
CanvasContext.setLineDash Method to set the dotted line style.
CanvasContext.setLineJoin Set the intersection style of the line
CanvasContext.setLineWidth Set the width of the line
CanvasContext.setMiterLimit Set the maximum miter length. Miter length refers to the distance between the interior and exterior angles at the intersection of two lines. The setting is valid only when the value of CanvasContext.setLineJoin() is miter. If the miter length exceeds the maximum skew length, the intersection is displayed with lineJoin as bevel.
CanvasContext.setShadow Set the shadow style. If it is not set, the default values of offsetX, offsetY, blur, and color are 0, 0, 0, and black respectively.
CanvasContext.setStrokeStyle Set the stroke color. The default color is black
CanvasContext.setTextAlign Set the text alignment
CanvasContext.setTextBaseline Set the vertical alignment of the text
CanvasContext.setTransform Reset (overwrite) current transformation method using matrix
CanvasContext.stroke Draw current path's border, and the default color is black.
CanvasContext.strokeRect Draw a rectangle (non-fill)
CanvasContext.strokeText Method for drawing text stroke for fixed (x,y) position
CanvasContext.transform Method for using matrix to overlay the current transformation multiple times
CanvasContext.translate Transform the origin (0, 0) of the current coordinate system. The default origin is the top left corner of the page.

CanvasGradient

API 说明
CanvasGradient.addColorStop Add gradient points

Debug

API 说明
wx.getLogManager Obtain the log manager object
wx.setEnableDebug Set to turn debug switch on/off, this switch is also valid in the official version.

LogManager

API 说明
LogManager.debug Write debug log
LogManager.info Write info log
LogManager.log Write log
LogManager.warn Write warn log

Third-party platform

API 说明
wx.getExtConfig Acquire third party platformcustom data field
wx.getExtConfigSync Sync version of wx.getExtConfig

undefined

API 说明
wx.createMapContext Create the MapContext object of the map context.

MapContext

API 说明
MapContext.getCenterLocation Obtain the altitude and longitude of the current map center. The gcj02 coordinate system is returned, which can be used for wx.openLocation()
MapContext.getRegion Acquire the scope of the field of view of the current map
MapContext.getScale Acquire the degree of scaling of the current map
MapContext.includePoints Scale the field of view to display all latitude and longitude degrees
MapContext.moveToLocation Move the center of the map to the current set position. Needs to be used in coordination with the map component's show-location
MapContext.translateMarker Translation market, animated

Route

API 说明
wx.navigateBack Close the current page, return to the previous page or multi-level page. The current page stack can be acquired through getCurrentPages() to determine the number of layers to be returned.
wx.navigateTo Keep the current page and jump to another page within the app (but not the tabBar page). Use wx.navigateBack to return to the original page.
wx.redirectTo Close the current page and jump to another page within the app. Jumping to the tabBar page is not allowed.
wx.reLaunch Close all pages and open a particular page within the app
wx.switchTab Jump to tabBar page and close all other non-tabBar pages

Share

API 说明
wx.getShareInfo Retrieve forwarding details
wx.hideShareMenu Hide the forward button
wx.showShareMenu Display the forward button of the current page
wx.updateShareMenu Update forwarding attributes

System

System Info

API 说明
wx.getSystemInfo Acquire system information
wx.getSystemInfoSync wx.getSystemInfo 的同步版本

Timer

API 说明
clearInterval The timer set by the setInterval() method can be cancelled.
clearTimeout The timer set by the setTimeout() method can be cancelled.
setInterval Set a timer. Execute the registered callback function according to a set period (in milliseconds)
setTimeout Set a timer. When the set time is reached, the registered callback function is executed

WXML

API 说明
wx.createIntersectionObserver Create and return an IntersectionObserver object instance. In the custom component you can use this.createIntersectionObserver([options]) as a replacement.
wx.createSelectorQuery Return a SelectorQuery object instance.

IntersectionObserver

API 说明
IntersectionObserver.disconnect Stop monitoring. Callback function will no longer be triggered.
IntersectionObserver.observe Specify a target node and start monitoring changes of the intersection state
IntersectionObserver.relativeTo Use the selector to specify one node as one of the reference areas
IntersectionObserver.relativeToViewport Specify the displayed page area as one of the reference areas

NodesRef

API 说明
NodesRef.boundingClientRect Query request for adding node deployment position, equivalent to display area in pixels. This feature is similar to getBoundingClientRect of DOM. Returned value is SelectorQuery, which corresponds to NodesRef.
NodesRef.fields Obtain information about the node. Fields to be obtained are specified in fields. Returned value is selectorQuery, which corresponds to nodesRef
NodesRef.scrollOffset Query request for adding scrolling position of node (in pixels). The node must be scroll-view or viewport, and SelectorQuery is returned, which corresponds to NodesRef.

SelectorQuery

API 说明
SelectorQuery.exec Execute all requests, request results form an array according to request order, return in the first parameter of callback.
SelectorQuery.in Change the selection scope of the selector to within the custom component component (initially, the selector only selects nodes within the scope of the page, but nodes in the custom component will not be selected).
SelectorQuery.select Select the node of the first matching selector in the current page, and a NodesRef object instance is returned for node information.
SelectorQuery.selectAll Select all nodes of the matching selector in the current page.
SelectorQuery.selectViewport Select the display area, which can be used to obtain information such as the dimensions of the display area and scrolling position.