> This page is for APIs, version Calculations.
> For other versions, use one of these documentation indexes:
> - Overview (default): https://avalara.ferndocs.com/api-reference/overview/llms.txt
> - Calculations: https://avalara.ferndocs.com/api-reference/calculations/llms.txt
> - E-invoicing: https://avalara.ferndocs.com/api-reference/e-invoicing/llms.txt
> - Brazil: https://avalara.ferndocs.com/api-reference/brazil/llms.txt
> - Returns: https://avalara.ferndocs.com/api-reference/returns/llms.txt
> - Shared service: https://avalara.ferndocs.com/api-reference/shared-service/llms.txt
> - 1099 & W-9: https://avalara.ferndocs.com/api-reference/1099-w9/llms.txt
> - Tax registrations & business licenses: https://avalara.ferndocs.com/api-reference/tax-registrations/llms.txt
> - ECM: https://avalara.ferndocs.com/api-reference/ecm/llms.txt
> - Cross-Border: https://avalara.ferndocs.com/api-reference/cross-border/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://avalara.ferndocs.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://avalara.ferndocs.com/_mcp/server.

# Tax Rates By Postal Code

GET https://rest.avatax.com/api/v2/taxrates/bypostalcode

> **Access control:** this endpoint is available to users with the `everyone` role.

This API is only available for a US postal codes.
            
Usage of this API is subject to rate limits.  Users who exceed the rate limit will receive HTTP
response code 429 - `Too Many Requests`.
            
This API assumes that you are selling general tangible personal property at a retail point-of-sale
location in the United States only.
            
Please be advised that this endpoint is designed for approximate tax rate estimation only and
may not yield precise results. For a more powerful and accurate tax estimation, upgrade to the
`CreateTransaction` API, which offers a variety of advanced features including, but not limited
to:
            
* Nexus declarations
* Taxability based on product/service type
* Sourcing rules affecting origin/destination states
* Customers who are exempt from certain taxes
* States that have dollar value thresholds for tax amounts
* Refunds for products purchased on a different date
* Detailed jurisdiction names and state assigned codes
* And more!
            
Please see [Estimating Tax with REST v2](http://developer.avalara.com/blog/2016/11/04/estimating-tax-with-rest-v2/)
for information on how to upgrade to the full AvaTax CreateTransaction API.

Reference: https://avalara.ferndocs.com/api-reference/calculations/ava-tax/public-reference/tax-rates-by-postal-code

## Authentication

- `Authorization` header (required) — API Key authentication via header

## Request

### Query parameters

- `country` (string, required) — Name or ISO 3166 code identifying the country. This field supports many different country identifiers: * Two character ISO 3166 codes * Three character ISO 3166 codes * Fully spelled out names of the country in ISO supported languages * Common alternative spellings for many countries For a full list of all supported codes and names, please see the Definitions API `ListCountries`.
- `postalCode` (string, required) — The postal code of the location.

### Headers

- `X-Avalara-Client` (string, optional, default: Swagger UI; 26.7.0; Custom; 1.0) — Identifies the software you are using to call this API. For more information on the client header, see [Client Headers](https://developer.avalara.com/avatax/client-headers/) .

## Response

### 200

Success

- `totalRate` (double, optional) — The total sales tax rate for general tangible personal property sold at a retail point of presence in this jurisdiction on this date.
- `rates` (list of RateModel, optional) — The list of individual rate elements for general tangible personal property sold at a retail point of presence in this jurisdiction on this date.

## Errors

### 400 Bad Request Error

Bad Request

- `any`

### 401 Unauthorized Error

Unauthorized

- `any`

## Types

### RateModel

Indicates one element of a sales tax rate.

- `rate` (double, optional) — The sales tax rate for general tangible personal property in this jurisdiction.
- `name` (string, optional) — A readable name of the tax or taxing jurisdiction related to this tax rate.
- `type` (enum, optional) — The type of jurisdiction associated with this tax rate.
  - Allowed values: `Country`, `State`, `County`, `City`, `Special`

## Examples

**Response**

```json
{
  "totalRate": 0.095,
  "rates": [
    {
      "rate": 0.06,
      "name": "CA STATE TAX",
      "type": "State"
    }
  ]
}
```

**SDK Code**

```python
import requests

url = "https://rest.avatax.com/api/v2/taxrates/bypostalcode"

querystring = {"country":"country","postalCode":"postalCode"}

headers = {"Authorization": "<apiKey>"}

response = requests.get(url, headers=headers, params=querystring)

print(response.json())
```

```javascript
const url = 'https://rest.avatax.com/api/v2/taxrates/bypostalcode?country=country&postalCode=postalCode';
const options = {method: 'GET', headers: {Authorization: '<apiKey>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://rest.avatax.com/api/v2/taxrates/bypostalcode?country=country&postalCode=postalCode"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "<apiKey>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://rest.avatax.com/api/v2/taxrates/bypostalcode?country=country&postalCode=postalCode")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = '<apiKey>'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://rest.avatax.com/api/v2/taxrates/bypostalcode?country=country&postalCode=postalCode")
  .header("Authorization", "<apiKey>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://rest.avatax.com/api/v2/taxrates/bypostalcode?country=country&postalCode=postalCode', [
  'headers' => [
    'Authorization' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://rest.avatax.com/api/v2/taxrates/bypostalcode?country=country&postalCode=postalCode");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "<apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://rest.avatax.com/api/v2/taxrates/bypostalcode?country=country&postalCode=postalCode")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```