# VarianceReport

Generates the Variance report which will capture the difference between "Tax Calculated by Avalara" Vs "Actual Tax" paid at custom clearance at line / header level.

`POST /api/v2/companies/{companyCode}/variance`

**API:** AvaTax API
**Tag:** Transactions
**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/Transactions/VarianceReport/

## Description

### Security Policies

* This API requires one of the following user roles: AccountAdmin, AccountOperator, AccountUser, AvaTaxOnlyAccountAdmin, AvaTaxOnlyAccountUser, AvaTaxOnlyCompanyAdmin, AvaTaxOnlyCompanyUser, BatchServiceAdmin, CompanyAdmin, CompanyUser, CSPAdmin, CSPTester, ProStoresOperator, ReturnsOnlyAccountAdmin, ReturnsOnlyAccountUser, ReturnsOnlyCompanyAdmin, ReturnsOnlyCompanyUser, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
* This API depends on the following active services:*Required* (all):  AvaTaxPro, BasicReturns.

## Parameters

| Name | Type | In | Required | Description |
|---|---|---|---|---|
| `companyCode` | string | path | Yes |  |
| `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:** `VarianceRequestModel[]`

Request model used as input for Variance API.

| Property | Type | Required | Description |
|---|---|---|---|
| `documentId` | integer | No |  |
| `documentCode` | string | No |  |
| `purchaseOrderNo` | string | No |  |
| `referenceNo` | string | No |  |
| `exchangeRate` | number | No |  |
| `lines` | VarianceLine[] | No |  |
| `amount` | VarianceUnit | No |  |
| `taxableAmount` | VarianceUnit | No |  |
| `dutyPaid` | VarianceUnit | No |  |
| `taxPaid` | VarianceUnit | No |  |
| `totalTaxPaid` | VarianceUnit | No |  |
| `details` | VarianceDetail[] | No |  |

## Responses

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

### 200 Response: `VarianceResponseModel`

| Property | Type | Required | Description |
|---|---|---|---|
| `totalRequest` | integer | No |  Example: `0`. |
| `variance` | VarianceResponseEntity[] | No |  |

## Example Request

```bash
curl -X POST "https://sandbox-rest.avatax.com/api/v2/companies/{companyCode}/variance" \
  -H "Authorization: Basic <credentials>" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '[
  {
    "documentId": "",
    "documentCode": "",
    "purchaseOrderNo": "",
    "referenceNo": "",
    "exchangeRate": "",
    "lines": [
      {
        "lineNo": "",
        "hsCode": "",
        "dutyRate": "",
        "taxRate": "",
        "amount": {
          "amount": "",
          "currency": ""
        },
        "taxableAmount": {
          "amount": "",
          "currency": ""
        },
        "dutyPaid": {
          "amount": "",
          "currency": ""
        },
        "taxPaid": {
          "amount": "",
          "currency": ""
        },
        "totalTaxPaid": {
          "amount": "",
          "currency": ""
        },
        "details": [
          {
            "taxSubType": "",
            "amount": "",
            "currency": ""
          }
        ]
      }
    ],
    "amount": {
      "amount": "",
      "currency": ""
    },
    "taxableAmount": {
      "amount": "",
      "currency": ""
    },
    "dutyPaid": {
      "amount": "",
      "currency": ""
    },
    "taxPaid": {
      "amount": "",
      "currency": ""
    },
    "totalTaxPaid": {
      "amount": "",
      "currency": ""
    },
    "details": [
      {
        "taxSubType": "",
        "amount": "",
        "currency": ""
      }
    ]
  }
]'
```