How to use the AuditTransaction endpoint

How to use the AuditTransaction endpoint

The AuditTransaction endpoint can help developers retrieve audit information about a transaction stored in AvaTax. This audit includes the following information:

  • The server timestamp representing the exact server time when the transaction was created
  • The server duration
  • The original API call and response 

When can you use the AuditTransaction endpoint?

AuditTransaction has multiple uses, passing back both the call and response for the transaction.

The original call is returned in a CreateTransactionModel. This means you can plug it straight into other endpoints such as CreateTransaction and AdjustTransaction. This makes creating new transactions based on old transactions, or even just adjusting those original transactions, much easier.

The original response is returned in a TransactionModel that provides more information about a transaction than the AvaTax UI displays. As an example, the response will not only tell you if a transaction was exempt from tax, but also why it was exempt from tax (no nexus selected, based on the tax code, etc.).  

How do you use the AuditTransaction endpoint?

Using AuditTransaction is simple and requires only the company code and the transaction code (aka document code): https://rest.avatax.com/api/v2/companies/{companyCode}/transactions/{transactionCode}/audit

This will return an AuditTransactionModel that contains the following information:

  • CompanyID
  • Reconstructed API Request
  • Original API Request/Response
  • Server Timestamp
  • Server Duration (how long it took to process the transaction)
  • API Call Status

Most of those are straightforward, so let’s look at the difference between the Original and Reconstructed API request.

The Original API request contains the exact API request and response from the original transaction API call, if it’s available.

The Reconstructed API request recreates the API request using stored transaction data. As a result, it may not be an exact match to the original request.

You can use either request to recreate the transaction back into AvaTax.

The big takeaway

This endpoint allows developers to quickly see the original transaction request, including the logic that was applied for this tax determination, such as nexus and taxability rules. This is especially useful for modifying or cloning an existing document.

If you’re not sure the exact transaction you want to look at, but you know it falls in a certain time frame, you can get a list of all your API requests during that period using the AuditAccount endpoint. We’ll cover this in greater detail in a later post.

Recent posts

The 2021 sales tax changes report: midyear update

Your guide to navigating the complicated world of tax compliance and preparing for the future 

The 2021 sales tax changes report: midyear update
2021 MIDYEAR SALES TAX CHANGES

Hear tax and industry experts break down the latest legislative updates and industry trends in our upcoming virtual event.

Stay up to date

Sign up for our free newsletter and stay up to date with the latest tax news.