How to correctly upload a file

Hello @tcrusson @brainicorn,

Could you a post a snippet detailing how to correctly upload a media file? I have checked the documentation but I can not find anything helpful or an example stating the correct way to do so.

Any help is much appreciated.


did you check this guide?


@tcrusson, I did so but I am not sure if I am sending it correctly.

const imgBuffer = Buffer.from(response, 'base64');
                const header = {
                    Accept: 'application/json',
                    'Content-Type': 'application/octet-stream',
                const params = {
                    name: 'img.jpg',
                return this._doPost(

How should the image be sent?
Is there another config missing?

Hi @omar.safwany, we’re cooking up sample code and will share it here.

@omar.safwany one more question: what’s the response you’re getting for this endpoint at the moment?

@tcrusson I am getting a normal response which is data object containing the id of the image. However when I open the chat window, I find a thumbnail which is completely white. Nothing to display at all. Also if I try downloading it, I get an error stating the file is corrupted.

How can the file be uploaded? As link, buffer, base64 string or what?

@tcrusson Any updates?

There is nothing here

curl --request POST \
  --header 'Authorization: Bearer <access_token>' \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/octet-stream' \
  --url '{cloudId}/conversation/{conversationId}/media'

stating how the file is sent. I have tried using the following but nothing works.

-F 'data=@path/to/file'

It appears as a broken image when I try to fetch it using the get file endpoint.

@omar.safwany you are meant to send the content as valid application/octet-stream
You can check the Stride reference app to see how you can do it:

This makes use of the Stride node client which you might want to consider using:

Its code is here: