# locations query


`locations` 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 bins of the named warehouses, by warehouse, code, then id. Use it with
[`stockQuants`](/chameleoon-max/query/stock-quants) to plan a move of goods between bins, for example from bins nobody
picks from to the pick face.

- Requires the `position.read` permission.
- A warehouse outside your API key's warehouse, legal-entity or country scope is left out, as
  in [`stockCards`](/chameleoon-max/query/stock-cards).
- 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`: [`LocationFilter!`](/chameleoon-max/type/location-filter) · required
- `first`: `Int`
- `after`: `String`
- `last`: `Int`
- `before`: `String`

## Returns

[`LocationConnection!`](/chameleoon-max/type/location-connection): a page of [`Location`](/chameleoon-max/type/location).

## Example

**Query**

```graphql
query locations($filter: LocationFilter!, $first: Int) {
  locations(filter: $filter, first: $first) {
    edges {
      cursor
    }
    nodes {
      id
      warehouseId
      code
      name
      kind
      pickable
    }
    pageInfo {
      hasNextPage
      hasPreviousPage
      startCursor
      endCursor
    }
  }
}
```

**Variables**

```json
{
  "filter": {
    "warehouseIds": [
      "00000000-0000-4000-8000-000000000001"
    ]
  },
  "first": 10
}
```

**Response**

```json
{
  "data": {
    "locations": {
      "edges": [
        {
          "cursor": "example"
        }
      ],
      "nodes": [
        {
          "id": "00000000-0000-4000-8000-000000000001",
          "warehouseId": "00000000-0000-4000-8000-000000000001",
          "code": "example",
          "name": "example",
          "kind": "STOCK",
          "pickable": true
        }
      ],
      "pageInfo": {
        "hasNextPage": true,
        "hasPreviousPage": true,
        "startCursor": "example",
        "endCursor": "example"
      }
    }
  }
}
```

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