Fetching Transactions

Learn to use the AvaTax API to fetch recorded tax transactions.

Listing transactions by company

We can use the {{BASE_URL}}/companies/{{companyCode}}/transactions endpoint to list up to 1,000 transactions for the requested company. The complete endpoint URL for listing transactions by a company is as follows:

https://sandbox-rest.avatax.com/api/v2/companies/{{companyCode}}/transactions

Some of the request parameters for the URL above are as follows:

Request Parameters

Name

Type

Parameter Type

Category

Description

companyCode

string

Path

Required

This parameter specifies the company code of the company for which we're fetching transactions.

$include

string

Query

Optional

This parameter specifies any objects we want the API to add to our request's API response.

$filter

string

Query

Optional

This parameter specifies how to filter the transaction results.

$top

integer

Query

Optional

This parameter specifies the number of the top transaction results we want to fetch.

$skip

integer

Query

Optional

This parameter specifies the number of top transaction results we want to skip.

$orderBy

string

Query

Optional

This parameter specifies how to order the transaction results and the basis on which they are ordered. It accepts values in the following format: "(fieldname) [ASC|DESC]".

Let’s see how to make an API call to list tax transactions made for a specific company. Click the “Run” button to execute the code.

Press + to interact
Please provide values for the following:
ACCOUNT_ID
Not Specified...
LICENSE_KEY
Not Specified...
COMPANY_CODE
Not Specified...
# Account ID and License Key
account_id = "{{ACCOUNT_ID}}"
license_key = "{{LICENSE_KEY}}"
# Company Code
company_code = "{{COMPANY_CODE}}"
# Endpoint URL
endpoint_url = f"https://sandbox-rest.avatax.com/api/v2/companies/{company_code}/transactions"
# Creating a basic auth token using account ID and license key
auth_token = requests.auth.HTTPBasicAuth(account_id, license_key)
# Define query parameters here
parameters = {
"$top": 50,
"$orderBy": "id ASC"
}
# Making a GET request to the AvaTax API
response = requests.get(url=endpoint_url, auth=auth_token,
params=parameters)
# Printing response
print_response(response)

Here's an explanation for the code widget ...