# warehouses query


`warehouses` 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 warehouses your API key may read, archived ones included, by code, then
id. Use it to find the MAX ids of the warehouses that your stock calls name.

- Requires the `warehouse.read` permission.
- Warehouses outside your API key's warehouse, legal-entity or country scope are left out.
- 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

- `first`: `Int`
- `after`: `String`
- `last`: `Int`
- `before`: `String`

## Returns

[`WarehouseConnection!`](/chameleoon-max/type/warehouse-connection): a page of [`Warehouse`](/chameleoon-max/type/warehouse).

## Example

**Query**

```graphql
query warehouses($first: Int) {
  warehouses(first: $first) {
    edges {
      cursor
    }
    nodes {
      id
      code
      name
      street
      city
      postalCode
    }
    pageInfo {
      hasNextPage
      hasPreviousPage
      startCursor
      endCursor
    }
  }
}
```

**Variables**

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

**Response**

```json
{
  "data": {
    "warehouses": {
      "edges": [
        {
          "cursor": "example"
        }
      ],
      "nodes": [
        {
          "id": "00000000-0000-4000-8000-000000000001",
          "code": "example",
          "name": "example",
          "street": "example",
          "city": "example",
          "postalCode": "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.
