Fetching Transactions
Learn to use the AvaTax API to fetch recorded tax transactions.
We'll cover the following...
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 |
| string | Path | Required | This parameter specifies the company code of the company for which we're fetching transactions. |
| string | Query | Optional | This parameter specifies any objects we want the API to add to our request's API response. |
| string | Query | Optional | This parameter specifies how to filter the transaction results. |
| integer | Query | Optional | This parameter specifies the number of the top transaction results we want to fetch. |
| integer | Query | Optional | This parameter specifies the number of top transaction results we want to skip. |
| 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: |
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.
# Account ID and License Keyaccount_id = "{{ACCOUNT_ID}}"license_key = "{{LICENSE_KEY}}"# Company Codecompany_code = "{{COMPANY_CODE}}"# Endpoint URLendpoint_url = f"https://sandbox-rest.avatax.com/api/v2/companies/{company_code}/transactions"# Creating a basic auth token using account ID and license keyauth_token = requests.auth.HTTPBasicAuth(account_id, license_key)# Define query parameters hereparameters = {"$top": 50,"$orderBy": "id ASC"}# Making a GET request to the AvaTax APIresponse = requests.get(url=endpoint_url, auth=auth_token,params=parameters)# Printing responseprint_response(response)
Here's an explanation for the code widget ...