Want to know how the API looks? Make some requests with the tool below. See how different inputs produce different tax calcluation results, and see what kind of tax information you can expect to get back.
Create a Sandbox Account
This sandbox account is for evaluation only and is initially active for 30 days, but you can request an extension if needed. You will need to add company profile and tax profile information to calculate sales tax. It is based on an AvaTax Basic subscription and includes access to Nexus Jurisdictions in the U.S. and Canada only. To access full AvaTax Pro System Tax Code functionality or Global Nexus Jurisdictions, please contact sales to inquire about a paid development account.
Note: In order to match the sample code we provide, use CompanyCode APITrialCompany when creating your company. If you use some other CompanyCode value remember to change the value in your samples.
Make a Tax Call
Now that you have an account with company settings, you are ready to make an API request!
We have automatically filled in the required POST parameters to calculate the sales tax on a $10 sale amount using the Avalara corporate address at 100 Ravine Lane, Bainbridge Island, WA.
We will make a POST request to URL:
Use your favorite Base64 encoding program or perhaps one of the REST client apps for Google Chrome to create a Basic Authorization Header from your username and password.
It will look something like this:
The POST body will be:
DocDate is the date used to calculate the tax, and to identify the date on which the invoice is recorded. This should be your invoice date.
CustomerCode uniquely identifies the end customer making the purchase.
DocCode is a unique identifier of the transaction. This is often invoice number.
DocType tells Avalara what kind of transaction this is. In this case, it is a document that represents a sale, and should be saved in our database.
Address in this case is used as both the origin and destination. In general, these may not be the same.
Lines is an array of all line items on the invoice (including any freight and miscellaneous charges). Each invoice line should be a line on the tax request, and should specify a line number (unique within the document), quantity, and extended amount.
The dollar amount must be nonzero to calculate nonzero tax (tax on $0 will always be $0).
You will need your account credentials (Username and Password) to make a successful API call.
Document-level tax calculation results are available at the root level of the response, notably TotalTax. This is the total amount of tax calculated on the invoice.
Each Line item in the request is represented in the response by a TaxLine, which shows line-level tax calculation results. The jurisdictional breakout of the tax calculation for each line is displayed as an array of TaxDetails.
Verify Your Results in the Admin Console
The tax request you made in Step 3 will be viewable in the Admin Console. Log in and navigate to the Transactions tab to verify that you have produced a successful outcome.
Example of successful outcome
Moving forward, it's a good idea to periodically review the Admin Console to verify that you're heading in the right direction.