1.Can we Create Status Labels Using API in Monday.com ?

1.Can we Create Status Labels Using API in Monday.com ?

Hello @Anil12 Welcome to the community: Yes, you can create and manage Status labels in monday.com using their API. This can be achieved through two primary methods:

  1. Creating a Status Column with Custom Labels:
  • When adding a new Status column to a board, you can define custom labels during its creation. This is done using the create_column mutation with the defaults argument to specify your labels.
  • Example:

graphql

CopyEdit

mutation {
  create_column(
    board_id: 1234567890,
    title: "Project Status",
    column_type: status,
    defaults: "{\"labels\":{\"0\": \"Not Started\", \"1\": \"In Progress\", \"2\": \"Completed\"}}"
  ) {
    id
  }
}

In this example, a new Status column titled “Project Status” is created with three labels: “Not Started”, “In Progress”, and “Completed”.

developer.monday.com
2. Adding New Labels to an Existing Status Column:

  • To add new labels to an existing Status column, you can use mutations like change_column_value, change_multiple_column_values, or create_item. By setting the create_labels_if_missing argument to true, the API will create any labels that don’t already exist in the column.
  • Example:

graphql

CopyEdit

mutation {
  change_column_value(
    board_id: 1234567890,
    item_id: 9876543210,
    column_id: "status",
    value: "{\"label\": \"Awaiting Review\"}",
    create_labels_if_missing: true
  ) {
    id
  }
}

In this example, the label “Awaiting Review” is added to the “status” column if it doesn’t already exist.

developer.monday.com

Important Considerations:

  • Permissions: Creating new labels modifies the board’s structure. Ensure that the API token or user account you’re using has the necessary permissions to change the board’s structure.
  • Label Colors: By default, new labels are assigned default colors based on their index. If you need specific colors for your labels, you can define them using the labels_colors attribute in the defaults JSON when creating a column. For example:

json

CopyEdit

{
  "labels": {
    "0": "Not Started",
    "1": "In Progress",
    "2": "Completed"
  },
  "labels_colors": {
    "0": {"color": "#c4c4c4"},
    "1": {"color": "#fdab3d"},
    "2": {"color": "#00c875"}
  }
}

This JSON sets specific colors for each label during the column creation.

developer.monday.com

By utilizing these methods, you can effectively manage Status labels in monday.com through the API, tailoring them to fit your workflow requirements.