---
updatedAt: 2026-08-18T18:39:20.000Z
agentTools:
  projectIndex: https://stockpit.readme.io/llms.txt
---

# Queries

Stock counts are the physical inventory audit sessions and their line items.

# Available queries

### `StockCount` - Returns a single stock count based on the `id` provided

```graphql
query {
  StockCount(id: 200050) {
    id
    label
    status
    dated_at
    notes
    valuation_diff
    location {
      id
      label
    }
    stock_count_line_items {
      paginatorInfo {
        total
      }
      data {
        id
        new_on_hand
        on_hand
        variance
      }
    }
  }
}
```

### `StockCounts` - Returns a list of stock counts based on the filter define

```graphql
query {
  StockCounts {
    data {
      id
      label
      status
      dated_at
    }
  }
}
```

### `StockCountLineItem` - Returns a single stock count line item based on the `id` provided

```graphql
query {
  StockCountLineItem(id: 200100) {
    id
    stock_count {
      id
      label
    }
    variant {
      id
      label
      sku
    }
    batch_number {
      id
      label
    }
    bin_location
    new_on_hand
    on_hand
    variance
    updated_at
  }
}
```

### `StockCountLineItems` - Returns a list of stock count line items based on the filter define

```graphql
query {
  StockCountLineItems {
    data {
      id
      stock_count {
        id
        label
      }
      variant {
        id
        label
        sku
      }
      new_on_hand
      on_hand
      variance
    }
  }
}
```

<br/>

***

# Available fields

## StockCount data type

| id <span style={{fontWeight:"normal"}}>- [Int](/reference/data-types#int)</span> |
| :------------------------------------------------------------------------------- |
| Unique identifier of the stock count                                             |

| label <span style={{fontWeight:"normal"}}>- [String](/reference/data-types#string)</span> |
| :---------------------------------------------------------------------------------------- |
| Label or reference number of the stock count                                              |

| status <span style={{fontWeight:"normal"}}>- [StockCountStatus](/reference/stock-count-mutations#stockcountstatus-enum)</span> |
| :----------------------------------------------------------------------------------------------------------------------------- |
| Status of the stock count (in\_progress, completed, cancelled)                                                                 |

| dated\_at <span style={{fontWeight:"normal"}}>- [Date](/reference/data-types#date)</span> |
| :---------------------------------------------------------------------------------------- |
| Date of the stock count                                                                   |

| notes <span style={{fontWeight:"normal"}}>- [String](/reference/data-types#string)</span> |
| :---------------------------------------------------------------------------------------- |
| Notes attached to the stock count                                                         |

| valuation\_diff <span style={{fontWeight:"normal"}}>- [Float](/reference/data-types#float)</span> |
| :------------------------------------------------------------------------------------------------ |
| Total difference in stock valuation                                                               |

| location <span style={{fontWeight:"normal"}}>- [Location](/reference/location-queries)</span> |
| :-------------------------------------------------------------------------------------------- |
| Location/warehouse where the count occurs                                                     |

| stock\_count\_line\_items <span style={{fontWeight:"normal"}}>- Array of [StockCountLineItem](#stockcountlineitem-data-type)</span> |
| :---------------------------------------------------------------------------------------------------------------------------------- |
| Items counted during the stock count                                                                                                |

## StockCountLineItem data type

| id <span style={{fontWeight:"normal"}}>- [Int](/reference/data-types#int)</span> |
| :------------------------------------------------------------------------------- |
| Unique identifier of the stock count line item                                   |

| updated\_at <span style={{fontWeight:"normal"}}>- [DateTime](/reference/data-types#datetime)</span> |
| :-------------------------------------------------------------------------------------------------- |
| Date of the latest update of the line item                                                          |

| batch\_number\_id <span style={{fontWeight:"normal"}}>- [ID](/reference/data-types#id)</span> |
| :-------------------------------------------------------------------------------------------- |
| ID of the batch number, if applicable                                                         |

| stock\_count <span style={{fontWeight:"normal"}}>- [StockCount](#stockcount-data-type)</span> |
| :-------------------------------------------------------------------------------------------- |
| Parent stock count                                                                            |

| variant <span style={{fontWeight:"normal"}}>- [Variant](/reference/variant-queries)</span> |
| :----------------------------------------------------------------------------------------- |
| Product variant counted                                                                    |

| batch\_number <span style={{fontWeight:"normal"}}>- [BatchNumber](/reference/batch-numbers/queries)</span> |
| :--------------------------------------------------------------------------------------------------------- |
| Batch number counted                                                                                       |

| bin\_location <span style={{fontWeight:"normal"}}>- [String](/reference/data-types#string)</span> |
| :------------------------------------------------------------------------------------------------ |
| Bin location within the location                                                                  |

| new\_on\_hand <span style={{fontWeight:"normal"}}>- [Float](/reference/data-types#float)</span> |
| :---------------------------------------------------------------------------------------------- |
| New counted quantity                                                                            |

| on\_hand <span style={{fontWeight:"normal"}}>- [Float](/reference/data-types#float)</span> |
| :----------------------------------------------------------------------------------------- |
| Current system quantity                                                                    |

| variance <span style={{fontWeight:"normal"}}>- [Float](/reference/data-types#float)</span> |
| :----------------------------------------------------------------------------------------- |
| Difference between counted and system quantity                                             |

<br/>

***

# Filters

You can create filters based on following fields

## `StockCounts`

| id                                                             |
| :------------------------------------------------------------- |
| Example: { "column": "ID", "operator": "EQ", "value": 200050 } |

| label                                                                    |
| :----------------------------------------------------------------------- |
| Example: { "column": "LABEL", "operator": "LIKE", "value": "%SC-2025%" } |

| status                                                                    |
| :------------------------------------------------------------------------ |
| Example: { "column": "STATUS", "operator": "EQ", "value": "in_progress" } |

## `StockCountLineItems`

| id                                                             |
| :------------------------------------------------------------- |
| Example: { "column": "ID", "operator": "EQ", "value": 200100 } |

| stock\_count\_id                                                           |
| :------------------------------------------------------------------------- |
| Example: { "column": "STOCK_COUNT_ID", "operator": "EQ", "value": 200050 } |

| variant\_id                                                            |
| :--------------------------------------------------------------------- |
| Example: { "column": "VARIANT_ID", "operator": "EQ", "value": 100012 } |

| variant\_label                                                                  |
| :------------------------------------------------------------------------------ |
| Example: { "column": "VARIANT_LABEL", "operator": "LIKE", "value": "%Jacket%" } |

| variant\_sku                                                                 |
| :--------------------------------------------------------------------------- |
| Example: { "column": "VARIANT_SKU", "operator": "EQ", "value": "135267U23" } |

| variant\_barcode                                                                     |
| :----------------------------------------------------------------------------------- |
| Example: { "column": "VARIANT_BARCODE", "operator": "EQ", "value": "3760244512345" } |

| batch\_number\_id                                                           |
| :-------------------------------------------------------------------------- |
| Example: { "column": "BATCH_NUMBER_ID", "operator": "EQ", "value": 300050 } |

| batch\_number\_label                                                                   |
| :------------------------------------------------------------------------------------- |
| Example: { "column": "BATCH_NUMBER_LABEL", "operator": "LIKE", "value": "%LOT-2025%" } |

***

# Sorting

You can sort data based on following fields:

## `StockCounts`

* id, label, status, created\_at, updated\_at

## `StockCountLineItems`

* id, label, updated\_at