# CreateAdvancedRulesBatch

Create a new Advanced Rules batch

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

**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/avatax/api/methods/Batches/CreateAdvancedRulesBatch/

## Description

Create a new Advanced Rules batch objects attached to this company.
            
When an Advanced Rules 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.
            
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:** `CreateAdvancedRulesBatchRequestModel`

Represents a create advanced rules batch request model.

| Property | Type | Required | Description |
|---|---|---|---|
| `name` | string | **Yes** | The user-friendly readable name for this batch. |
| `replaceExisting` | boolean | No | Flag to try updating existing rules instead of just append |
| `options` | string | No | Any optional flags provided for this batch |
| `executions` | AdvancedRuleExecutionModel[] | **Yes** | List of rule executions to import |

## Responses

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

### 200 Response: `CreateAdvancedRulesBatchResponseModel`

Represents a create advanced rules 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/advancedrules" \
  -H "Authorization: Basic <credentials>" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{
  "name": "TestBatch-639185619036673229",
  "replaceExisting": false,
  "executions": [
    {
      "ruleExecutionId": "35362a1cfa694104a5663ac01d2cb031",
      "startDate": "2026-07-02T00:00:00Z",
      "endDate": "9999-12-31T00:00:00",
      "enabled": true,
      "continueOnError": false,
      "ruleId": "bb7165d95f584fb29e3782e7c6a1149b",
      "rule": {
        "ruleId": "e4391c7f6a9f45aba9ae332f7cd6e4df",
        "name": "Generic replace rule",
        "description": "Replaces a target value on the transaction with a replacement value",
        "arEntitlementRequired": false
      },
      "customerDataId": "a81385541eeb4944b0cf601a2bd332bf"
    },
    {
      "ruleExecutionId": "6387818c782f4ae49902cc601b697cfb",
      "startDate": "2026-07-02T00:00:00Z",
      "endDate": "9999-12-31T00:00:00",
      "enabled": true,
      "continueOnError": false,
      "ruleId": "296422a3fdd9420aadf7751b912b2b74",
      "rule": {
        "ruleId": "e70e68a2699c412c84b8904cbc189941",
        "name": "Generic replace rule",
        "description": "Replaces a target value on the transaction with a replacement value",
        "arEntitlementRequired": false
      },
      "customerDataId": "a673b43405ef4d1288915b48cf451424"
    }
  ]
}'
```