V4 - Importing files with API

Hi,
I am trying to import files with api upload, but there is always some problem (400 - Bad request or 401 - Unauthorized)

I read docs Upload and Authenticated request.

I have simple JS script and want to upload file and add it to existing refID.
I tried use AXIOS as in Authenticated request docs and Im able to get auth hash, but I am not able to use in upload api.

When I tried to use XMLHttpRequest as in Upload docs, where they put FormData object to post - I get Unsupported send() data [object Object] error. I experimented with JSON and other stuff but I never get to finish.

Can please somebody tell me how to import file with API and add it to existing refID? Some example needed.

Thanks,
Ondra

printscreen to XMLHttpRequest