> ## Documentation Index
> Fetch the complete documentation index at: https://developer.jtl-software.com/llms.txt
> Use this file to discover all available pages before exploring further.

# QueryStockMovementHistory

> Returns stock movement history for a warehouse with optional time, article, and bin location filters.



**query** `QueryStockMovementHistory(warehouseId: ID!, startTime: DateTime, endTime: DateTime, article: String, sourceBinLocation: String, targetBinLocation: String, first: Int, after: String, last: Int, before: String, where: StockMovementHistoryItemFilterInput, order: [StockMovementHistoryItemSortInput!]): QueryStockMovementHistoryConnection`

## Arguments

**`warehouseId`**: `ID!` (required)

---

**`startTime`**: `DateTime`

---

**`endTime`**: `DateTime`

---

**`article`**: `String`

---

**`sourceBinLocation`**: `String`

---

**`targetBinLocation`**: `String`

---

**`first`**: `Int`

Returns the first _n_ elements from the list.

---

**`after`**: `String`

Returns the elements in the list that come after the specified cursor.

---

**`last`**: `Int`

Returns the last _n_ elements from the list.

---

**`before`**: `String`

Returns the elements in the list that come before the specified cursor.

---

**`where`**: `StockMovementHistoryItemFilterInput`

---

**`order`**: `[StockMovementHistoryItemSortInput!]`

## Returns

`QueryStockMovementHistoryConnection`

**`pageInfo`**: `PageInfo!`

Information to aid in pagination.

---

**`edges`**: `[QueryStockMovementHistoryEdge!]`

A list of edges.

---

**`nodes`**: `[StockMovementHistoryItem!]`

A flattened list of the nodes.

---

**`totalCount`**: `Int!`

Identifies the total count of items in the connection.

## Examples

```graphql Query
query QueryStockMovementHistory($warehouseId: ID!) {
  QueryStockMovementHistory(warehouseId: $warehouseId) {
    pageInfo {
      hasNextPage
      hasPreviousPage
      startCursor
      endCursor
    }
    edges {
      cursor
      node {
        articleNumber
        articleName
        quantity
        bestBeforeDate
        batchNumber
        serialNumber
      }
    }
    nodes {
      articleNumber
      articleName
      quantity
      bestBeforeDate
      batchNumber
      serialNumber
    }
    totalCount
  }
}
```

```json Variables
{
  "warehouseId": "id"
}
```

```json Response
{
  "data": {
    "QueryStockMovementHistory": {
      "pageInfo": {
        "hasNextPage": true,
        "hasPreviousPage": true,
        "startCursor": "string",
        "endCursor": "string"
      },
      "edges": [
        {
          "cursor": "string",
          "node": {
            "articleNumber": "string",
            "articleName": "string",
            "quantity": "value",
            "bestBeforeDate": "value",
            "batchNumber": "string",
            "serialNumber": "string"
          }
        }
      ],
      "nodes": [
        {
          "articleNumber": "string",
          "articleName": "string",
          "quantity": "value",
          "bestBeforeDate": "value",
          "batchNumber": "string",
          "serialNumber": "string"
        }
      ],
      "totalCount": 1
    }
  }
}
```
