# updateTag mutation


`updateTag` is a GraphQL mutation of the Chameleoon MAX API. Send it as `POST https://max-api.chameleoon.sk/api/v1/graphql` with your API key, see [Chameleoon MAX](/chameleoon-max).

Changes a live tag, named by its code. Fields you leave out stay as they are.

- A new `code` renames the code: integrations that use the old one stop finding the tag.
- `group`: a code moves the tag into that group, `null` takes it out of its group.

#### Permissions

Requires the `tag.manage` permission.

#### Errors

- `NOT_FOUND` when no tag has the code, or no tag group has the code in `input.group`.
- `VALIDATION` as in [`createTag`](/chameleoon-max/mutation/create-tag).
- `CONFLICT` with reason `TAG_GROUP_CONFLICT` when the tag moves into a group that holds one tag at
  a time while records hold it and another of the group's tags. The message says how many.

## Arguments

- `code`: `String!` · required
- `input`: [`UpdateTagInput!`](/chameleoon-max/type/update-tag-input) · required

## Returns

[`Tag!`](/chameleoon-max/type/tag)

## Example

**Mutation**

```graphql
mutation updateTag($code: String!, $input: UpdateTagInput!) {
  updateTag(code: $code, input: $input) {
    code
    name
    description
    archived
    agendas
    group {
      code
      name
      exclusive
      automationOnly
      archived
      description
    }
    colour
    icon
    sortOrder
  }
}
```

**Variables**

```json
{
  "code": "example",
  "input": {}
}
```

**Response**

```json
{
  "data": {
    "updateTag": {
      "code": "example",
      "name": "example",
      "description": "example",
      "archived": true,
      "agendas": [
        "SALES_ORDER"
      ],
      "group": {
        "code": "example",
        "name": "example",
        "exclusive": true,
        "automationOnly": true,
        "archived": true,
        "description": "example"
      },
      "colour": "SLATE",
      "icon": "TAG",
      "sortOrder": 1
    }
  }
}
```

Values are illustrative: replace IDs and codes with your own before you send the call.
