tencent cloud

All product documents
Tencent Cloud Super App as a Service
API Overview
Last updated: 2025-04-10 16:37:38
API Overview
Last updated: 2025-04-10 16:37:38

1. Basic

1.1 System capabilities

Name
Feature description
Minimum version
canIUse
Checks whether the APIs, callbacks, parameters, and components of the mini game are supported in the current version.
2.0.9
env
Environment variables.
2.0.9

1.2 System

Name
Feature description
Minimum version
Asynchronously gets system information.
2.0.9
Synchronously gets system information.
2.0.9
Asynchronously gets system information.
2.0.9
Gets window information.
2.0.9
Gets device settings.
2.0.9
Gets basic information of the device.
2.0.9
Gets basic information of the superapp.
2.0.9
Gets authorization settings of the superapp.
2.0.9

1.3 Update

Name
Feature description
Minimum version
Gets the global unique version update manager for managing game updates.
2.0.9
Forces the mini game to restart and use the new version.
2.0.9
Listens for the result of the update check request to the backend.
2.0.9
Listens for game update failure events.
2.0.9
Listens for game version update events.
2.0.9

1.4 Mini program

Name
Feature description
Minimum version
Gets the parameters when the mini game is launched.
2.0.9
Gets the parameters when the mini game is launched this time.
2.0.9
onError
Listens for mini program error events.
2.0.9
offError
Removes the listener for mini program error events.
2.0.9
onShow
Listens for the event when the mini game returns to the frontend.
2.0.9
onHide
Listens for the event when the mini game returns to the backend.
2.0.9
offShow
Removes the listener for events when the game returns to the frontend.
2.0.9
offHide
Removes the listener for events when the game is hidden to the backend.
2.0.9

1.5 Debugging

Name
Feature description
Minimum version
Sets whether to enable the debugging.
2.0.9
Gets the log manager object.
2.0.9
Prints debug logs to the debug panel.
2.0.9
Prints error logs to the debug panel.
2.0.9
Creates a new group in the debug panel.
2.0.9
Ends a group created by console.group.
2.0.9
Prints info logs in the debugging panel.
2.0.9
Prints log logs to the debug panel.
2.0.9
Prints warn logs to the debug panel.
2.0.9
Writes debug logs.
2.0.9
Writes info logs.
2.0.9
Writes log messages.
2.0.9
Writes warning logs.
2.0.9
Adds filter keywords.
2.0.9
Writes error logs.
2.0.9
Gets the current cache remaining space.
2.0.9
Sets the page parameter for real-time logs
2.0.9
Writes info logs.
2.0.9
Sets filter keywords.
2.0.9
Writes warning logs.
2.0.9

1.6 Performance

Name
Feature description
Minimum version
triggerGC
Accelerates triggering of JavaScriptCore garbage collection (GC).
2.0.9
Gets performance manager.
2.0.9
Performance manager.
2.0.9

1.7 Subpackage

Name
Feature description
Minimum version
Triggers subpackage pre-download.
2.0.9
Triggers subpackage loading. For details, see Subpackage Loading
2.0.9
Instance of a subpackage loading task, used to get the loading status of the subpackage.
2.0.9
Instance of a subpackage pre-download task, used to get the pre-download status of the subpackage.
2.0.9

2. Navigation

Name
Feature description
Minimum version
Exits the current mini program.
2.0.9
Opens another mini program.
2.0.9
Returns to the previous mini program. This API can be called successfully only when the current mini program is opened by another mini program.
2.0.9

3. Share

Name
Feature description
Minimum version
Hides the Share button on the current page.
2.0.9
Shows the Share button on the current page.
2.0.9
Updates the sharing properties.
2.0.9
Opens the pop-up window for image sharing.
2.0.9
onCopyUrl
Listens for the event triggered when the user taps the “Copy link” button in the top right menu.
2.0.9
Removes all listener functions for the event triggered when the user taps the “Copy link” button in the top right menu.
2.0.9

4. Interface

4.1 Interaction

Name
Feature description
Minimum version
Hides the loading prompt box.
2.0.9
hideToast
Hides the message prompt box.
2.0.9
Shows the action menu.
2.0.9
Shows the loading prompt box.
2.0.9
showModal
Shows the modal dialog box.
2.0.9
showToast
Shows the message prompt box.
2.0.9

4.2 Menu

Name
Feature description
Minimum version
Gets the layout position information of the menu button (capsule button in the top right corner).
2.0.9

5. Network

5.1 Make request

Name
Feature description
Minimum version
request
Initiates an HTTPS network request.
2.0.9
Aborts the request task.
2.0.9
Listens for the Transfer-Encoding Chunk Received event.
2.0.9
Removes the listener for the Transfer-Encoding Chunk Received event.
2.0.9
Listens for the HTTP Response Header event.
2.0.9
Removes the listener for the HTTP Response Header event.
2.0.9

