Skip to main content
  • 311 Product updates

Accessing and upload files using the GraphQL API

Hey community! 🔮 You can now access files that are on your board via our API, and also upload them. Here’s the documentation. Moderator Note: Check out the following announcement for examples that upload a file from the client-side: Announcement: Uploading files to monday.com has just become easier :) Reading Files using the API The assets field represents a file that is uploaded to monday.com. You can query the title of the file, the URL, and also generate a public URL that can be used to download the file. Learn more here. Uploading Files using the API Our API also supports uploading files to a file column or update. To do this, you need to send your data as a multipart request (Content-Type: multipart/form-data) with the file in a variable. Here’s more info. Do note that we have a separate endpoint for files (api.monday.com/v2/file). This endpoint has a higher size limit for requests (20MB, which will be increased to 500MB in the coming weeks). An example query: mutation ($file: File!) { add_file_to_column (file: $file, item_id: 256180125, column_id: "files") { id } } Here’s what such a request would look like in Postman: And here’s what that would look like in cURL: curl \\ -F query='mutation ($file: File!) { add_file_to_column(file: $file, item_id: 118607269, column_id: "files") { id } }'\\ -F variables[file]=@/Users/diprobhowmik/screenshots/image.png\\ -H "Authorization: APIKEYHERE" \\ https://api.monday.com/v2/file

Tips on how to parse the JSON returned by an API query

I just had a great conversation with one of our clients and realized that it would be helpful to have a guide on the structure of the data returned by our API. While each query will return data in a slightly different way, here’s a general guide for understanding response data. Fact: It’s easier when you use a library 😁 Before we dive in, I’d suggest everyone use a JSON parsing library to make the data returned more manageable. There are tons of libraries out there including JSON.NET, Python and JavaScript’s native json libraries, and Java’s Json API. Check out this page for a library in the language of your choice: www.json.org Expressions to access objects Here are some expressions you can use to access objects and fields returned by your query. data : Parent object that holds all the data in the query. This is returned for all successful queries. data.items : List that contains objects that each represent an item. data.items[0] : Access the first item in the list of items (Object) data.items[0].name : The name of the first item (String) data.items[0].id : The ID of the first item. data.items[0].group : Object that represents the group that this item is in. data.items[0].group.name : The name of the group of the first item (String). Example data Here is some data that corresponds to the expressions above: { "data": { "items": [ { "name": "Here's an item", "id": "161366694", "group": { "id": "new_group", "title": "This is a group" } }, { "name": "And this one is also an item", "id": "161366701", "group": { "id": "new_group", "title": "This is a group" } }, { "name": "Guess what this is? A item", "id": "161366747", "group": { "id": "new_group", "title": "This is a group" } }, { "name": "A pulse can be a task", "id": "161366844", "group": { "id": "topics", "title": "Here's another group" } }, { "name": "Or a project", "id": "160540651", "group": { "id": "topics", "title": "Here's another group" } } ] }, "account_id": 1825528 } Example query Here is a query that will return the data above. query { items { name id group { id title } } }

cURL Examples for API v2 :)

Ever wonder how to send requests to our API using cURL? Here you go 💯 ‼️ A few notes: Executing cURL from the terminal removes backslashes and passes the escaped characters in the resulting string. As a result, if you want to pass \\" to the server you need to include \\\\\\". I ran these examples from the command line on my MacOS machine. Some Windows terminals don’t like single quotes, so you may need to replace them with " if you’re running these examples on a windows machine. If you’re looking for more code examples, check out our quickstart tutorials. Getting the ID of an item with a specific name: curl -X POST -H "Content-Type:application/json" -H "Authorization:XXXXXXX" 'https://api.monday.com/v2' \\ -d '{"query":"{items_by_column_values(board_id:162169280, column_id:\\"name\\", column_value:\\"This\\"){id name}}"}' Updating a text column on a board: curl -X POST -H "Content-Type:application/json" -H "Authorization:XXXXX" 'https://api.monday.com/v2' \\ -d '{"query":"mutation{change_column_value(item_id:279187304, board_id:162169280, column_id: \\"text\\", value:\\"\\\\\\"Hello world\\\\\\"\\"){name}}"}' Updating a status column on a board: curl -X POST -H "Content-Type:application/json" -H "Authorization:XXXXX" 'https://api.monday.com/v2' \\ -d '{"query":"mutation{change_column_value(item_id:279187304, board_id:162169280, column_id:\\"status\\", value:\\"{\\\\\\"label\\\\\\" : \\\\\\"Done\\\\\\"}\\"){name}}"}' Updating a date column on a board: curl -X POST -H "Content-Type:application/json" -H "Authorization:XXXXXXX" 'https://api.monday.com/v2' \\ -d '{"query":"mutation{change_column_value(item_id:279187304, board_id:162169280, column_id:\\"date\\", value:\\"{\\\\\\"date\\\\\\" : \\\\\\"2019-08-27\\\\\\"}\\"){name}}"}' Updating a person column on a board: curl -X POST -H "Content-Type:application/json" -H "Authorization:XXXXXX" 'https://api.monday.com/v2' \\ -d '{"query":"mutation{change_column_value(item_id:279187304, board_id:162169280, column_id:\\"person\\", value:\\"{\\\\\\"id\\\\\\" : 4012689}\\"){name}}"}' Updating a people column on a board: curl -X POST -H "Content-Type:application/json" -H "Authorization:XXXXXX" 'https://api.monday.com/v2' \\ -d '{"query" : "mutation{change_column_value(item_id:279187304, board_id:162169280, column_id: \\"people\\", value:\\"{\\\\\\"personsAndTeams\\\\\\":[{\\\\\\"id\\\\\\":4012689,\\\\\\"kind\\\\\\":\\\\\\"person\\\\\\"}]}\\"){name}}"}' Updating a link column on a board: curl -X POST -H "Content-Type:application/json" -H "Authorization:XXXXXXX" 'https://api.monday.com/v2' \\ -d '{"query":"mutation{change_column_value(item_id:279187304, board_id:162169280, column_id: \\"link\\", value:\\"{\\\\\\"url\\\\\\" : \\\\\\"http://www.monday.com\\\\\\", \\\\\\"text\\\\\\": \\\\\\"Hello\\\\\\"}\\"){name}}"}' Updating a date, status & text column in the same request: curl -X POST -H "Content-Type:application/json" -H "Authorization:XXXXXX" 'https://api.monday.com/v2' \\ -d '{"query":"mutation{change_multiple_column_values(item_id:279187304, board_id:162169280, column_values:\\"{\\\\\\"status\\\\\\" : {\\\\\\"label\\\\\\" : \\\\\\"Done\\\\\\"}, \\\\\\"text\\\\\\":\\\\\\"Hello world\\\\\\", \\\\\\"date\\\\\\" : {\\\\\\"date\\\\\\" : \\\\\\"2019-08-27\\\\\\"}}\\"){name}}"}' Enjoy, and happy coding 🙂