Creating new status column with custom labels with the GraphQL API

Hello, I’m new here.

I’m facing a problem in creating a new status column with custom labels when the column is created.

I’ve read the API documentation and some posts in this community, and I’ve found that I can create a new item and create a new custom label if it doesn’t exist, but that’s not sufficient because I need to create two new status columns in more than 500 boards with customized labels to match in some automations.

Do you have any ideas on how I can add these columns using a script or GraphQL?

Regards,

Hey @RogerLovato

You can create a column and provide the labels via the defaults argument in the mutation. For example:

mutation {
  create_column(board_id: 12345678, title:"Status", description: "This is my work status column", column_type:status, defaults:"{\"labels\":{\"1\":\"Done\",\"2\":\"To be invoiced\",\"3\":\"Pending Payment\",\"5\":\"\",\"12\":\"Booked\",\"13\":\"Paid\",\"14\":\"Quoted\",\"106\":\"\"},\"labels_positions_v2\":{\"1\":1,\"2\":0,\"5\":2,\"12\":3,\"106\":4},\"labels_colors\":{\"1\":{\"color\":\"#00c875\",\"border\":\"#00B461\",\"var_name\":\"green-shadow\"},\"2\":{\"color\":\"#e2445c\",\"border\":\"#CE3048\",\"var_name\":\"red-shadow\"},\"3\":{\"color\":\"#0086c0\",\"border\":\"#3DB0DF\",\"var_name\":\"blue-links\"},\"5\":{\"color\":\"#c4c4c4\",\"border\":\"#B0B0B0\",\"var_name\":\"grey\"},\"12\":{\"color\":\"#FF158A\",\"border\":\"#E01279\",\"var_name\":\"dark-pink\"},\"13\":{\"color\":\"#FF5AC4\",\"border\":\"#E04FAC\",\"var_name\":\"light-pink\"},\"14\":{\"color\":\"#784BD1\",\"border\":\"#8F4DC4\",\"var_name\":\"dark-purple\"},\"106\":{\"color\":\"#68a1bd\",\"border\":\"#68a1bd\",\"var_name\":\"river\"}}}") {
    id
    title
    description
    settings_str
  }
}

By customising the defaults value, you can set the labels you require.

You can simply create a loop and run this query on each of your required boards.