---
title: "companyLocations"
description: "Company Location List Query"
doc_type: graphql
doc_category: adminGraphQL
doc_version: v20270301
source_url:
  html: 'https://developer.shopline.com/docs/admin-graph-ql-api/b-2-b/queries/company-locations'
  md: 'https://developer.shopline.com/docs/admin-graph-ql-api/b-2-b/queries/company-locations.md'
---
# companyLocations

Company Location List Query

- **API Version:** v20270301
- **API Type:** Admin
- **API Protocol:** GraphQL
- **Operation Type:** Query

## Arguments

* `after`

  [String](https://developer.shopline.com/docs/admin-graph-ql-api/common/scalars/string.md)

  Returns elements following the specified cursor. The `first` argument must also be specified when using this argument.

* `before`

  [String](https://developer.shopline.com/docs/admin-graph-ql-api/common/scalars/string.md)

  Returns elements preceding the specified cursor. The `last` argument must also be specified when using this argument.

* `first`

  [Int](https://developer.shopline.com/docs/admin-graph-ql-api/common/scalars/int.md)

  Returns the first n elements in the list. 

* `last`

  [Int](https://developer.shopline.com/docs/admin-graph-ql-api/common/scalars/int.md)

  Returns the last n elements in the list. 

* `reverse`

  [Boolean](https://developer.shopline.com/docs/admin-graph-ql-api/common/scalars/boolean.md)

  Whether to reverse the order of the list. 
  
  ● true: reverse
  
  ● false: do not reverse
  
  Default value: false

* `sortKey`

  [CompanyLocationSortKeys](https://developer.shopline.com/docs/admin-graph-ql-api/b-2-b/enums/company-location-sort-keys.md)

  sort key

* `rawQuery`

  [String](https://developer.shopline.com/docs/admin-graph-ql-api/common/scalars/string.md)

  Query criteria, JSON string.
  Currently, only location name or company ID queries are supported, such as `{"companyId": "643266524357", "name": "Golden Street Location"}`

## Returns

* `edges`

  [[CompanyLocationEdge!]](https://developer.shopline.com/docs/admin-graph-ql-api/b-2-b/objects/company-location-edge.md)

  edge list

* `nodes`

  [[CompanyLocation]](https://developer.shopline.com/docs/admin-graph-ql-api/b-2-b/objects/company-location.md)

  node list

* `pageInfo`

  [PageInfo!](https://developer.shopline.com/docs/admin-graph-ql-api/common-objects/objects/page-info.md)

  pageInfo

## Examples

### Location list query

Paging to query location list information

**Request:**

```json
query {
  companyLocations(first: 2, rawQuery: "{\"name\": \"location\"}",after:null,before:null,reverse:true,sortKey: CREATED_AT) {
    edges {
      cursor
      node {
        id
        name
        orderCount
        totalSpent {
            amount
            currencyCode
        }
        billingAddress {
          id
          address1
          address2
          countryCode
          country
          createdAt
          id
          zip
          city
          province
      }
      shippingAddress {
          address1
          address2
          countryCode
          country
          createdAt
          id
          zip
          city
          province
      }
      company {
        id
        name
        }
      }
    }
    nodes {
        id
        name
        orderCount
        totalSpent {
            amount
            currencyCode
        }
        billingAddress {
          id
          address1
          address2
          countryCode
          country
          createdAt
          id
          zip
          city
          province
      }
      shippingAddress {
          address1
          address2
          countryCode
          country
          createdAt
          id
          zip
          city
          province
      }
      company {
        id
        name
        }
    }
    pageInfo {
        endCursor
        hasNextPage
        hasPreviousPage
        startCursor
    }
  }
}
```

**Response:**

```json
{
  "data": {
    "data": {
      "companyLocations": {
        "edges": [
          {
            "cursor": "-",
            "node": {
              "billingAddress": {
                "address1": "fake street",
                "city": "Ottawa",
                "country": null,
                "countryCode": "CA",
                "zip": "53118",
                "address2": "long three department",
                "createdAt": "2024-06-03T02:26:44.848Z",
                "id": "gid://shopline/CompanyAddress/************4520",
                "province": null
              },
              "company": {
                "id": "gid://shopline/Company/************50599",
                "name": "S****"
              },
              "id": "gid://shopline/CompanyLocation/************8886",
              "name": "Top catagory location",
              "orderCount": 0,
              "shippingAddress": {
                "country": null,
                "countryCode": "CA",
                "id": "gid://shopline/CompanyAddress/************01447",
                "province": null,
                "address1": "funny street",
                "address2": "golden 3 department",
                "city": "Ottawa",
                "createdAt": "2024-06-03T02:26:44.806Z",
                "zip": "53118"
              },
              "totalSpent": {
                "amount": "0",
                "currencyCode": "USD"
              }
            }
          },
          {
            "cursor": "-",
            "node": {
              "name": "Top catagory location",
              "orderCount": 0,
              "shippingAddress": {
                "country": null,
                "countryCode": "CA",
                "province": null,
                "zip": "53118",
                "address1": "funny street",
                "createdAt": "2024-05-14T10:26:15.653Z",
                "id": "gid://shopline/CompanyAddress/************4551",
                "address2": "golden 3 department",
                "city": "Ottawa"
              },
              "totalSpent": {
                "amount": "0",
                "currencyCode": "USD"
              },
              "billingAddress": {
                "address2": "long three department",
                "country": null,
                "createdAt": "2024-05-14T10:26:15.695Z",
                "id": "gid://shopline/CompanyAddress/************624",
                "zip": "53118",
                "address1": "fake street",
                "city": "Ottawa",
                "countryCode": "CA",
                "province": null
              },
              "company": {
                "id": "gid://shopline/Company/************599",
                "name": "T****"
              },
              "id": "gid://shopline/CompanyLocation/************0454"
            }
          }
        ],
        "nodes": [
          {
            "orderCount": 0,
            "shippingAddress": {
              "address1": "funny street",
              "address2": "golden 3 department",
              "country": null,
              "zip": "53118",
              "city": "Ottawa",
              "countryCode": "CA",
              "createdAt": "2024-06-03T02:26:44.806Z",
              "id": "gid://shopline/CompanyAddress/************1447",
              "province": null
            },
            "totalSpent": {
              "amount": "0",
              "currencyCode": "USD"
            },
            "billingAddress": {
              "countryCode": "CA",
              "createdAt": "2024-06-03T02:26:44.848Z",
              "address1": "fake street",
              "address2": "long three department",
              "city": "Ottawa",
              "id": "gid://shopline/CompanyAddress/************4520",
              "province": null,
              "zip": "53118",
              "country": null
            },
            "company": {
              "id": "gid://shopline/Company/************0599",
              "name": "Y*****"
            },
            "id": "gid://shopline/CompanyLocation/************886",
            "name": "Top catagory location"
          },
          {
            "totalSpent": {
              "amount": "0",
              "currencyCode": "USD"
            },
            "billingAddress": {
              "province": null,
              "address1": "fake street",
              "address2": "long three department",
              "city": "Ottawa",
              "createdAt": "2024-05-14T10:26:15.695Z",
              "zip": "53118",
              "country": null,
              "countryCode": "CA",
              "id": "gid://shopline/CompanyAddress/************624"
            },
            "company": {
              "id": "gid://shopline/Company/************599",
              "name": "Big bom"
            },
            "id": "gid://shopline/CompanyLocation/************454",
            "name": "Top catagory location",
            "orderCount": 0,
            "shippingAddress": {
              "address2": "golden 3 department",
              "country": null,
              "id": "gid://shopline/CompanyAddress/************551",
              "province": null,
              "zip": "53118",
              "address1": "funny street",
              "city": "Ottawa",
              "countryCode": "CA",
              "createdAt": "2024-05-14T10:26:15.653Z"
            }
          }
        ],
        "pageInfo": {
          "endCursor": "E002CE0E792FBA4E98672D39851FDFD6",
          "hasNextPage": true,
          "hasPreviousPage": false,
          "startCursor": "AF52536A1951B28A30AAE8825A2B69B9"
        }
      }
    }
  }
}
```

## Error Handling

For detailed information about common codes, see [Status and error codes](https://developer.shopline.com/docs/apps/api-instructions-for-use/graph-ql-admin-api/overview.md#status-and-error-codes).