5.2 Upload

Name
Feature description
Minimum version
Uploads local resources to the server.
2.0.9
Aborts the upload task.
2.0.9
Listens for upload progress change events.
2.0.9
Cancels the listener for upload progress change events.
2.0.9
Listens for the HTTP Response Header event.
2.0.9
Removes the listener for the HTTP Response Header event.
2.0.9

5.3 Download

Name
Feature description
Minimum version
Downloads file resources to the local device. The client initiates an HTTPS GET request and returns the local temporary path of the file. The maximum allowed file size for a single download is 200 MB.
2.0.9
Aborts the download task.
2.0.9
Listens for download progress change events.
2.0.9
Removes the listener for download progress change events.
2.0.9
Listens for the HTTP Response Header event.
2.0.9
Removes the listener for the HTTP Response Header event.
2.0.9

5.4 WebSocket

Name
Feature description
Minimum version
Sends data through a WebSocket connection. You need to call wx.connectSocket first and send data after the wx.onSocketOpen callback.
2.0.9
Listens for WebSocket connection open events.
2.0.9
Listens for messages received from the server through WebSocket.
2.0.9
Listens for WebSocket error events.
2.0.9
Listens for WebSocket connection close events.
2.0.9
Creates a WebSocket connection.
2.0.9
Disables a WebSocket connection.
2.0.9
Disables a WebSocket connection.
2.0.9
Listens for WebSocket connection close events.
2.0.9
Listens for WebSocket error events.
2.0.9
Listens for messages received from the server through WebSocket.
2.0.9
Listens for WebSocket connection open events.
2.0.9
Sends data through a WebSocket connection.
2.0.9

6. Data cache

Name
Feature description
Minimum version
Stores the data in local cache under the specified key.
2.0.9
Stores the data in local cache under the specified key.
2.0.9
Destroys data in memory based on the URL.
2.0.9
Removes the specified key from the local cache.
2.0.9
Synchronously removes the specified key from local cache.
2.0.9
Asynchronously gets the content of the specified key from the local cache.
2.0.9
Creates a unique URL in memory based on the provided buffer.
2.0.9
Synchronously gets the content of the specified key from the local cache.
2.0.9
Asynchronously gets the information of the current storage.
2.0.9
Synchronously gets the information of the current storage.
2.0.9
Clears the local data cache.
2.0.9
Synchronously clears local data cache.
2.0.9

7. Rendering

7.1 Canvas

Name
Feature description
Minimum version
Creates a canvas object.
2.0.9
Canvas
Canvas object.
2.0.9
Gets the drawing context of a canvas object.
2.0.9
Returns the content drawn on the canvas as a data URI.
2.0.9
Drawing context of the canvas object.
2.0.9

7.2 Frame rate

Name
Feature description
Minimum version
Modifies the rendering frame rate.
2.0.9
Cancels an animation frame request added by requestAnimationFrame.
2.0.9
Schedules a callback to be executed before the next repaint.
2.0.9

7.3 Font

Name
Feature description
Minimum version
loadFont
Loads the custom font file.
2.0.9
Gets the line height of a text.
2.0.9

7.4 Image

Name
Feature description
Minimum version
Creates an image object.
2.0.9
Image
Image object.
2.0.9

8. Media

8.1 Audio

Name
Feature description
Minimum version
Sets the playback options for InnerAudioContext.
2.0.9
Gets the currently supported audio input sources.
2.0.9
Creates the InnerAudioContext object of the internal component audio.
2.0.9
Terminates the current instance.
2.0.9
Removes the listener for the event when audio can start playing.
2.0.9
Removes the listener for the event when audio ends.
2.0.9
Removes the listener for audio playback error events.
2.0.9
Removes the listener for audio pause events.
2.0.9
Removes the listener for audio playback events.
2.0.9
Removes the listener function for the event when audio seeking is completed.
2.0.9
Removes the listener for audio seeking events.
2.0.9
Removes the listener for audio stop events.
2.0.9
Removes the listener for audio playback progress update events.
2.0.9
Removes the listener for audio loading events.
2.0.9
Listens for the event when audio can start playing.
2.0.9
Listens for the event when audio ends.
2.0.9
Listens for audio playback error events.
2.0.9
Listens for audio pause events.
2.0.9
Listens for audio playback events.
2.0.9
Listens for the event when audio seeking is completed.
2.0.9
Listens for audio seeking events.
2.0.9
Listens for audio stop events.
2.0.9
Listens for audio playback progress update events.
2.0.9
Listens for audio loading events.
2.0.9
Pause the audio.
2.0.9
Plays the audio.
2.0.9
Seeks to a specified position in the audio.
2.0.9
Stop the audio.
2.0.9

