File Upload Via API using Power Automate

I am trying to upload a file to a column using Power Automate. I am using the HTTP action along with Graph QL in a compose Action and compose actions to map the parts, including File Content with Base64 decoding. The flow works and I can upload the file to Monday.com column, but the file is unreadable when in Base64. The content in the file is there, but it is as a .txt file. If I remove the base64 coding then the file will appear, as a pdf but it is blank. Any suggestions?

The upload works in postman.

If I decode the pdf as base64 and add this in a compose action as a string of data, it still doesn’t work, which leads me to thing there’s an error with my coding or the conversion of the file into monday.com.

I am using a pdf, version 1.7.

I have tried an image file png and jpeg with no success either (error with the image format).
{ "type": "Scope", "actions": { "Graphic_QL": { "type": "Compose", "inputs": "mutation add_file($file: File!) { add_file_to_column(item_id: 123456789, column_id: \"upload_file\", file: $file) { id } }" }, "Compose_MAP": { "type": "Compose", "inputs": { "image": [ "variables.file" ] }, "runAfter": { "Graphic_QL": [ "Succeeded" ] } }, "Compose_MultiPart": { "type": "Compose", "inputs": { "$content-type": "multipart/form-data; boundary=---------------------------7da24f2e5004", "$multipart": [ { "headers": { "Content-Disposition": "form-data; name=\"query\"" }, "body": "@{outputs('Graphic_QL')}" }, { "headers": { "Content-Disposition": "form-data; name=\"map\"" }, "body": "@{outputs('Compose_MAP')}" }, { "headers": { "Content-Disposition": "form-data; name=\"image\"; filename=\"3.pdf\"", "Content-Type": "application/pdf" }, "body": "@{variables('Content')}" } ] }, "runAfter": { "Compose_MAP": [ "Succeeded" ] } }, "HTTP-copy": { "type": "Http", "inputs": { "uri": "https://api.monday.com/v2/file", "method": "POST", "headers": { "Content-Type": "multipart/form-data; boundary=---------------------------7da24f2e50046", "Authorization": "Santised" }, "body": "@outputs('Compose_MultiPart')" }, "runAfter": { "Compose_MultiPart": [ "Succeeded" ] }, "operationOptions": "DisableAutomaticDecompression", "metadata": { "operationMetadataId": "7353861e-17c7-4ba7-a7a2-bf69a669bbb6" } } }, "runAfter": { "Append_to_string_variable": [ "Succeeded" ] } }

Hello there @anthonyatcampbells,

Would you be able to please fill this form adding as much information as possible to it (such as account ID, board IDs, item IDs, timestamps, etc.) so that our team can take a look into it?

Hi,
I want make the same thing.
I think i have problem on my body.
Can you give an example pls ?

Thanks in advance.
Franck

–12345
Content-Disposition: form-data; name=“query”

mutation ($file: File!) {
add_file_to_column(
file: $file,
item_id: 1721979672,
column_id: “files_1”
) {
id
}
}
–12345
Content-Disposition: form-data; name=“variables[file]”; filename=“NomDuFichier.pdf”
Content-Type: application/pdf

@{body(‘Obtenir_le_contenu_du_fichier’)}
–12345–

Hi See below. I am using JSON.

I am using the output of a word document directly into the pdf. I did not need to convert it into base64 as it was already formatted. You need to change the item id, column id, filename and then point to the output of the file you are trying to upload.

{
“$content-type”: “multipart/form-data”,
“$multipart”: [
{
“headers”: {
“Content-Disposition”: “form-data; name="query"”
},
“body”: “mutation add_file($file: File!) {add_file_to_column (item_id: 123456, column_id:"files", file: $file) {id}}”
},
{
“headers”: {
“Content-Disposition”: “form-data; name="map"”
},
“body”: “{"image":["variables.file"]}”
},
{
“headers”: {
“Content-Disposition”: “form-data; name="image"; filename="filename.pdf"”
},
“body”: linktothebodyofyourdocumentinbase64}
}
]
}