# Upload voice files
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: addVoiceTorecoForText
This interface is used for uploading voice files for transcoding recognition
# 1. How to call
# HTTPS calls
POST https://api.weixin.qq.com/cgi-bin/media/voice/addvoicetorecofortext?access_token=ACCESS_TOKEN&format=FORMAT&voice_id=VOICE_ID&lang=LANG
# Cloud Calls
- This interface does not support cloud calls
# Third party invocation
- Third Party Platform calls are not supported by this interface.
# 2. Request parameters
# Query parametersQuery String parameters
Parameter Name | type | Required to fill in | Example | Introductions |
---|---|---|---|---|
access_token | string | yes | ACCESS_TOKEN | Interface invoke credentials, using access_token |
format | string | yes | mp3 | Document format (mp3,16k only, mono, 1M max) |
voice_id | string | yes | xxxxxx | Voice unique identifier |
lang | string | no | zh_CN | Language, zh_CN or en_US, default Chinese |
# Request BodyRequest Payload
Parameter Name | type | Required to fill in | Introductions |
---|---|---|---|
media | formdata | yes | Voice content |
# 3. Return Parameters
# Response Payload
Parameter Name | type | Introductions |
---|---|---|
errcode | string | Error code |
errmsg | string | Error message |
# 4. Note
There are no special considerations for this interface
# 5. Code examples
Example Requests
https://api.weixin.qq.com/cgi-bin/media/voice/addvoicetorecofortext?access_token=ACCESS_TOKEN&format=&voice_id=xxxxxx&lang=zh_CN
Return an example
{
"errmsg": "ok",
"errcode": "0"
}
# 6. Error code
The following is a list of error codes for this interface, other error codes can refer to General error codes
Error code | Error Description | Solutions |
---|---|---|
-1 | system error | The system is busy, so the developer is asked to try again in a few minutes. |
40001 | invalid credential access_token isinvalid or not latest | AppSecret error while getting access_token, or access_token is invalid.Developers should check that AppSecret is correct, or that they are calling interfaces for the appropriate Official Account |
40010 | invalid voice size | Illegal voice file size |
# 7. Scope of application
How this interface can be invoked under different account types:
Weixin Mini Program | Official Account | Service Account | MiniGame | Mobile App |
---|---|---|---|---|
✔ | ✔ | ✔ | ✔ | ✔ |
- ✔: The account can call this interface
- Other account types that are not expressly stated may not be called on this interface without special instructions;