8.2 Image

Name
Feature description
Minimum version
Specifies to choose an image from the local album or take a photo.
2.0.9
Compresses images with optional quality settings.
2.0.9
Previews an image in full screen on a new page.
2.0.9
Saves an image to the system album.
2.0.9

9. Location

Name
Feature description
Minimum version
Gets the current geographical location and speed.
2.0.9
Gets the current fuzzy geographic location.
2.0.9

10. File

10.1 File summary

Name
Description
Minimum version
Gets the globally unique file manager.
2.0.9
Result of file read operation.
2.0.9
Result of file write operation.
2.0.9

10.2 FileSystemManager

API
Description
Minimum version
Checks if a file/directory exists.
2.0.9
Synchronously checks if a file/directory exists.
2.0.9
Appends content to the end of a file.
2.0.9
Synchronously appends content to the end of a file.
2.0.9
Closes a file.
2.0.9
Synchronously closes a file.
2.0.9
Copies a file.
2.0.9
Synchronously copies a file.
2.0.9
Gets status information of a file.
2.0.9
Synchronously gets status information of a file.
2.0.9
Truncates the file contents.
2.0.9
Synchronously truncates the file contents.
2.0.9
Gets the information of local temporary file or local cache file in this mini program.
2.0.9
Gets the list of local cache files saved in this mini program.
2.0.9
Creates a directory.
2.0.9
Synchronously creates a directory.
2.0.9
Opens a file and returns a file descriptor.
2.0.9
Synchronously opens a file and returns a file descriptor.
2.0.9
Reads a file.
2.0.9
Synchronously reads a file.
2.0.9
Reads the local file contents of the specified compression type.
2.0.9
Synchronously reads the local file contents of specified compression type.
2.0.9
Reads the list of files in the directory.
2.0.9
Synchronously reads the list of files in the directory.
2.0.9
Reads local file contents.
2.0.9
Synchronously reads local file contents.
2.0.9
Read files in a compressed package.
2.0.9
Deletes saved local cache files in this mini program.
2.0.9
Renames a file.
2.0.9
Synchronously renames a file.
2.0.9
Deletes a directory.
2.0.9
Synchronously deletes a directory.
2.0.9
Saves temporary files to local.
2.0.9
Synchronously saves temporary files to local.
2.0.9
Gets a file Stats object.
2.0.9
Synchronously gets a file Stats object.
2.0.9
Truncates the file contents.
2.0.9
Synchronously truncates file contents.
2.0.9
Deletes a file.
2.0.9
Synchronously deletes a file.
2.0.9
Decompresses a file.
2.0.9
Writes to a file.
2.0.9
Synchronously writes to a file.
2.0.9
Writes a file.
2.0.9
Synchronously writes a file.
2.0.9

10.3 Stats

API
Description
Minimum version
Checks whether the current file is a directory.
2.0.9
Checks whether the current file is a normal file.
2.0.9

11. Open APIs

11.1 Login

Name
Feature description
Minimum version
login
Calls the API to get the login credential (code).
2.0.9
Checks if the login session has expired.
2.0.9

11.2 Account information

Name
Feature description
Minimum version
Gets the current account information.
2.0.9

11.3 User information

Name
Feature description
Minimum version
Gets user information, requires user authorization for scope.userInfo.
2.0.9
userInfo
User information.
2.0.9

11.4 Settings

Name
Feature description
Minimum version
User’s authorization settings information.
2.0.9
Gets the user's current settings.
2.0.9
Opens the mini program settings interface and returns the user's operation results.
2.0.9

11.5 Authorization

Name
Feature description
Minimum version
authorize
Initiates an authorization request to the user in advance.
2.0.9

11.6 Privacy information authorization

Name
Feature description
Minimum version
Simulates a privacy API call and triggers the privacy popup logic.
2.0.9
Listens for the event where the privacy API requires user authorization.
2.0.9

12. Device

12.1 Keyboard

Name
Feature description
Minimum version
Updates the content in the keyboard input box.
2.0.9
Displays the keyboard.
2.0.9
Listens for keyboard input events.
2.0.9
Listens for keyboard height change events.
2.0.9
Listens for the event where the user taps the Done button on the keyboard.
2.0.9
Listens for the event when the keyboard is hidden.
2.0.9
Removes the listener for keyboard input events.
2.0.9
Removes the listener for keyboard height change events.
2.0.9
Removes the listener for the event when the user taps the Done button on the keyboard.
2.0.9
Removes the listener for the event when the keyboard is hidden.
2.0.9
Hides the keyboard.
2.0.9

12.2 Touch

