# tags query


`tags` is a GraphQL query 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).

Returns a page of the organisation's tags, by their order in MAX, then name. Use it to find the
codes that [`addSalesOrderTag`](/chameleoon-max/mutation/add-sales-order-tag), [`modifySalesOrderTags`](/chameleoon-max/mutation/modify-sales-order-tags),
[`addInvoiceTag`](/chameleoon-max/mutation/add-invoice-tag) and [`modifyInvoiceTags`](/chameleoon-max/mutation/modify-invoice-tags) take.

- Requires the `order.read`, `invoice.read`, `receipt.read`, `issue.read`, `transfer.read`,
  `advice.read`, `transferAdvice.read`, `item.read`, `partner.read` or `lot.read` permission.
- Archived tags are left out unless `filter.includeArchived` is `true`.
- The connection has no total count.

Pass exactly one of `first` or `last`, from 1 to 250. `first` (with `after`) pages forward;
`last` (with `before`) pages backward. `last` alone returns the last page. Every edge carries
its own cursor.

A page costs 2 + first (or last) × the cost of one node.

## Arguments

- `filter`: [`TagFilter`](/chameleoon-max/type/tag-filter)
- `first`: `Int`
- `after`: `String`
- `last`: `Int`
- `before`: `String`

## Returns

[`TagConnection!`](/chameleoon-max/type/tag-connection): a page of [`Tag`](/chameleoon-max/type/tag).

## Example

**Query**

```graphql
query tags($first: Int) {
  tags(first: $first) {
    edges {
      cursor
    }
    nodes {
      code
      name
      description
      archived
      agendas
      colour
    }
    pageInfo {
      hasNextPage
      hasPreviousPage
      startCursor
      endCursor
    }
  }
}
```

**Variables**

```json
{
  "first": 10
}
```

**Response**

```json
{
  "data": {
    "tags": {
      "edges": [
        {
          "cursor": "example"
        }
      ],
      "nodes": [
        {
          "code": "example",
          "name": "example",
          "description": "example",
          "archived": true,
          "agendas": [
            "SALES_ORDER"
          ],
          "colour": "SLATE"
        }
      ],
      "pageInfo": {
        "hasNextPage": true,
        "hasPreviousPage": true,
        "startCursor": "example",
        "endCursor": "example"
      }
    }
  }
}
```

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