# removeSalesOrderTag mutation


`removeSalesOrderTag` 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).

Takes a tag off the order. The tag is named by its code, as in [`addSalesOrderTag`](/chameleoon-max/mutation/add-sales-order-tag);
every tag on the order with that code is taken off, an archived one too.

#### Permissions

Requires the `order.write` and `order.read` permissions.

#### Repeated calls

A tag the order does not have, or a code no tag has, changes nothing and returns
`changed: false`.

#### Errors

- `VALIDATION` when the code is blank.
- `NOT_FOUND` when the order does not exist or your API key cannot see it.

## Arguments

- `ref`: [`SalesOrderRefInput!`](/chameleoon-max/type/sales-order-ref-input) · required
- `tag`: `String!` · required

## Returns

[`SalesOrderChangeResult!`](/chameleoon-max/type/sales-order-change-result)

## Example

**Mutation**

```graphql
mutation removeSalesOrderTag($ref: SalesOrderRefInput!, $tag: String!) {
  removeSalesOrderTag(ref: $ref, tag: $tag) {
    salesOrder {
      id
      number
      status
      legalEntityId
      source
      externalId
    }
    changed
  }
}
```

**Variables**

```json
{
  "ref": {
    "id": "00000000-0000-4000-8000-000000000001"
  },
  "tag": "example"
}
```

**Response**

```json
{
  "data": {
    "removeSalesOrderTag": {
      "salesOrder": {
        "id": "00000000-0000-4000-8000-000000000001",
        "number": "example",
        "status": "DRAFT",
        "legalEntityId": "00000000-0000-4000-8000-000000000001",
        "source": "example",
        "externalId": "example"
      },
      "changed": true
    }
  }
}
```

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