Can't attach image to a task


Hi there.

As the title says, I’m trying to attach a file to an existing task, I’m using Nodejs and request() for doing so, but the response says: 400 Bad Request.

I’m going to show you the code for you to see if i’m doing something wrong.

let contents = imagen.image, //this is an array buffer with the image
imageData64 = imagen.imageData64, //this is a base64 code with the mimetype
returnedB64 = imagen.returnedB64,// this is just the base64 code
blob = Buffer.from(returnedB64, ‘base64’),
formData = new FormData();

                                formData.append("file", contents);

                                const options = {
                                    method: "POST",
                                    url: asanaUrl,
                                    headers: {
                                        "Content-Disposition": "form-data",
                                        "Content-Type": "multipart/form-data",
                                        "boundary": "1z2x3c4v5b",
                                        "Authorization": "Basic  my token",
                                        formData : {
                                            "image" : formData,
                                            "file": contents

                                    IMPORTS.request(options, function (err, res, body) {
                                        if(err) console.log(err);
                                        console.log(res.statusMessage );

What am I doing wrong?

I’ll thank you so much if you could help me to resolve this issue.


I never had to do this, did you have a look at


I haven’t had to do this yet, either, sorry. In addition to the link Bastien posted, you might want to have a look at this forum post about attachments in case it helps: