# ListBatchesByCompany

Retrieve all batches for this company

`GET /api/v2/companies/{companyId}/batches`

**API:** AvaTax API
**Tag:** Batches
**API Version:** v2
**Base URL:** https://sandbox-rest.avatax.com/
**Accepts:** `application/json`
**Authentication:** API Key (`Authorization` in header) or OAuth 2.0 or Basic (username + license key)

Source: https://developer.avalara.com/products/crossborder/api/methods/Batches/ListBatchesByCompany/

## Description

List all batch objects attached to the specified company.
            
A batch object is a large collection of API calls stored in a compact file.
            
Search for specific objects using the criteria in the `$filter` parameter;
full documentation is available on [Filtering in REST](http://developer.avalara.com/avatax/filtering-in-rest/) .
Paginate results using the `$top`, `$skip`, and `$orderby` parameters.
            
Use [GetBatch](https://developer.avalara.com/api-reference/avatax/rest/v2/methods/Batches/GetBatch/)
to retrieve the results, or check the status, of an individual batch.
            
When a batch is created, it is added to the AvaTax Batch Queue and will be
processed as quickly as possible in the order it was received. To check the
status of a batch, fetch the batch and retrieve the results of the batch
operation.
            
Because the batch system processes with a degree of concurrency, and
because of batch sizes in the queue vary, AvaTax API is unable to accurately
predict when a batch will complete. If high performance processing is
required, please use the
[CreateTransaction API](https://developer.avalara.com/api-reference/avatax/rest/v2/methods/Transactions/CreateTransaction/).

### Security Policies

* This API requires one of the following user roles: AccountAdmin, AccountOperator, AccountUser, AvaTaxOnlyAccountAdmin, AvaTaxOnlyAccountUser, AvaTaxOnlyCompanyAdmin, AvaTaxOnlyCompanyUser, BatchServiceAdmin, CompanyAdmin, CompanyUser, CSPAdmin, CSPTester, FirmAdmin, ReturnsOnlyAccountAdmin, ReturnsOnlyCompanyAdmin, SiteAdmin, SSTAdmin, SystemAdmin, SystemOperator, TechnicalSupportAdmin, TechnicalSupportUser.

## Parameters

| Name | Type | In | Required | Description |
|---|---|---|---|---|
| `companyId` | integer | path | Yes | The ID of the company that owns these batches |
| `$filter` | string | query | No | A filter statement to identify specific records to retrieve.  For more information on filtering, see [Filtering in REST](http://developer.avalara.com/avatax/filtering-in-rest/).*Not filterable:* files |
| `$include` | string | query | No | A comma separated list of additional data 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 sort statements in the format `(fieldname) [ASC|DESC]`, for example `id ASC`. |
| `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/) . |

## Responses

| Status | Description | Schema |
|---|---|---|
| 200 | Success | `BatchModelFetchResult` |
| 400 | Bad Request |  |
| 401 | Unauthorized |  |
| 404 | Not Found |  |

### 200 Response: `BatchModelFetchResult`

| Property | Type | Required | Description |
|---|---|---|---|
| `@recordsetCount` | integer | No |  |
| `value` | BatchModel[] | No |  |
| `@nextLink` | string | No |  |
| `pageKey` | string | No |  |

## Example Request

```bash
curl -X GET "https://sandbox-rest.avatax.com/api/v2/companies/{companyId}/batches" \
  -H "Authorization: Basic <credentials>" \
  -H "Accept: application/json"
```