# Look up the automatic sales tax rate for an address

```http
POST https://secure.yoprint.com/v1/api/store/{team_slug}/misc/calc_tax
```

- API version: v1
- Operation ID: `v1_public_misc_calc_tax`
- Section: Sales › [Sales tax](https://developer.yoprint.com/reference/sales-tax.md)
- Web page: https://developer.yoprint.com/reference/sales-tax/v1-misc-calc-tax/
- Authentication: `Authorization: Bearer YOUR_API_KEY`

Returns the US sales tax rate YoPrint's automatic sales tax would apply when shipping to an address, and whether shipping is taxable. It returns a rate, not a tax amount, and saves nothing.

The rate is tax-free (`type` `tax_free`, `total` 0) when your team is not on a US plan, the customer is tax exempt, the address is outside the US, your team has no nexus address in the address's state, or that state has no sales tax. Otherwise YoPrint locates the address and looks up its combined rate, applying each state's origin or destination rules.

`total` is the combined rate as the percentage × 10,000: 8.25% is `82500`. This is not the thousandths used for other rates in the API (where 8.25% is `8250`).

## Permission

Any member of a team whose plan includes automatic sales tax.

## Business rules

- `address_id` is required. With `customer_id`, the address must belong to that customer or to your team.
- Only US destinations get a rate; everything else is tax-free.

## Side effects

- Looks the address up with an external geocoding service and a tax rate service. Results are cached, so repeat lookups are fast. Nothing is charged to your team.

## Path parameters

- `team_slug` (string, required): Your team slug, shown as Team ID next to your API key in Profile. Example `your-team`.

## Request body

Content type `application/json`, required.

Fields:

- `address_id` (string, required): The ship-to address id: one of the customer's addresses, or one of your team's.
- `customer_id` (string, optional): Optional. The customer: their tax exemption applies, and the address must be theirs or your team's.

### Example request

```bash
curl -X POST 'https://secure.yoprint.com/v1/api/store/your-team/misc/calc_tax' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Accept: application/json' \
  -H 'X-Yoprint-Decimal-Format: exact-v1' \
  -H 'Content-Type: application/json' \
  -d '{
    "address_id": "RNG2OuYC20YzXs",
    "customer_id": "63KcENAAsKuipY"
  }'
```

## Response

`200` Successful response.

Fields:

- `data` (object, required)
  - `shipping_taxable` (boolean, required): Whether shipping charges are taxed at this address. On a tax-free answer it is often `true` and means nothing: nothing is taxed.
  - `total` (integer | number | string, required): The combined rate, as the percentage × 10,000: 8.25% is `82500`. A string (`"82500"`) or a number (`82500`), depending on the state; `0` when tax-free. Parse both.
  - `type` (string, required): `single_tax`: one combined rate in `total`. One of: `"tax_free"`, `"single_tax"`.
- `status` (integer, required)
- `success` (boolean, required)

Example response:

```json
{
  "data": {
    "shipping_taxable": true,
    "total": "82500",
    "type": "single_tax"
  },
  "status": 200,
  "success": true
}
```

## Errors

- `401` The API key is missing or wrong (`unauthenticated`).
- `403` You are not allowed to do this. `api_access_not_in_plan`: your team's plan doesn't include API access (Pro and above, with an active subscription or trial), so every request answers this until the team upgrades. When your role lacks the permission the operation needs, the body is only `{"message": "Insufficient Permission"}`. Other refusals use the error envelope, with `unauthorized` or `user_is_not_authorized`.
- `404` Not found. `page_not_found`: the team slug is unknown, you are not a member of the team, or an id in the path is not one of this team's. `code: null`, with a message that starts "No query results for": there is no record with that id.
  - When: The address or customer does not exist on this team, or the address belongs to another customer. Fix: Use an address of this customer or of your team.
- `422` The request was refused and changed nothing: `validation_failed` lists what to fix in `error.fields`, other codes name a business rule. When the team's plan does not include the feature, the body is only `{"message": "This feature is not available to your team's plan."}`.
  - When: Your plan does not include automatic sales tax (a plain `{"message": "This feature is not available to your team's plan."}` body). Fix: Upgrade the plan, or set tax on the order yourself.
  - When: `address_id` is missing, or `address_id` or `customer_id` is not an id of this team (`validation_failed`; `error.fields` names the field). Fix: Send the ship-to address id.
  - When: The rate could not be looked up (`auto_tax_calculation_failed`, "Auto Tax calculation failed. Please retry later."). Fix: Retry later.

## Notes

- A tax-free answer does not say why (not US, exempt, no nexus in that state, or a state without sales tax). Check the customer's exemption and your nexus addresses if you expected tax.
