Mp3 upload via the API

I am able to upload an mp3 file as an attachment to an issue manually. Is it also possible to upload an mp3 file via the jira API? I have tried with a form to upload an mp3 blob to the server, but it fails with code 500. Here is the code:

 var fd = new FormData();
                  var blob = request.mp3Blob;
                  fd.append("file", blob, number + "-" + key + ".mp3");
                  req_url = plugin_settings.server_url + '/rest/api/2/issue/' + key + '/attachments';
                  $.ajax({
                    url: req_url,
                    type: "POST",
                    data: fd,
                    processData: false,
                    contentType: false,
                    headers: {
                      "X-Atlassian-Token": "no-check"
                    },
                    error: function (XMLHttpRequest, textStatus, errorThrown) {
                      ...
                    },
                    success: function () {
                      ...
                  });
                }