VAT
What this does
Calculates VAT on a pound amount. Choose add to go from net to gross (typical shelf price), or remove to extract VAT from a VAT-inclusive total. You set the VAT rate (20% is standard in the UK).
Who it is for
- Invoices and quotes
- Spreadsheet pricing columns
- Small shops checking till totals
- Apps displaying both ex-VAT and inc-VAT prices
Try it
Add 20% VAT to £100 net:
https://fetch.li/v1/vat?amount=100&rate=20&mode=add
Remove VAT from £120 gross:
https://fetch.li/v1/vat?amount=120&rate=20&mode=remove
Reduced rate example:
https://fetch.li/v1/vat?amount=50&rate=5&mode=add
HTTP example
GET /v1/vat?amount=100&rate=20&mode=add HTTP/1.1
Host: fetch.li
Accept: application/json
curl
curl -sS "https://fetch.li/v1/vat?amount=100&rate=20&mode=add"
JavaScript fetch
const params = new URLSearchParams({
amount: "100",
rate: "20",
mode: "add",
});
const response = await fetch(`https://fetch.li/v1/vat?${params}`);
const vat = await response.json();
console.log(vat.gross, vat.vat, vat.net);
Python requests
import requests
response = requests.get(
"https://fetch.li/v1/vat",
params={"amount": 100, "rate": 20, "mode": "add"},
)
response.raise_for_status()
vat = response.json()
print(vat["net"], vat["vat"], vat["gross"])
Example JSON response
Mode add:
{
"mode": "add",
"rate_percent": 20,
"net": 100,
"vat": 20,
"gross": 120,
"currency": "GBP"
}
Mode remove (same numbers, different interpretation of amount input as gross):
{
"mode": "remove",
"rate_percent": 20,
"net": 100,
"vat": 20,
"gross": 120,
"currency": "GBP"
}
Parameters
| Parameter | Required | Type | Description |
|---|---|---|---|
amount |
Yes | number | Pound amount to transform (net if add, gross if remove) |
rate |
Yes | number | VAT rate as a percentage (e.g. 20, 5, 0) |
mode |
Yes | string | add (net → gross) or remove (gross → net) |
Errors that can happen
| HTTP | error.code |
When |
|---|---|---|
| 400 | invalid_body |
Missing parameter, negative amount, invalid mode, or rate out of range |
| 429 | rate_limited |
Demo limit exceeded |
| 500 | internal |
Unexpected server error |
Demo
GET endpoints work without an API key on the public demo tier (60 calls per hour per IP). POST /v1/vibe/classify needs a key.
Try it
GET https://fetch.li/v1/vat
Answer
Response