Thanks Danny for your time!
I found the problem, I was making a mistake on authorization because the way authentication is done differs between Dataverse Native API and SWORD API.
In Dataverse Native API it needed to send on HTTP request the header `X-Dataverse-key: ${TOKEN}`.
But in the SWORD API the header `X-Dataverse-key` doesn't work and it is needed to send the header to do a http basic authentication like `Authorization: Basic ${base64("TOKEN:")}`.
Follow my code as example in order to help someone else that eventually faces the same error:
```javascript
const fetch = require('node-fetch');
function deleteFile(fileId) {
let options = {
method: 'DELETE',
headers: {
"Authorization": "Basic " + Buffer.from(TOKEN + ':').toString('base64'),
}
};
return fetch(`${SERVER}/dvn/api/data-deposit/v1.1/swordv2/edit-media/file/${fileId}`, options);
}
deleteFile('9999999').then(res => console.log(res)).catch((err) => { throw(err) })
```