On this page
DocumentationAPI

API overview

Use the HTTP API when the calculation should run on a server, the caller uses another language or you need an OpenAPI contract. A browser can also use the SDK's browser-safe entrypoints to calculate on the device. Compare the choices in Choose SDK or HTTP API.

Use HTTP when

Runtime model

The API does not own tax logic. It decodes transport input, calls the same calculator service as an in-process SDK consumer, then returns the service result or an HTTP error envelope.

TypeScript
HTTP calculate

HTTP caller
  -> @taxkit/api-http route contract
    -> CalculatorApiHandlerLive
      -> PublicCalculatorService.calculate
        -> owning calculator definition
      -> CalculatorApiErrorEnvelope for expected service errors

The calculate route calls PublicCalculatorService.calculate directly. The service validates facts against the selected calculator, so a payload accepted by the generic HTTP schema can fail if it is for a different calculator.

Request model

Calculation requests use CalculatorRunRequest:

JSON
{
  "calculatorId": "au.pay.take-home",
  "payload": {
    "facts": {
      "grossPay": {
        "_tag": "Money",
        "cents": 346200,
        "currency": "AUD"
      },
      "taxFreeThresholdClaimed": true,
      "period": "fortnightly"
    },
    "jurisdiction": "AU",
    "taxYear": "2025-26"
  }
}

Use canonical tagged values such as GrossPay and Money where the owning schema requires them. The generated OpenAPI document shows supported facts.anyOf shapes for the current public calculators.