Errors in upload attachment API

Hello!

I am trying to debug this API-call to upload an attachment, but just cannot get it to work. All help appreciated.

Upload Attachment • API Reference • Palantir

This is my code:

// I have tried several variants of inputs

const input = get_filestream_api_call.body
const input = new Blob([fileContent], { type: "application/octet-stream" });
const input = new Uint8Array([
    72, 69, 76, 76, 79, 32, 70, 79, 85, 78, 68, 82, 89
]);

const upload_attachment_endpoint = `https://{hostname}/api/v2/ontologies/attachments/upload?filename=test.txt`

const upload_attachment_response = await fetch(upload_attachment_endpoint, {
    method: "POST",
    headers: {
        "Content-Type": "application/octet-stream",
        "Authorization": `Bearer ${accessToken}`,
    },
    body: input
});

Output is always the same:
{"errorCode":"INVALID_ARGUMENT","errorName":"Default:InvalidArgument","errorInstanceId":"id","parameters":{}}

I can do other calls just fine so I know the token is valid.