Skip to content
Platform / Docs / M4A to MP3 API

API Reference

M4A to MP3 API

REQUEST m4a2mp3-api ID 41

Convert a public m4a URL to mp3 for playback, transcription, or editing.

REQUEST https://xiaoapis.com/api/audio/m4a2mp3

Overview

  • m4a→mp3
  • 可指定码率
  • 返回 mp3 地址

Use cases

  • 格式统一
  • 转写前预处理
  • 播放兼容
Conventions
  • Gateway · https://xiaoapis.com
  • Auth · send key (query or JSON body, as this API specifies)
  • Response · JSON. Check the business code and the HTTP status, not only HTTP 200

Authentication

Send the platform API key (query parameter key or JSON field key, as this page specifies). Create one in API key management.

REQUEST https://xiaoapis.com/api/audio/m4a2mp3
Content-Type: application/json

{
  "key": "YOUR_API_KEY"
}

Request example

/api/audio/m4a2mp3?key=你的密钥&url=https://example.com/audio.m4a&bitrate=128

Details

请求HEADER:

名称值
Content-Typeapplication/x-www-form-urlencoded;charset:utf-8;
Content-Typeapplication/json(JSON 提交时)

请求参数说明:

名称必填类型示例值说明
key是string35kj5jnlj53453kl5j43nj5接口密钥,在控制台->密钥管理查看
url是stringhttps://example.com/audio.m4a待转换的 m4a 公网地址,必须是 http/https。兼容 audio_url、m4a_url
audio_url否stringhttps://example.com/audio.m4aurl 的别名,url 为空时生效
m4a_url否stringhttps://example.com/audio.m4aurl 的别名,url、audio_url 都为空时生效
bitrate否int128输出 MP3 码率,单位 kbps。仅支持 64 / 96 / 128 / 192 / 256 / 320,默认 128
output_name否stringvoice_001输出文件名(不含扩展名),仅允许字母数字下划线和中划线;不传则自动生成

返回参数说明:

名称类型说明
codeint状态码,200 表示转换成功
msgstring状态信息
dataobject转换结果
data.urlstring转换后的 MP3 公网地址
data.audio_urlstring与 data.url 相同,方便按音频字段取值
data.bytesintMP3 文件大小,单位字节
data.bitrateint实际使用的码率,单位 kbps
data.durationfloat音频时长,单位秒;探测失败时为 0
data.job_idstring本次转换任务编号
debugstring/array调试数据
exec_timefloat执行耗时
ipstring客户端IP

使用说明:

项目说明
请求方式同时支持 GET、POST、JSON
转换原理本机 ffmpeg 将 AAC/M4A 解码后用 libmp3lame 重新编码为 MP3,不是改后缀
文件限制仅接受公网可访问地址,单文件不超过 80MB
计费转换成功后按后台 consume 扣点,失败不扣

Response example

{"code":200,"msg":"转换成功","data":{"url":"https://xiaoapis.com/upload/audio_convert/2026/08/31/m4a_20260831100000_abcd1234.mp3","audio_url":"https://xiaoapis.com/upload/audio_convert/2026/08/31/m4a_20260831100000_abcd1234.mp3","bytes":123456,"bitrate":128,"duration":12.5,"job_id":"m4a_20260831100000_abcd1234"},"exec_time":1.234567,"ip":"1.2.3.4"}

Error codes

错误码类型说明
200int转换成功
400int参数错误:缺少 url、地址不是 http/https、bitrate 不在允许范围、接口未添加或未开启
403int密钥无效或没有权限
405int请求方法不支持,仅允许 GET 或 POST
500int服务器内部错误:音频下载失败、超过 80MB、ffmpeg 不可用或转码失败

FAQ

如何转换 m4a?

传入公网 m4a 地址与 API Key,按文档可选 bitrate 等参数。

输出是什么?

转换后的 mp3 可访问地址(字段见文档)。

有大小限制吗?

有,以接口文档限制为准。

为什么要转码?

统一后续 TTS/ASR/剪辑链路的输入格式,提高兼容性。

失败怎么办?

检查 URL 是否可下载、是否为合法 m4a、额度是否充足。

Full console doc (with the debugger):/doc/41