Name
Feature description
Minimum version
Listens for the start of a touch event.
2.0.9
Listens for touch move events.
2.0.9
Listens for the end of a touch event.
2.0.9
Listens for touch cancel events.
2.0.9
Removes the listener for the touch start event.
2.0.9
Removes the listener for the touch move event.
2.0.9
Removes the listener for the touch end event.
2.0.9
Removes the listener for the touch cancel event.
2.0.9
Touch
A touch point on a touch device.
2.0.9

12.3 Battery

Name
Feature description
Minimum version
Synchronously gets battery information of the device.
2.0.9
Gets battery information of the device.
2.0.9

12.4 Clipboard

Name
Feature description
Minimum version
Sets the content of the system clipboard.
2.0.9
Gets the content of the system clipboard.
2.0.9

12.5 Network

Name
Feature description
Minimum version
Listens for network status change events.
2.0.9
Gets the network type.
2.0.9
Removes the listener for network status change events.
2.0.9

12.6 Screen

Name
Feature description
Minimum version
Sets the screen performance during screenshot/recording.
2.0.9
Sets the screen brightness.
2.0.9
Sets whether to keep the screen on.
2.0.9
Listens for user-initiated screenshot events.
2.0.9
Listens for user screen recording events.
2.0.9
Removes the listener for user-initiated screenshot events.
2.0.9
Removes the listener for user screen recording events.
2.0.9
Checks if the user is recording the screen.
2.0.9
Gets the screen brightness.
2.0.9

12.7 Accelerometer

Name
Feature description
Minimum version
Starts listening for accelerometer data.
2.0.9
Stops listening for acceleration data.
2.0.9
Listens for accelerometer data change events.
2.0.9
Removes the listener for accelerometer data events.
2.0.9

12.8 Compass

Name
Feature description
Minimum version
Starts listening for compass data.
2.0.9
Stops listening for compass data.
2.0.9
Listens for compass data change events.
2.0.9
Removes the listener for compass data change events.
2.0.9

12.9 Device motion

Name
Feature description
Minimum version
Stops listening for device motion changes.
2.0.9
Starts listening for device motion changes.
2.0.9
Listens for device motion change events.
2.0.9
Removes the listener for device motion change events.
2.0.9

12.10 Screen orientation

Name
Feature description
Minimum version
Listens for screen orientation change events.
2.0.9
Removes the listener for screen orientation change events.
2.0.9

12.11 Gyroscope

Name
Feature description
Minimum version
Starts listening for gyroscope data.
2.0.9
Stops listening for gyroscope data.
2.0.9
Listens for gyroscope data change events.
2.0.9
Removes the listener for gyroscope data change events.
2.0.9

12.12 Memory

Name
Feature description
Minimum version
Listens for memory warning events.
2.0.9
Removes the listener for the low memory warning events.
2.0.9

12.13 Vibration

Name
Feature description
Minimum version
Causes a short vibration (15 ms).
2.0.9
Causes a long vibration (400 ms).
2.0.9

13. Worker

Name
Feature description
Minimum version
Creates a Worker thread.
2.0.9
Worker
Worker instance, which can be obtained in the main thread via wx.createWorker , or in the worker thread via the global variable worker.
2.0.9
Listens for messages sent from the main thread/worker thread to the current thread.
2.0.9
Messages sent to the main/Worker thread.
2.0.9
Ends the current Worker thread.
2.0.9

14. Ad

Name
Feature description
Minimum version
Creates a rewarded video ad component.
2.2.3
Creates a banner ad component.
2.2.3
Rewarded video ad component.
2.2.3
Destroys a rewarded video ad instance.
2.2.3
Loads a rewarded video ad.
2.2.3
Removes the listener for the event when a user taps the close button.
2.2.3
Removes the listener for rewarded video error events.
2.2.3
Removes the listener for the rewarded video ad loading event.
2.2.3
Listens for the event when a user taps the close button.
2.2.3
Listens for rewarded video error events.
2.2.3
Listens for the rewarded video ad loading event.
2.2.3
Shows a rewarded video ad.
2.2.3
BannerAd
Banner ad components.
2.2.3
Destroys a banner ad.
2.2.3
Hides a banner ad.
2.2.3
Removes the listener for banner ad error event.
2.2.3
Removes the listener for the banner ad loading event.
2.2.3
Removes the listener for the banner ad size change event.
2.2.3
Listens for banner ad error event.
2.2.3
Listens for the banner ad loading event.
2.2.3
Listens for the banner ad size change event.
2.2.3
Shows a banner ad.
2.2.3




Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback

Contact Us

Contact our sales team or business advisors to help your business.

Technical Support

Open a ticket if you're looking for further assistance. Our Ticket is 7x24 available.

7x24 Phone Support