Official Accounts often require temporary assets. For example, API calls, particularly such operations as sending messages, as well as obtaining and calling multimedia files and multimedia messages are performed via media_id. The Media Asset Management API is available to all verified Subscription Accounts and Service Accounts. Official Accounts can use this API to add temporary assets (that is, to upload temporary multimedia files).


  1. The media_id of temporary asset can be reused.

  2. Media files can be saved on Weixin backend for three days. The media_id will expire in three days.

  3. The format and size restrictions for temporary assets to be uploaded are the same as shown on the Official Accounts Platform.

Image: 10 MB. PNG, JPEG, JPG, and GIF formats are supported.

Voice: 2 MB. The maximum length is 60s. AMR and MP3 formats are supported.

Video: 10 MB. The MP4 format supported.

Thumbnail: 64 KB. The JPG format supported.

  1. This API must be called using HTTPS.

API Request Format

HTTP request method: POST/FORM. HTTPS protocol is used.
Calling Example (using the curl command to upload a multimedia file via FORM):
curl -F media=@test.jpg ""


Parameter Required Description
access_token Yes The credential for API call
type Yes Media file types, including images (parameter = "image"), voice (parameter = "voice"), videos (parameter = "video"), and thumbnails (parameter = "thumb").
media Yes The identifier of the media file in form-data, including information such as filename, filelength, and content-type.

Response Description

The returned JSON packet for a successful request is as follows:

Parameter Description
type Media file types, including images (parameter = "image"), voice (parameter = "voice"), videos (parameter = "video"), and thumbnails (parameter = "thumb", mainly for videos and music files)
media_id The ID obtained after the media file is uploaded
created_at Upload timestamp of the media file

The returned JSON packet for a failed request (this is an example of invalid media type):

{"errcode":40004,"errmsg":"invalid media type"}

Debug this API using webpage debugging tool