# CreateTransactionBatch

Create a new transaction batch

`POST /api/v2/companies/{companyId}/batches/transactions`

**API:** AvaTax API
**Tag:** Batches
**API Version:** v2
**Base URL:** https://sandbox-rest.avatax.com/
**Content-Type:** `application/json`
**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/CreateTransactionBatch/

## Description

Create a new transaction batch objects attached to this company.
            
When a transaction batch is created, it is added to the AvaTax Batch v2 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/).
            
The maximum content length of the request body is limited to 28.6 MB. If this limit
is exceeded, a 404 Not Found status will be returned (possibly with a CORS error if
the API is called from a browser). In this situation, please split the request into
smaller batches.

### Security Policies

* This API requires one of the following user roles: AccountAdmin, AccountOperator, AvaTaxOnlyAccountAdmin, AvaTaxOnlyCompanyAdmin, BatchServiceAdmin, CompanyAdmin, CSPTester, FirmAdmin, SSTAdmin, SystemAdmin, SystemOperator, TechnicalSupportAdmin.

## Parameters

| Name | Type | In | Required | Description |
|---|---|---|---|---|
| `companyId` | integer | path | Yes | The ID of the company that owns this batch. |
| `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/) . |

## Request Body

**Schema:** `CreateTransactionBatchRequestModel`

Represents a create transaction batch request model.

| Property | Type | Required | Description |
|---|---|---|---|
| `name` | string | **Yes** | The user-friendly readable name for this batch. |
| `transactions` | TransactionBatchItemModel[] | **Yes** | The list of transactions contained in this batch. |
| `options` | string | No | Any optional flags provided for this batch |

## Responses

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

### 200 Response: `CreateTransactionBatchResponseModel`

Represents a create transaction batch response model.

| Property | Type | Required | Description |
|---|---|---|---|
| `id` | integer | No | The unique ID number of this batch. |
| `options` | string | No | Any optional flags provided for this batch |
| `name` | string | **Yes** | The user-friendly readable name for this batch. Example: `TestBatch`. |
| `accountId` | integer | No | The Account ID number of the account that owns this batch. |
| `companyId` | integer | No | The Company ID number of the company that owns this batch. |
| `status` | string | No | This batch's current processing status Values: `Waiting`, `SystemErrors`, `Cancelled`, `Completed`, `Creating`, `Deleted`, `Errors`, `Paused`, `Processing`, `Cancelling`. Example: `Waiting`. |
| `startedDate` | string | No | The date/time when this batch started processing |
| `recordCount` | integer | No | The number of records in this batch; determined by the server |
| `currentRecord` | integer | No | The current record being processed |
| `completedDate` | string | No | The date/time when this batch was completely processed |
| `createdDate` | string | No | The date when this record was created. |
| `createdUserId` | integer | No | The User ID of the user who created this record. |
| `modifiedDate` | string | No | The date/time when this record was last modified. |
| `modifiedUserId` | integer | No | The user ID of the user who last modified this record. |
| `files` | BatchFileModel[] | No | The list of files contained in this batch. |

## Example Request

```bash
curl -X POST "https://sandbox-rest.avatax.com/api/v2/companies/{companyId}/batches/transactions" \
  -H "Authorization: Basic <credentials>" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{
  "name": "TestBatch-639185619036259175",
  "transactions": [
    {
      "createTransactionModel": {
        "code": "MyTransaction-639185619036258285",
        "lines": [
          {
            "number": "1",
            "quantity": 1,
            "amount": 100,
            "taxCode": "PS081282",
            "itemCode": "Y0001",
            "description": "Yarn"
          }
        ],
        "type": "SalesInvoice",
        "companyCode": "DEFAULT",
        "date": "2026-07-02",
        "customerCode": "ABC",
        "purchaseOrderNo": "2026-07-02-001",
        "addresses": {
          "singleLocation": {
            "line1": "2000 Main Street",
            "city": "Irvine",
            "region": "CA",
            "country": "US",
            "postalCode": "92614"
          }
        },
        "commit": true,
        "currencyCode": "USD",
        "description": "Yarn"
      }
    },
    {
      "adjustTransactionModel": {
        "companyCode": "DEFAULT",
        "transactionCode": "MyTransaction-639185619036258285",
        "documentType": "SalesInvoice",
        "adjustmentReason": "PriceAdjusted",
        "adjustmentDescription": "Price drop before shipping",
        "newTransaction": {
          "code": "MyTransaction-639185619036258285",
          "lines": [
            {
              "number": "1",
              "quantity": 1,
              "amount": 90,
              "taxCode": "PS081282",
              "itemCode": "Y0001",
              "description": "Yarn"
            }
          ],
          "type": "SalesInvoice",
          "companyCode": "DEFAULT",
          "date": "2026-07-02",
          "customerCode": "ABC",
          "purchaseOrderNo": "2026-07-02-001",
          "addresses": {
            "singleLocation": {
              "line1": "2000 Main Street",
              "city": "Irvine",
              "region": "CA",
              "country": "US",
              "postalCode": "92614"
            }
          },
          "commit": true,
          "currencyCode": "USD",
          "description": "Yarn"
        }
      }
    },
    {
      "createOrAdjustTransactionModel": {
        "adjustmentReason": "Other",
        "adjustmentDescription": "Test Description",
        "createTransactionModel": {
          "code": "MyTransaction-639185619036258285",
          "lines": [
            {
              "number": "1",
              "quantity": 1,
              "amount": 80,
              "taxCode": "PS081282",
              "itemCode": "Y0001",
              "description": "Yarn"
            }
          ],
          "type": "SalesInvoice",
          "companyCode": "DEFAULT",
          "date": "2026-07-02",
          "customerCode": "ABC",
          "purchaseOrderNo": "2026-07-02-001",
          "addresses": {
            "singleLocation": {
              "line1": "2000 Main Street",
              "city": "Irvine",
              "region": "CA",
              "country": "US",
              "postalCode": "92614"
            }
          },
          "commit": true,
          "currencyCode": "USD",
          "description": "Yarn"
        }
      }
    },
    {
      "voidTransactionModel": {
        "companyCode": "DEFAULT",
        "transactionCode": "MyTransaction-639185619036258285",
        "documentType": "SalesInvoice",
        "code": "DocVoided"
      }
    }
  ]
}'
```