Skip to content

Look up the automatic sales tax rate for an address

Open .md

POST/v1/api/store/{team_slug}/misc/calc_tax

v1Operation ID v1_public_misc_calc_tax

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_slugstringrequired

    Your team slug, shown as Team ID next to your API key in Profile.

    • Example your-team

Request body

application/json, required.

  • address_idstringrequired

    The ship-to address id: one of the customer's addresses, or one of your team's.

  • Optional. The customer: their tax exemption applies, and the address must be theirs or your team's.

Response

200Successful response.

  • dataobjectrequired
    Child fields (3)
    • shipping_taxablebooleanrequired

      Whether shipping charges are taxed at this address. On a tax-free answer it is often true and means nothing: nothing is taxed.

    • totalinteger | number | stringrequired

      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.

    • typestringrequired

      single_tax: one combined rate in total.

      • One of: "tax_free", "single_tax"
  • statusintegerrequired
  • successbooleanrequired

Errors

  • 401The API key is missing or wrong (unauthenticated).

  • 403You 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.

  • 404Not 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.
  • 422The 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.