Ajax POST request from Chrome extension to django fails with 400

I have a Django REST API running on Nginx + Gunicorn on my server (an AWS instance) and I’m trying to call this API from a Chrome extension using Ajax. I can’t make it work. The API itself seems to work fine – I can make a similar request with cURL and it works fine. However, when I try to do it from the extension, I’m getting 400 error. There is no authentication at the moment, both the website from which I’m calling and the Django app run on https (at first I thought this might be a problem), I added both of them to permissions in manifest.json. My call (from background.js) looks like this:

    type: "POST",
    crossDomain: true,
    cache: false,
    url: 'https://**************/',
    data: JSON.stringify(collectedData),
    success: function(data, textStatus, xhr) {
        collectedData = [];
        server_response = xhr.status;
    error: function(xhr, textStatus, error) {
        server_response = xhr.status;
    dataType: "json"
    sendResponse({ status: server_response });

I’m running out of ideas. What am I doing wrong?