Skip to main content

Is there a `create_labels` mutation in the GraphQL API? Or something functionally equivalent?

I need to programatically create (add new) labels to a Dropdown column via the API.

After going through the API documentation I haven’t found a way.

Any suggestions greatly appreciated.

You can set the labels when you create a new column using the “defaults” argument. - https://developer.monday.com/api-reference/reference/columns#create-a-column

Once a column has been created, you can add new labels by using the “change_simple_column_value” mutation, and set “create_labels_if_missing” to true. You could use this query and set the value to multiple labels so you don’t have to repeat this mutation for each new label - https://developer.monday.com/api-reference/reference/dropdown#update-the-dropdown-column

 

When I do this, I usually create a dummy item, run the mutation and then delete the dummy item


You can set the labels when you create a new column using the “defaults” argument. - https://developer.monday.com/api-reference/reference/columns#create-a-column
...

Thank you Mitchell. You’ve confirmed what I ended up determining is the way to go about this, including using a dummy item, etc. It’s helpful to know I am not overlooking a simpler (more direct) method.

One question: The column is set to allow only one label to be selected. This will presumably prevent me using the API to create multiple labels by assigning them to my dummy item. Is there a way through the API to change that setting on the column? I am thinking I would disable the 1 item limit, add the new labels, and then enable the limit again --- if the API has a way to do this.


Yes that is correct, there is not currently a way to set the selection limit via the API. You could do this via the UI if you have access, otherwise you will need to make multiple mutations to update each label


Yes that is correct, there is not currently a way to set the selection limit via the API. You could do this via the UI if you have access, otherwise you will need to make multiple mutations to update each label

Thanks. That’s what I’ve ended up doing. In this situation there’s only ever a few labels to add at most, per procedure. So it’s fine to do them one-by-one.