{"openapi":"3.1.0","info":{"title":"AutoImports API: Sri Lanka vehicle import tax","version":"1.0.0","summary":"Calculate Sri Lanka vehicle import duty, excise, VAT and landed cost from the gazette rates.","description":"Free and open. No key is needed; anonymous callers are limited per IP address (30 requests a minute, 500 a day).\n\nA free API key raises the limits: send it as `X-API-Key` or `Authorization: Bearer`.\n\nEvery answer carries `rateVersion` (the published gazette rates it used), the legal sources, and a disclaimer: results are estimates, and Sri Lanka Customs assesses the final duty.\n\nWithin v1 the response only grows: fields are added, never removed or renamed.\n\nFor assistants that can only fetch a link, `GET /api/v1/quote` returns the same answer by URL (add `format=md` for Markdown). An MCP server is at https://autoimports.webgen.live/mcp.","license":{"name":"Free to use; please link back to the calculator"}},"servers":[{"url":"https://autoimports.webgen.live"}],"security":[{},{"ApiKeyHeader":[]},{"BearerAuth":[]}],"paths":{"/api/v1/calculate":{"post":{"operationId":"calculateImportTax","summary":"Calculate the import tax on a vehicle","description":"Send the tax class (see /api/v1/tax-classes), the CIF value with its currency, and the measurement the class needs (engine cc, motor kW, seats, payload or GVW) plus the vehicle's age where the class uses it. Use `mode: \"cab\"` for the receipt-based cab method (no tax class).","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CalculationRequest"},"examples":{"hybridHatchbackFromJapan":{"summary":"1.5 L petrol hybrid, 1 year old, CIF JPY 1,500,000","value":{"mode":"class","taxClassKey":"hybrid_petrol","cif":{"amount":1500000,"currency":"JPY"},"measure":1500,"vehicleAge":1}},"electricWithLkrCif":{"summary":"Electric car, CIF already in rupees, own exchange rate","value":{"mode":"class","taxClassKey":"electric","cif":{"amount":3500000,"currency":"LKR"},"measure":100,"vehicleAge":0,"locale":"si"}}}}}},"responses":{"200":{"description":"The calculation","headers":{"RateLimit-Limit":{"description":"Requests allowed per minute","schema":{"type":"integer"}},"RateLimit-Remaining":{"description":"Requests left in this minute","schema":{"type":"integer"}},"RateLimit-Reset":{"description":"Seconds until the minute window resets","schema":{"type":"integer"}},"X-Rate-Version":{"description":"Version of the gazette rates that priced the answer","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CalculationResult"}}}},"400":{"description":"A field is missing or invalid. `error.issues` lists each one with a stable code.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The API key is not valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"This API key may not be used from that website.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"The request body is too large (16 KB at most).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"415":{"description":"Send JSON with Content-Type: application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"The request is well formed but cannot be priced: unknown tax class or currency, or no exchange rate.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many requests. See the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Rates or exchange rates are temporarily unavailable. Try again shortly.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/quote":{"get":{"operationId":"quoteImportTax","summary":"Calculate by URL","description":"The same calculation as POST /api/v1/calculate, with everything in the query string. Made for assistants and tools that can only fetch a link. `format=md` (or `Accept: text/markdown`) returns readable Markdown.","parameters":[{"name":"class","in":"query","description":"Tax class key, e.g. petrol, hybrid_petrol, electric","schema":{"type":"string"}},{"name":"mode","in":"query","description":"`cab` for the receipt-based cab method (no class)","schema":{"type":"string","enum":["class","cab"]}},{"name":"cc","in":"query","description":"Measurement for classes measured in cc. Send exactly one of cc, kw, seats, payload, gvw.","schema":{"type":"number"}},{"name":"kw","in":"query","description":"Measurement for classes measured in kw. Send exactly one of cc, kw, seats, payload, gvw.","schema":{"type":"number"}},{"name":"seats","in":"query","description":"Measurement for classes measured in seats. Send exactly one of cc, kw, seats, payload, gvw.","schema":{"type":"number"}},{"name":"payload","in":"query","description":"Measurement for classes measured in payload. Send exactly one of cc, kw, seats, payload, gvw.","schema":{"type":"number"}},{"name":"gvw","in":"query","description":"Measurement for classes measured in gvw. Send exactly one of cc, kw, seats, payload, gvw.","schema":{"type":"number"}},{"name":"age","in":"query","description":"Vehicle age in years, where the class uses it","schema":{"type":"number"}},{"name":"cif","in":"query","description":"CIF value: cost + insurance + freight to Colombo","schema":{"type":"number"}},{"name":"currency","in":"query","description":"ISO 4217 code of the CIF value, e.g. JPY, USD, LKR","schema":{"type":"string"}},{"name":"fx","in":"query","description":"Your own LKR per 1 unit of the currency (otherwise the live rate is used)","schema":{"type":"number"}},{"name":"make","in":"query","description":"Vehicle make (echoed back)","schema":{"type":"string"}},{"name":"model","in":"query","description":"Vehicle model (echoed back)","schema":{"type":"string"}},{"name":"year","in":"query","description":"Vehicle year (echoed back)","schema":{"type":"integer"}},{"name":"locale","in":"query","description":"Language of labels in the answer","schema":{"type":"string","enum":["en","si","ta"],"default":"en"}},{"name":"format","in":"query","description":"`md` for Markdown","schema":{"type":"string","enum":["json","md"]}},{"name":"include","in":"query","description":"`breakdown` adds the full engine breakdown","schema":{"type":"string","enum":["breakdown"]}}],"responses":{"200":{"description":"The calculation","headers":{"RateLimit-Limit":{"description":"Requests allowed per minute","schema":{"type":"integer"}},"RateLimit-Remaining":{"description":"Requests left in this minute","schema":{"type":"integer"}},"RateLimit-Reset":{"description":"Seconds until the minute window resets","schema":{"type":"integer"}},"X-Rate-Version":{"description":"Version of the gazette rates that priced the answer","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CalculationResult"}},"text/markdown":{"schema":{"type":"string"}}}},"400":{"description":"A field is missing or invalid. `error.issues` lists each one with a stable code.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The API key is not valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"This API key may not be used from that website.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"The request is well formed but cannot be priced: unknown tax class or currency, or no exchange rate.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many requests. See the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Rates or exchange rates are temporarily unavailable. Try again shortly.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/categories":{"get":{"operationId":"listVehicleCategories","summary":"Vehicle categories","parameters":[{"name":"locale","in":"query","description":"Language of labels in the answer","schema":{"type":"string","enum":["en","si","ta"],"default":"en"}}],"responses":{"200":{"description":"Categories (cars, vans, trucks, buses, cabs...)","content":{"application/json":{"schema":{"type":"object","required":["rateVersion","categories"],"properties":{"rateVersion":{"type":"integer"},"categories":{"type":"array","items":{"$ref":"#/components/schemas/Category"}}}}}}},"429":{"description":"Too many requests. See the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Rates or exchange rates are temporarily unavailable. Try again shortly.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/tax-classes":{"get":{"operationId":"listTaxClasses","summary":"Tax classes","description":"The classes a vehicle is priced under (petrol, diesel, hybrid, electric, vans, trucks...), with the measurement each one needs.","parameters":[{"name":"category","in":"query","description":"Only the classes of this category key","schema":{"type":"string"}},{"name":"locale","in":"query","description":"Language of labels in the answer","schema":{"type":"string","enum":["en","si","ta"],"default":"en"}}],"responses":{"200":{"description":"Tax classes","content":{"application/json":{"schema":{"type":"object","required":["rateVersion","taxClasses"],"properties":{"rateVersion":{"type":"integer"},"taxClasses":{"type":"array","items":{"$ref":"#/components/schemas/TaxClass"}}}}}}},"429":{"description":"Too many requests. See the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Rates or exchange rates are temporarily unavailable. Try again shortly.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/rates":{"get":{"operationId":"getRatesSummary","summary":"Which rates are live, and their legal sources","responses":{"200":{"description":"Rate version, currencies, cab rates and sources","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RatesSummary"}}}},"429":{"description":"Too many requests. See the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Rates or exchange rates are temporarily unavailable. Try again shortly.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/rates/{taxClass}":{"get":{"operationId":"getTaxClassRates","summary":"Every excise and age band of one tax class","parameters":[{"name":"taxClass","in":"path","required":true,"schema":{"type":"string"}},{"name":"locale","in":"query","description":"Language of labels in the answer","schema":{"type":"string","enum":["en","si","ta"],"default":"en"}}],"responses":{"200":{"description":"The class and its band tables","content":{"application/json":{"schema":{"type":"object","required":["rateVersion","taxClass","applicable"],"properties":{"rateVersion":{"type":"integer"},"taxClass":{"$ref":"#/components/schemas/TaxClass"},"applicable":{"type":"object","additionalProperties":true}}}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many requests. See the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Rates or exchange rates are temporarily unavailable. Try again shortly.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/fx":{"get":{"operationId":"getExchangeRate","summary":"LKR exchange rate for a currency","parameters":[{"name":"currency","in":"query","description":"ISO 4217 code, e.g. JPY","schema":{"type":"string"}}],"responses":{"200":{"description":"The rate and where it came from","content":{"application/json":{"schema":{"type":"object","required":["currency","rate","source","date","isLive"],"properties":{"currency":{"type":"string"},"rate":{"type":"number","description":"LKR per 1 unit"},"source":{"type":"string"},"date":{"type":["string","null"]},"isLive":{"type":"boolean"}}}}}},"400":{"description":"A field is missing or invalid. `error.issues` lists each one with a stable code.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many requests. See the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Rates or exchange rates are temporarily unavailable. Try again shortly.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"components":{"securitySchemes":{"ApiKeyHeader":{"type":"apiKey","in":"header","name":"X-API-Key","description":"Optional free key for higher limits"},"BearerAuth":{"type":"http","scheme":"bearer","description":"The same key as a Bearer token"}},"schemas":{"CalculationRequest":{"type":"object","properties":{"mode":{"type":"string","enum":["class","cab"]},"taxClassKey":{"type":"string","minLength":1,"maxLength":80,"pattern":"^[a-z0-9_]+$"},"cif":{"type":"object","properties":{"amount":{"type":"number","exclusiveMinimum":0,"maximum":1000000000000},"currency":{"type":"string","pattern":"^[A-Z]{3}$"},"fxRate":{"type":"number","exclusiveMinimum":0,"maximum":10000000},"fxManual":{"type":"boolean"}},"required":["amount","currency"]},"measure":{"type":"number","minimum":0,"maximum":10000000},"vehicleAge":{"type":"number","minimum":0,"maximum":50},"additional":{"maxItems":3,"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["handling","clearing","other"]},"amount":{"type":"number","minimum":0,"maximum":1000000000000},"currency":{"type":"string","pattern":"^[A-Z]{3}$"},"fxRate":{"type":"number","exclusiveMinimum":0,"maximum":10000000},"fxManual":{"type":"boolean"}},"required":["type","amount","currency"]}},"vehicle":{"type":"object","properties":{"make":{"type":"string","maxLength":60},"model":{"type":"string","maxLength":60},"year":{"type":"integer","minimum":1900,"maximum":2027}}},"locale":{"default":"en","type":"string","enum":["en","si","ta"]},"include":{"type":"array","items":{"enum":["breakdown","applicable"]},"description":"Extra detail to return: `breakdown` is the full engine breakdown, `applicable` every band of the tax class."}},"required":["mode","cif"]},"CalculationResult":{"type":"object","properties":{"calcId":{"type":"string","description":"Reference for this calculation"},"rateVersion":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Version of the published gazette rates that priced it"},"ratesPublishedAt":{"description":"When that rate version was published (ISO 8601)","type":["string","null"]},"currency":{"type":"string","const":"LKR"},"vehicle":{"type":"object","properties":{"category":{"type":"object","properties":{"key":{"type":["string","null"]},"label":{"type":"string"}},"required":["key","label"],"additionalProperties":false},"taxClass":{"type":"object","properties":{"key":{"type":["string","null"]},"label":{"type":"string"},"hsCode":{"type":["string","null"]}},"required":["key","label","hsCode"],"additionalProperties":false},"measure":{"type":"object","properties":{"value":{"type":"number"},"unit":{"description":"One of cc, kw, seats or kg, depending on the tax class","type":["string","null"]}},"required":["value","unit"],"additionalProperties":false},"ageYears":{"type":"number"}},"required":["category","taxClass","measure","ageYears"],"additionalProperties":false},"cif":{"type":"object","properties":{"amount":{"type":"number","description":"The CIF value as entered"},"currency":{"type":"string","description":"ISO 4217 code of the CIF value as entered"}},"required":["amount","currency"],"additionalProperties":false},"fx":{"type":"object","properties":{"rate":{"type":"number","description":"LKR per 1 unit of the CIF currency"},"source":{"type":"string"},"date":{"type":["string","null"]},"manual":{"type":"boolean","description":"true when the caller supplied the exchange rate"}},"required":["rate","source","date","manual"],"additionalProperties":false},"cifLkr":{"type":"number","description":"Amount in Sri Lankan rupees (LKR), whole rupees"},"taxes":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","enum":["cid","surcharge","excise","luxury","pal","sscl","vat","vel","other"]},"label":{"type":"string"},"amount":{"type":"number","description":"Amount in Sri Lankan rupees (LKR), whole rupees"},"basis":{"type":"string","description":"The rate or rule applied, as a short text"}},"required":["code","label","amount","basis"],"additionalProperties":false},"description":"Every charge in the order Sri Lanka Customs applies it"},"totalTax":{"type":"number","description":"Total taxes and duties in LKR"},"additionalTotal":{"type":"number","description":"Handling, clearing and other charges the caller added, in LKR"},"totalCost":{"type":"number","description":"CIF + taxes + additional charges, in LKR"},"effectiveRate":{"type":"number","description":"Taxes as a percentage of the CIF value"},"licenceRequired":{"type":"boolean"},"calculatorUrl":{"type":"string","description":"Link to this calculation type in the website's calculator"},"sources":{"type":"array","items":{"type":"object","properties":{"charge":{"type":"string"},"references":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"date":{"type":["string","null"]},"url":{"type":["string","null"]}},"required":["label","date","url"],"additionalProperties":false}},"inForceFrom":{"type":["string","null"]},"inForceUntil":{"type":["string","null"]}},"required":["charge","references","inForceFrom","inForceUntil"],"additionalProperties":false}},"sourcesCheckedOn":{"type":"string"},"disclaimer":{"type":"string"},"breakdown":{"description":"Full engine breakdown (include=breakdown)"},"applicable":{"description":"Every band of the tax class (include=applicable)"}},"required":["calcId","rateVersion","ratesPublishedAt","currency","vehicle","cif","fx","cifLkr","taxes","totalTax","additionalTotal","totalCost","effectiveRate","licenceRequired","calculatorUrl","sources","sourcesCheckedOn","disclaimer"],"additionalProperties":false},"Category":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"calcMode":{"type":"string","enum":["class","cab"],"description":"'cab' categories are calculated with mode=cab and no taxClassKey"},"taxClassCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["key","label","calcMode","taxClassCount"],"additionalProperties":false},"TaxClass":{"type":"object","properties":{"key":{"type":"string","description":"Send this as taxClassKey"},"label":{"type":"string"},"category":{"type":"object","properties":{"key":{"type":["string","null"]},"label":{"type":"string"}},"required":["key","label"],"additionalProperties":false},"hsCode":{"type":["string","null"]},"measure":{"anyOf":[{"type":"object","properties":{"param":{"type":"string","enum":["cc","kw","seats","payload","gvw"]},"unit":{"type":["string","null"]},"label":{"type":["string","null"]}},"required":["param","unit","label"],"additionalProperties":false},{"type":"null"}],"description":"What to send as `measure` (null: this class needs none)"},"needsAge":{"type":"boolean","description":"true when the vehicle's age changes the tax; send vehicleAge"},"ageBrackets":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"minYears":{"type":"number"},"maxYears":{"type":["number","null"]}},"required":["label","minYears","maxYears"],"additionalProperties":false}},"baseRates":{"type":"object","properties":{"customsDuty":{"type":"number","description":"Fraction of CIF, e.g. 0.3 = 30%"},"surcharge":{"type":"number","description":"Fraction of the customs duty"},"pal":{"type":"number"},"sscl":{"type":"number"},"vat":{"type":"number"},"vel":{"type":"number","description":"Fixed amount in LKR"},"luxuryTax":{"type":"boolean"}},"required":["customsDuty","surcharge","pal","sscl","vat","vel","luxuryTax"],"additionalProperties":false,"description":"The class's own rates. Excise comes from the band tables (see /rates/{taxClass})."}},"required":["key","label","category","hsCode","measure","needsAge","ageBrackets","baseRates"],"additionalProperties":false},"RatesSummary":{"type":"object","properties":{"rateVersion":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"publishedAt":{"type":["string","null"]},"sourcesCheckedOn":{"type":"string"},"currencies":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"label":{"type":"string"},"fallbackRate":{"type":"number"}},"required":["code","label","fallbackRate"],"additionalProperties":false}},"cab":{"type":"object","properties":{"customsDuty":{"type":"number"},"surcharge":{"type":"number"},"excise":{"type":"number","description":"Fixed LKR amount"},"vel":{"type":"number"}},"required":["customsDuty","surcharge","excise","vel"],"additionalProperties":false},"sources":{"type":"array","items":{}}},"required":["rateVersion","publishedAt","sourcesCheckedOn","currencies","cab","sources"],"additionalProperties":false},"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","description":"Stable machine-readable code"},"message":{"type":"string"},"issues":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"code":{"type":"string"}}}}}}}}}}}