# CreateDistanceThreshold

Create one or more DistanceThreshold objects

`POST /api/v2/companies/{companyId}/distancethresholds`

**API:** AvaTax API
**Tag:** DistanceThresholds
**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/DistanceThresholds/CreateDistanceThreshold/

## Description

Create one or more DistanceThreshold objects for this company.
            
A company-distance-threshold model indicates the distance between a company
and the taxing borders of various countries.  Distance thresholds are necessary
to correctly calculate some value-added taxes.

### Security Policies

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

## Parameters

| Name | Type | In | Required | Description |
|---|---|---|---|---|
| `companyId` | integer | path | Yes | The unique ID number of the company that owns this DistanceThreshold |
| `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:** `CompanyDistanceThresholdModel[]`

A company-distance-threshold model indicates the distance between a company
and the taxing borders of various countries.  Distance thresholds are necessary
to correctly calculate some value-added taxes.
            
Distance thresholds only apply to sales of goods in certain countries.  A distance threshold
is applied for each ship-from/ship-to combination of countries.  The threshold amount is defined by
the ship-to country.
            
Generally, if you have exceeded a distance threshold for taxes between a pair of countries, your tax calculation
will be determined to be the rate in the destination country.  If you have not exceeded the threshold,
your tax calculation will be determined to be the rate in the origin country.
            
The amount of a threshold is not tracked or managed in AvaTax, but the decision of your tax compliance department
as to whether you have exceeded this threshold is maintained in this object.
            
By default, you are considered to have exceeded tax thresholds. If you wish to change this default, you can create
a company-distance-threshold object to select the correct behavior for this origin/destination tax calculation process.

| Property | Type | Required | Description |
|---|---|---|---|
| `id` | integer | No | A unique ID number representing this distance threshold object. Example: `0`. |
| `companyId` | integer | No | The ID number of the company that defined this distance threshold. Example: `0`. |
| `originCountry` | string | **Yes** | The origin country for this threshold.
            
This field supports many different country identifiers:
 * Two character ISO 3166 codes
 * Three character ISO 3166 codes
 * Fully spelled out names of the country in ISO supported languages
 * Common alternative spellings for many countries
            
For a full list of all supported codes and names, please see the Definitions API `ListCountries`. Example: `FR`. |
| `destinationCountry` | string | **Yes** | The destination country for this threshold.
            
This field supports many different country identifiers:
 * Two character ISO 3166 codes
 * Three character ISO 3166 codes
 * Fully spelled out names of the country in ISO supported languages
 * Common alternative spellings for many countries
            
For a full list of all supported codes and names, please see the Definitions API `ListCountries`. Example: `BR`. |
| `effDate` | string | No | For distance threshold values that change over time, this is the earliest date for which this distance
threshold is valid.  If null, this distance threshold is valid for all dates earlier than the `endDate` field. |
| `endDate` | string | No | For distance threshold values that change over time, this is the latest date for which this distance
threshold is valid.  If null, this distance threshold is valid for all dates later than the `effDate` field. |
| `thresholdExceeded` | boolean | No | True if your tax professional has determined that the value-added tax distance threshold is exceeded for this pair of countries.
            
If you set this value to `false`, your value added taxes will be calculated using the origin country.  Otherwise, value
added taxes will be calculated on the destination country. Example: `false`. |
| `type` | string | **Yes** | Indicates the distance threshold type.
            
This value can be either `Sale` or `Purchase`. Example: `Sale`. |

## Responses

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

## Example Request

```bash
curl -X POST "https://sandbox-rest.avatax.com/api/v2/companies/{companyId}/distancethresholds" \
  -H "Authorization: Basic <credentials>" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '[
  {
    "id": 0,
    "companyId": 0,
    "originCountry": "FR",
    "destinationCountry": "BR",
    "thresholdExceeded": false,
    "type": "Sale"
  }
]'
```