apyhub
Back
▣ VERIFICATION KIT

Calculate VAT and GST API

What it does

VAT and GST Calculator computes sales tax amounts from a single amount, a VAT/GST rate, a country name, a VAT amount, or a set of invoice lines. It returns a structured calculation based on the values you send, using the built-in country and province rate table when you provide a country.

Send amount and either ratePct or country to calculate tax on a net amount. Set amountIncludesTax to true when the amount already includes tax and you want the tax backed out. If you already know the tax line from a receipt, send vatAmount and the calculator returns the net and gross it implies. For invoices with different rates, send lines with per-line amount values and optional ratePct overrides.

Use it when you need to quote taxes in checkout flows, validate tax values on invoices, or normalize receipts from different jurisdictions. The service supports a 59-entry country and province rate table, including countries such as Germany, the United Kingdom, Australia, Singapore, UAE, and Canadian province groups.

POST
Calculate VAT or GST on an amount using a 61-entry country and province rate table
https://api.eu.apyhub.com/freedailypro/calculate-vat-gst/vat-gst

QUICKSTART

GUIDE

Quickstart

Calculate VAT or GST from a single amount using the tax rate for a country.

curl -X POST "https://api.eu.apyhub.com/freedailypro/calculate-vat-gst/vat-gst" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"amount":100,"country":"Germany"}'

What you'll get back

Returns a JSON object.

{
  "result": {
    "net": 100,
    "tax": 19,
    "gross": 119,
    "ratePct": 19,
    "country": "Germany"
  }
}
TRY ITLIVE · 10 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.
body*
lines
Invoice lines at different rates: returns a subtotal per rate (byRate) and a grand total. Use instead of amount.
The amount, in any currency. Send this, or vatAmount, or lines.
Country name (for example Germany, United Kingdom, Australia, Singapore, UAE). Looks up the standard VAT/GST rate. Canada has one entry per province group, e.g. 'Canada - Ontario HST'. The error for an unknown name lists every supported entry.

About this endpoint

What it does

Calculates VAT or GST for an amount using either a provided rate, a country lookup, or line-level rates. It can also derive the net and gross amounts from a VAT amount, and it supports multi-line invoices grouped by rate.

Request Body

ParameterTypeMandatoryDescription
linesObject ArrayNoInvoice lines at different rates: returns a subtotal per rate (byRate) and a grand total. Use instead of amount. Each item must include amount; ratePct is optional and defaults to the top-level ratePct or the country's standard rate. Maximum 200 items.
lines[].amountNumberYesThe line amount (net, or gross when amountIncludesTax is true). Minimum 0.
lines[].ratePctNumberNoThis line's rate in percent. Minimum 0. Defaults to the top-level ratePct or the country's standard rate.
amountNumberNoThe amount, in any currency. Send this, or vatAmount, or lines.
countryStringNoCountry name used to look up the standard VAT/GST rate. Examples in the schema include Germany, United Kingdom, Australia, Singapore, UAE. Canada uses province-group entries such as Canada - Ontario HST.
ratePctNumberNoVAT/GST rate in percent. Required unless country is sent. Takes priority over country.
vatAmountNumberNoThe VAT amount shown on a receipt: returns the net and gross it implies at the rate. Requires a rate above 0. Minimum 0. Use instead of amount.
amountIncludesTaxBooleanNotrue when amount already includes the tax, so the tax is taken out of it.

Response

The endpoint returns a JSON object with the result under result. Which fields appear depends on how you called it, as shown in the last column.

FieldTypeDescriptionReturned
netNumberAmount before tax.Always
taxNumberThe VAT or GST, rounded to the cent.Always
grossNumberNet plus tax.Always
ratePctNumberThe rate that was applied, in percent.Single amount and vatAmount
rateSourceStringWhere the rate came from, for example ratePct sent by the caller.When a rate was used
modeStringlines for an invoice with lines, or fromVatAmount when you sent vatAmount.lines and vatAmount
amountsIncludeTaxBooleantrue if the line amounts already included tax.lines
lineCountIntegerNumber of lines sent.lines
byRateArrayOne row per rate, with the totals for the lines at that rate.lines
byRate[].ratePctNumberThe rate for this group, in percent.lines
byRate[].linesIntegerHow many lines are in this group.lines
byRate[].netNumberNet subtotal of the group.lines
byRate[].taxNumberTax on the group, worked out once on the subtotal.lines
byRate[].grossNumberNet plus tax for the group.lines
vatAmountNumberThe VAT amount you sent.vatAmount
netRangeObjectThe lowest (min) and highest (max) net amounts that would print this same VAT on a receipt, since receipts round VAT to the cent.vatAmount
countryStringThe country used to find the rate.When country was sent
standardRatePctNumberThat country's standard rate.When country was sent
reducedRatesPctNumber ArrayThat country's reduced rates.When country was sent
ratesAsOfStringThe month the country rates are valid for.When country was sent
taxYearIntegerTax year of the rates.Always
dataStatusStringStatus of the rate data. caller-supplied means you sent the rate, and estimate means it came from the country table.Always
sourcesStringWhere the rates come from.Always
notesString ArrayNotes about how this result was worked out.Always
disclaimerStringUse notice.Always
stepsArrayThe calculation, one step at a time.Always
steps[].labelStringName of the step, for example Lines at 44%.Always
steps[].formulaStringThe formula used.Always
steps[].inputsObjectThe numbers that went into the step.Always
steps[].resultNumber or StringThe result of the step.Always
▣ COMMON ERRORS

Errors any endpoint can return

400bad_request

Required parameter missing or malformed body.

401unauthorized

API key missing, revoked, or not authorized for this service.

429rate_limited

Your plan's per-second rate exceeded. Retry with exponential backoff.

503upstream_busy

Backend temporarily unavailable. Try again in a few seconds.