Skip to content

Free Sri Lanka vehicle import tax API

The same calculation as the website, for your own site, app or spreadsheet. It follows the Sri Lanka Customs gazettes, names the rate version it used, and costs nothing.

Quick start

No sign-up and no key. Send the tax class, the CIF value and what the class measures (engine capacity, motor power…). The machine-readable description is the OpenAPI 3.1 spec, which also works with Postman, code generators and Custom GPT actions.

curl
curl -X POST https://autoimports.webgen.live/api/v1/calculate \
  -H "Content-Type: application/json" \
  -d '{ "mode": "class", "taxClassKey": "hybrid_petrol", "cif": { "amount": 1500000, "currency": "JPY" }, "measure": 1500, "vehicleAge": 1 }'

Everything can also go in the address, for tools that can only open a link. format=md returns readable Markdown:

curl
curl "https://autoimports.webgen.live/api/v1/quote?class=hybrid_petrol&cc=1500&age=1&cif=1500000&currency=JPY&format=md"

Not sure which taxClassKey to use? List them with GET /api/v1/tax-classes, or browse the import tax pages.

More languages

JavaScript (server)
const res = await fetch("https://autoimports.webgen.live/api/v1/calculate", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    mode: "class",
    taxClassKey: "hybrid_petrol",
    cif: { amount: 1_500_000, currency: "JPY" },
    measure: 1500,
    vehicleAge: 1,
  }),
});
const quote = await res.json();
console.log(quote.totalTax, "LKR in taxes, rates v" + quote.rateVersion);
JavaScript (in a web page)
// Runs in a visitor's browser: any website may call the API (CORS is open)
const res = await fetch("https://autoimports.webgen.live/api/v1/quote?class=petrol&cc=1000&age=1&cif=1200000&currency=JPY");
const { totalTax, totalCost, rateVersion } = await res.json();
Python
import requests

quote = requests.post(
    "https://autoimports.webgen.live/api/v1/calculate",
    json={
        "mode": "class",
        "taxClassKey": "hybrid_petrol",
        "cif": {"amount": 1_500_000, "currency": "JPY"},
        "measure": 1500,
        "vehicleAge": 1,
    },
    timeout=10,
).json()
print(quote["totalTax"], "LKR in taxes, rates v", quote["rateVersion"])
PHP
<?php
$payload = json_encode([
    "mode" => "class",
    "taxClassKey" => "hybrid_petrol",
    "cif" => ["amount" => 1500000, "currency" => "JPY"],
    "measure" => 1500,
    "vehicleAge" => 1,
]);
$ch = curl_init("https://autoimports.webgen.live/api/v1/calculate");
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => $payload,
    CURLOPT_HTTPHEADER => ["Content-Type: application/json"],
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_TIMEOUT => 10,
]);
$quote = json_decode(curl_exec($ch), true);
echo $quote["totalTax"] . " LKR in taxes, rates v" . $quote["rateVersion"];
Google Sheets (Apps Script custom function)
/** =IMPORT_TAX("hybrid_petrol", 1500, 1, 1500000, "JPY")  → total tax in LKR */
function IMPORT_TAX(taxClass, measure, age, cif, currency) {
  const q = "class=" + encodeURIComponent(taxClass) + "&cc=" + measure + "&age=" + age +
    "&cif=" + cif + "&currency=" + encodeURIComponent(currency);
  const res = UrlFetchApp.fetch("https://autoimports.webgen.live/api/v1/quote?" + q, { muteHttpExceptions: true });
  const body = JSON.parse(res.getContentText());
  if (res.getResponseCode() !== 200) throw new Error(body.error.message);
  return body.totalTax;
}

Building a chat assistant instead? See the MCP server and ChatGPT, Gemini and other chats. Want a ready-made calculator on your page? See embedding.

POST /api/v1/calculate

Send JSON with Content-Type: application/json (16 KB at most).

FieldWhat it is
modeclass (most vehicles; needs taxClassKey) or cab (the receipt-based method for cabs and pickups; no class).
taxClassKeyFrom GET /api/v1/tax-classes, e.g. petrol, hybrid_petrol, electric.
cifamount and currency (ISO code such as JPY, USD, GBP, LKR). CIF is cost + insurance + freight to Colombo. Add fxRate (LKR per unit) and fxManual: true to use your own exchange rate; otherwise the live rate is used.
measureWhat the class measures: cc, kW, seats, payload or GVW. Each tax class says which, in its measure field. Classes that need none ignore it.
vehicleAgeYears old. Only classes with needsAge: true use it.
additionalUp to 3 extra charges (handling, clearing, other), each with amount and currency, added to the landed cost.
vehicleOptional make, model, year. Echoed back; they do not change the tax.
localeen (default), si or ta: the language of labels and the link back.
include["breakdown"] adds the full engine breakdown; ["applicable"] adds every band of the class.

