# QueryCompanies

Retrieve all companies

`GET /companies`

**API:** Shared Company Service API
**Tag:** Companies
**API Version:** 1.2
**Base URL:** https://api.avalara.com/scs

Source: https://developer.avalara.com/products/shared-services/api/methods/Companies/QueryCompanies/

## Description

Use this endpoint to retrieve all companies for a calling tenant. Company identifiers are only returned when included in the $include parameter.

## Parameters

| Name | Type | In | Required | Description |
|---|---|---|---|---|
| `$include` | string | query | No | A comma separated list of objects to fetch underneath this company. Any object with a URL path underneath this company can be fetched by specifying its name. Use 'companyIdentifiers' to include company identifiers in the response. |
| `$filter` | string | query | No | A filter statement to identify specific records to retrieve. |
| `$top` | integer | query | No | If nonzero, return no more than this number of results. Used with `$skip` to provide pagination for large datasets. Unless otherwise specified, the maximum number of records that can be returned from an API call is 1,000 records. |
| `$skip` | integer | query | No | If nonzero, skip this number of results before returning data. Used with `$top` to provide pagination for large datasets. |
| `$orderBy` | string | query | No | A comma separated list of ascending or descending sort statements in the format `(fieldname) [ASC|DESC]`, for example `companyCode DESC` |
| `returnHierarchy` | boolean | query | No | `false` by default. If `true`, then the API will return the entire hierarchy of the company specified in the filter. |
| `X-Avalara-Client` | string | header | No | Identifies the software you are using to call this API.  For more information on the client header, see [Client Headers](https://developer.avalara.com/avatax/client-headers/). |
| `X-Correlation-Id` | string | header | No | Use the X-Correlation-ID header to support request correlation through requests. This header should be present on all requests and responses. |
| `avalara-version` | string | header | No | The HTTP Header meant to specify the version of the API intended to be used |

## Responses

| Status | Description | Schema |
|---|---|---|
| 200 | OK | `CompanyFetchResult` |
| 400 | Bad Request | `ErrorInfo` |
| 401 | Unauthorized | `ErrorInfo` |
| 403 | Forbidden | `ErrorInfo` |
| 500 | Internal Server Error | `ErrorInfo` |

### 200 Response: `CompanyFetchResult`

Response returned when querying companies

| Property | Type | Required | Description |
|---|---|---|---|
| `@recordsetCount` | integer | No | The number of records in this response Example: `1`. |
| `value` | Company[] | No | The object storing a company record |
| `@nextLink` | string | No | A link for pagination Example: `nextlink`. |
| `pageKey` | string | No | The page number Example: `1`. |

## Example Request

```bash
curl -X GET "https://api.avalara.com/scs/companies" \
  -H "Authorization: Basic <credentials>" \
  -H "Accept: application/json"
```