Announcement: Uploading files to monday.com has just become easier :)

New feature alert! :tophat:

I’m excited to announce that uploading files to monday.com has just become a bit simpler using our API, and even easier when using our SDK.

Now, when making direct calls to our API, you can upload files in a more GraphQL-like way. With your query you can now include query variables alongside files! This is compared to before when you’d need to use inline variables in the query.

Now, the following request to our API is possible:

const query = `

mutation add_file($update_id:Int!, $file: File!) {

add_file_to_update(update_id: $update_id, file: $file) {

id

}

}

`;

const variables = {

update_id: yourUpdateId,

file: yourFile

};

Here’s an example in Postman as well if you’d like to try this out:

  • Send the request as form-data;
  • Send a POST request to the special File endpoint:

https://api.monday.com/v2/file

  • Use the File type for the file;
  • You can use Text inputs for other Keys, and Auto for content-type;
  • In “variables”, you can include your Update ID, or Item + File column IDs. To add the File as a variable, you will need to add another Key to map the variable to another key. In the Map key, you declare the name of the variable, for example, “image”, and then set it as the variable.file.

And you should get a result as follows:

Always make sure to send your File upload requests with variables to the https://api.monday,com/v2/file Endpoint.

Here’s a cURL example as well:

curl --location --request POST 'https://api.monday.com/v2/file' \

--header 'Authorization: yourSuperSecretApiKey' \

--header 'Cookie: __cfduid=d0359804269ad2a2a33bc1bbbe9d6f18d1612880009' \

--form 'query="mutation add_file($file: File!, $update_id: Int!) {add_file_to_update(update_id: $update_id, file: $file) {id}}"' \

--form 'variables="{\"update_id\":920768626}"' \

--form 'map="{\"image\":\"variables.file\"}"' \

--form 'image=@"/Users/alexsavchuk/Downloads/300px-All_Right_Then,_Keep_Your_Secrets.jpg"'

What about the SDK, you might ask? This has now become easier too :slight_smile:

Developers using our SDK to make requests from View apps that are using seamless auth will now also enjoy seamless file uploads! monday.com will now translate any query into a multipart request IF it detects the request contains files. This means that if you’re adding files as variables, it will just work with zero extra code on your side :slight_smile:

If you are making a direct call from the server-side using the monday.api method, the translation will not work. Instead, we recommend constructing your own HTTP request using a library of your choice.

4 Likes