The answer

Amounts are whole Sri Lankan rupees. Within v1 the answer only grows: fields are added, never removed or renamed.

200 OK (shortened)
{
  "calcId": "0b7c…",
  "rateVersion": 2,
  "ratesPublishedAt": "2026-10-17T04:57:37.990741+00:00",
  "currency": "LKR",
  "vehicle": {
    "category": { "key": "car", "label": "Cars / Station Wagons" },
    "taxClass": { "key": "hybrid_petrol", "label": "Hybrid Petrol", "hsCode": "8703.4x.xx" },
    "measure": { "value": 1500, "unit": "cc" },
    "ageYears": 1
  },
  "cif": { "amount": 1500000, "currency": "JPY" },
  "fx": { "rate": 2.0924, "source": "Frankfurter", "date": "2026-10-18", "manual": false },
  "cifLkr": 3138600,
  "taxes": [
    { "code": "cid", "label": "Customs import duty (CID)", "amount": 941580, "basis": "30%" },
    { "code": "excise", "label": "Excise duty", "amount": 5175000, "basis": "1,500 CC x LKR 3,450/CC" }
    // … surcharge, luxury, pal, sscl, vat, vel, other
  ],
  "totalTax": 8660535,
  "totalCost": 11799135,
  "effectiveRate": 275.9,
  "calculatorUrl": "https://…/calculator?category=car&class=hybrid_petrol",
  "sources": [ { "charge": "excise", "references": [ { "label": "G.N. 2418/43", … } ], … } ],
  "disclaimer": "This is an estimate only. …"
}
  • rateVersion and ratesPublishedAt say which published rates priced it. Show them to your users: rates change with each gazette.
  • taxes lists every charge in the order Customs applies it, with the rule used.
  • sources names the gazettes and Acts behind each charge.
  • calculatorUrl opens the website's calculator for the same class, where the user can get a PDF.

Other endpoints

EndpointReturns
GET /api/v1/quoteA calculation from query parameters (class, cc | kw | seats | payload | gvw, age, cif, currency, fx, locale, format=md).
GET /api/v1/categoriesVehicle categories: cars, vans, trucks, buses, cabs…
GET /api/v1/tax-classesTax classes, each with what to measure and whether age matters. Filter with ?category=car.
GET /api/v1/ratesThe live rate version, the currencies, the cab rates and the legal sources.
GET /api/v1/rates/{taxClass}One class with every excise and age band it uses.
GET /api/v1/fx?currency=JPYThe LKR exchange rate and where it came from.
GET /api/v1/openapi.jsonThis API as an OpenAPI 3.1 document, for code generators, Postman and GPT Actions.

Every endpoint answers browsers from any website (CORS), so you can call the API straight from your page.

Errors

Errors are JSON: { "error": { "code", "message", "issues": [{ "path", "code" }] } }. The code values are stable; issues point at each bad field.

StatusCodeMeaning
400invalid_requestA field is missing or invalid. See issues.
400invalid_jsonThe body is not JSON.
401invalid_api_keyA key was sent but is not valid. Leave it out to use the anonymous limits.
403origin_not_allowedThe key may not be used from that website.
413 / 415payload_too_large / unsupported_media_typeBody over 16 KB, or not sent as JSON.
422unknown_tax_class / unsupported_currency / fx_unavailableWell formed but cannot be priced.
429rate_limitedSlow down; see the Retry-After header.
503rates_unavailableRates are temporarily unavailable. Try again shortly.

Limits and keys

Without a key you get 30 requests a minute and 500 a day for each IP address. Every answer carries RateLimit-Limit, RateLimit-Remaining and RateLimit-Reset headers.

A site that needs more can ask for a free API key. Send it as X-API-Key or Authorization: Bearer. Keep it on your server: anyone who sees it can use your quota.

Good practice

  • Show the rateVersion, the disclaimer and a link back to the calculator next to the numbers. They are estimates: Sri Lanka Customs assesses the final duty.
  • Do not copy rates into your own code. Ask the API each time: the gazettes change them.
  • Cache categories and tax-classes for a few minutes, not calculations: they depend on the live exchange rate.
  • Send a descriptive User-Agent, so we can tell your site from the rest and help you if something breaks.
Calculate

This site uses two anonymous cookies, a visitor ID and a session ID, so that it can work and count visits. There is no advertising or third-party tracking. Privacy policy