# stocktakeCountedLines query


`stocktakeCountedLines` 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 what a stocktake counted, by line, once MAX handed the stocktake over to the external
system that manages the warehouse. Use it to apply the count in the external system.

- Requires the `inventory.read` permission.
- Any other stocktake, or one outside your API key's scope, returns `NOT_FOUND`.

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

- `id`: [`UUID!`](/chameleoon-max/type/uuid) · required
- `first`: `Int`
- `after`: `String`
- `last`: `Int`
- `before`: `String`

## Returns

[`StocktakeCountedLineConnection!`](/chameleoon-max/type/stocktake-counted-line-connection): a page of [`StocktakeCountedLine`](/chameleoon-max/type/stocktake-counted-line).

## Example

**Query**

```graphql
query stocktakeCountedLines($id: UUID!, $first: Int) {
  stocktakeCountedLines(id: $id, first: $first) {
    edges {
      cursor
    }
    nodes {
      variantId
      locationId
      locationCode
      lotId
      newBatchCode
      newSerialNumber
    }
    pageInfo {
      hasNextPage
      hasPreviousPage
      startCursor
      endCursor
    }
  }
}
```

**Variables**

```json
{
  "id": "00000000-0000-4000-8000-000000000001",
  "first": 10
}
```

**Response**

```json
{
  "data": {
    "stocktakeCountedLines": {
      "edges": [
        {
          "cursor": "example"
        }
      ],
      "nodes": [
        {
          "variantId": "00000000-0000-4000-8000-000000000001",
          "locationId": "00000000-0000-4000-8000-000000000001",
          "locationCode": "example",
          "lotId": "00000000-0000-4000-8000-000000000001",
          "newBatchCode": "example",
          "newSerialNumber": "example"
        }
      ],
      "pageInfo": {
        "hasNextPage": true,
        "hasPreviousPage": true,
        "startCursor": "example",
        "endCursor": "example"
      }
    }
  }
}
```

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