<commit_before>---
layout: post
title: Estimating Tax with REST v2
date: 2016-11-04 11:00
author: <NAME>
comments: true
categories: [Sales Tax APIs]
product: blog
doctype: blog
disqus: 1
---

It's time to make a sale, and the last thing your customer wants before signing the deal is a final total amount.  What's the best way to get a tax estimate for your customer?

AvaTax is of course built on correctly identifying the exact tax amounts for an invoice; and to do this, we incorporate dozens of factors including the origin and destination address, dollar amounts, taxability rules,  nexus declarations, registration rules, customer exemption certificates, and more.  You can check these out anytime on your <a href="https://admin-avatax.avalara.net">AvaTax Administration Console</a>.  Now let's set how to incorporate estimates into your application using the REST v2 API!

<h3>Preparation is the Best Medicine</h3>

If you're wondering where you should set up your next sales office or warehouse, or if you want a rough guess you can carry around in your pocket, you might want to consider the basic tax rates for each potential location.  Avalara provides a limited-feature "TaxRates" that you can use to provide an estimate and help decide where to make your sale.  Let's begin by showing you a bit of detail and then explain how it works.

This is how you call the TaxRates API:

```json
GET https://sandbox-rest.avatax.com/api/v2/taxrates/byaddress?line1=123%20Main%20Street&city=Irvine&region=CA&postalCode=92615&country=US
```

Because this API is so simple, it's easy to incorporate this API call anywhere in your code that you might need a rough guess - but it's very limited.  It's worth mentioning here that the TaxRates API doesn't handle a lot of critical functionality for a correct tax processing system; it doesn't look at product taxability rules, shipping rules, product use codes, sales tax holidays, resales certificates, charitable sales exemptions, nexus declarations, or anything else.  Here's the answer you get back:

```json
{
  "totalRate": 0.08,
  "rates": [
    {<commit_msg>Rewriting introduction<commit_after>---
layout: post
title: Estimating Tax with REST v2
date: 2016-11-04 11:00
author: <NAME>
comments: true
categories: [Sales Tax APIs]
product: blog
doctype: blog
disqus: 1
---

The AvaTax REST API provides lots of different levels of estimated tax values, and sometimes it may be hard to know the right way to estimate tax for your customers.  For today's blog article, I will be walking you through the different types of estimates that are available in AvaTax REST v2 and how they can help you.

AvaTax is of course built on correctly identifying the exact tax amounts for an invoice; and to do this, we incorporate dozens of factors including the origin and destination address, dollar amounts, taxability rules,  nexus declarations, registration rules, customer exemption certificates, and more.  Remember, transactional taxes are a custom process - to get the right answer, you need to gather all the right information for your company!  You can check out your company's tax configuration and make changes anytime using the <a href="https://admin-avatax.avalara.net">AvaTax Administration Console</a>.

Once you've ensured that your nexus declarations, item catalog, and customer exemption certificates are correct, let's proceed to estimating taxes!

<h3>Preparation is the Best Medicine</h3>

If you're wondering where you should set up your next sales office or warehouse, or if you want a rough guess you can carry around in your pocket, you might want to consider the basic tax rates for each potential location.  Avalara provides a simplified TaxRates API that you can use to provide an estimate and help decide where to make your sale.  Let's begin by showing you a bit of detail and then explain how it works.

This is how you call the TaxRates API:

```json
GET https://sandbox-rest.avatax.com/api/v2/taxrates/byaddress?line1=123%20Main%20Street&city=Irvine&region=CA&postalCode=92615&country=US
```

Because this API is so simple, it's easy to incorporate this API call anywhere in your code that you might need a rough guess - but it's very limited.  It's worth mentioning here that the TaxRates API doesn't handle a lot of critical functionality for a correct tax processing system; it doesn't look at product taxability rules, shipping rules, product use codes, sales tax holidays, resales certificates, charitable sales exemptions, nexus declarations, or anything else.  Here's the answer you get back:

```json
{
  "totalRate": 0.08,
  "rates": [
    {
{'fraction_non_alphanumeric': 0.058899956691208316, 'fraction_numerical': 0.014724989172802079, 'mean_word_length': 4.730769230769231, 'pattern_counts': {'":': 4, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '521879', 'n_tokens_mistral': 1286, 'n_tokens_neox': 1165, 'n_words': 674}