Companies
Learn to use the AvaTax API to manage the companies associated with your business.
We'll cover the following...
Avalara caters to the taxation needs of almost any business, whether it’s a sole proprietorship or a large {{BASE_URL}}/companies/
endpoint to manage a company account.
Using a company account, we can attribute the correct taxes to a specific business. This is helpful when managing several company accounts for a company with multiple subsidiaries.
Creating a company
We use the {{BASE_URL}}/companies
endpoint and the POST method to create a company using the AvaTax API. While creating a company, we can add several nested objects, such as contacts
and items
, which aid AvaTax in calculating tax more accurately. The complete endpoint URL for creating a company is as follows:
https://sandbox-rest.avatax.com/api/v2/companies
Some of the request parameters for the URL above are as follows:
Request Parameters
Name | Type | Parameter Type | Category | Description |
| integer | Body | Required | This parameter specifies the UUID of the company we're creating. |
| integer | Body | Required | This parameter specifies the UUID of our Avalara account, which owns this company. |
| string | Body | Optional | This parameter specifies this company's unique code, allowing us to reference our company in Avalara quickly. |
| string | Body | Required | This parameter specifies the name of this company. |
| boolean | Body | Optional | This boolean parameter specifies whether the company we're creating is the default company of our Avalara account. |
| boolean | Body | Optional | This boolean parameter specifies whether Avalara can perform tax transactions on this company. When set to |
| string | Body | Required | This parameter specifies the default country this company is going to be based in. This helps Avalara apply tax rules of the specified country by default when creating tax transactions for it. We need to pass the two-character ISO-3166 code of the country we're trying to set as default. |
| array of contact objects | Body | Optional | This parameter specifies the list of contacts for this company. |
| array of item objects | Body | Optional | This parameter specifies the list of items for this company. These items represent the goods and services provided by the company. |
| array of location objects | Body | Optional | This parameter specifies the list of locations for this company. |
Let’s see how to make an API call to create a company in Avalara. Click the “Run” button to execute the code.
# Account ID and License Keyaccount_id = "{{ACCOUNT_ID}}"license_key = "{{LICENSE_KEY}}"# Endpoint URLendpoint_url = "https://sandbox-rest.avatax.com/api/v2/companies"# Creating a basic auth token using account ID and license keyauth_token = requests.auth.HTTPBasicAuth(account_id, license_key)# Defining company detailsdata_obj = {"accountId": int(account_id),"name": f"Company {random.randint(0,9999999)}","isDefault": False,"isActive": True,"hasProfile": True,"defaultCountry": "US","baseCurrencyCode": "USD","isTest": True,}# Making a POST request to the AvaTax APIresponse = requests.post(url=endpoint_url, auth=auth_token,data=json.dumps(data_obj))# Printing responseprint_response(response)
Here's an explanation for the code widget above:
Line 6: We define the endpoint URL.
Line 9: We define the authorization parameters. You can update these by modifying the
auth_token
...