Zügle Tax API

Swiss income-tax lookups and municipality tax detail, backed by the undocumented ESTV calculator.

GitHub OpenAPI
Pull this API's OpenAPI, operations, scores and pricing into your own code or AI agent with a free APIs.io key — sign in with GitHub, Google or LinkedIn. No form to fill in; signing in shares your email address with us (Privacy).

Operations 2

GET /api/tax Swiss income tax for one municipality/income/demographic combination #
GET /api/municipality-detail Full tax breakdown + multi-year trend for one municipality #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/zuegle-com:zuegle-com-tax-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

zuegle-com-tax-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Zügle Tax API
  version: 1.0.0
  description: 'Zügle is a Swiss "does it pay off to move?" app. Paste a Flatfox/Homegate listing

    link (or enter costs manually) to compare a candidate apartment against a current

    home: monthly living costs, the Swiss income-tax delta between municipalities

    (federal/cantonal/Gemeinde), commute time and cost, and a quality-of-living score.


    The app has **guest mode**: several routes are reachable with no session cookie at

    all. A guest supplies their own income/relationship/confession/children/current-home

    figures on the request itself (query params or, for ingest, a `profile` body object)

    and gets a computed result back — nothing about a guest request is ever persisted

    server-side. The same routes behave differently for an authenticated household

    member: caller-supplied profile values are ignored and the stored profile

    (`p1`/`p2`) is used instead. Guest traffic is additionally throttled by a set of

    in-memory, per-IP rate-limit buckets described on each public operation; an

    authenticated caller using their own app is never subject to those buckets.'
  contact:
    name: Zügle
servers:
- url: http://localhost:8090
  description: Local dev (npm run dev) or local prod (npm run prod) — both serve on :8090
- url: https://zuegle.com
  description: 'Public production deployment. The VPS holds no open ports: a Cloudflare Tunnel (cloudflared) fronts localhost:8090, so TLS terminates at Cloudflare and the app runs with TRUST_PROXY_HOPS=1 / FORCE_HTTPS=1. Auto-deployed from the main branch.'
- url: https://zugle-vps.barbel-char.ts.net
  description: The same VPS over the Tailscale tailnet — admin/debug access that does not depend on Cloudflare. Tailscale Funnel is OFF here; a tailnet member reaches this, the public internet does not.
security:
- cookieAuth: []
tags:
- name: Tax
  description: Swiss income-tax lookups and municipality tax detail, backed by the undocumented ESTV calculator.
paths:
  /api/tax:
    get:
      operationId: getTax
      summary: Swiss income tax for one municipality/income/demographic combination
      description: 'PUBLIC (guest mode). It performs no profile lookup and reads nothing about an account — every figure comes from the caller''s own numbers and published tax law, the same contract /api/municipality-detail has always had while public. Made public for the MCP gateway (server/mcp/), which carries no credential. Backed by the undocumented ESTV calculator (server/sources/estv.js) and cached forever per (year, bfsId, income, relationship, confession, children). Guest rate limit: the shared public-compute bucket (60 / 5 min) plus 30 / 5 min on this route — a cache HIT is cheap, a MISS is a live ESTV call. Authed callers are not throttled.'
      tags:
      - Tax
      parameters:
      - name: bfsId
        in: query
        required: true
        schema:
          type: integer
        example: 198
      - name: income
        in: query
        required: true
        description: Gross annual income, CHF.
        schema:
          type: number
        example: 100000
      - name: year
        in: query
        required: false
        description: Defaults to data/settings.json's taxYear. If given, must be between 2020 (EARLIEST_YEAR) and that same taxYear — never above it, since ESTV silently echoes an older year's figures for a year it hasn't published yet.
        schema:
          type: integer
        example: 2026
      - name: relationship
        in: query
        required: false
        schema:
          type: string
          enum:
          - single
          - married
          - concubinage
          - registered_partnership
          default: single
      - name: confession
        in: query
        required: false
        schema:
          type: string
          enum:
          - reformed
          - roman_catholic
          - christ_catholic
          - none
          - other
          default: none
      - name: children
        in: query
        required: false
        schema:
          type: integer
          default: 0
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TaxResult'
        '400':
          description: Missing bfsId/income, an unrecognized confession value, or a year outside the supported range (2020 through this installation's configured taxYear).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: bfsId is required
        '401':
          $ref: '#/components/responses/SessionExpired'
        '404':
          description: Unknown bfsId — not a municipality this app knows about.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: Unknown bfsId 9999
        '429':
          $ref: '#/components/responses/RateLimited'
        '502':
          description: ESTV's undocumented calculator failed or answered with a non-OK status. The body carries OUR OWN message, never ESTV's raw operation name/status — that internal detail is deliberately never forwarded on a public route.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /api/municipality-detail:
    get:
      operationId: getMunicipalityDetail
      summary: Full tax breakdown + multi-year trend for one municipality
      description: 'Public (guest mode supported). Same session-vs-guest profile split as favorable-municipalities. Fetches the current tax year plus up to 7 years of history (concurrency-limited against ESTV), so unlike favorable-municipalities this CAN make live ESTV calls and is not instant. Rate limit (guest only): general bucket 60/5min + municipality-detail bucket 30/hour per IP.'
      tags:
      - Tax
      security: []
      parameters:
      - name: bfsId
        in: query
        required: true
        schema:
          type: integer
        example: 154
      - name: year
        in: query
        required: false
        description: Defaults to data/settings.json's taxYear. If given, must be between 2020 (EARLIEST_YEAR) and that same taxYear — never a future/unpublished year, the same bound /api/tax enforces.
        schema:
          type: integer
        example: 2026
      - name: years
        in: query
        required: false
        description: Size of the trend window, clamped to 1-7.
        schema:
          type: integer
          default: 5
      - $ref: '#/components/parameters/GuestIncome'
      - $ref: '#/components/parameters/GuestRelationship'
      - $ref: '#/components/parameters/GuestConfession'
      - $ref: '#/components/parameters/GuestChildren'
      - $ref: '#/components/parameters/GuestCurrentBfsId'
      - $ref: '#/components/parameters/GuestCurrentLabel'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MunicipalityDetail'
        '400':
          description: Missing bfsId, currentHome.bfsId missing, incomeAnnual missing/zero (a missing income used to silently default to a CHF 0 household rather than erroring), or a year outside the supported range.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Unknown bfsId.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: Unknown bfsId 999999
        '429':
          $ref: '#/components/responses/RateLimited'
        '502':
          description: ESTV upstream failure and no cached data available for the requested year.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    TaxRates:
      type: object
      description: Steuerfuss (multiplier), as % of the "simple"/einfache tax — the number a Gemeinde actually votes on. Absent on legacy v1 cache entries.
      properties:
        canton:
          type:
          - number
          - 'null'
        city:
          type:
          - number
          - 'null'
        protestant:
          type:
          - number
          - 'null'
        roman:
          type:
          - number
          - 'null'
    MunicipalityDetailErrorEntry:
      type: object
      properties:
        year:
          type: integer
        bfsId:
          type: integer
        error:
          type: string
    TaxResult:
      type: object
      description: Result of server/sources/estv.js getTax(), cached forever per (year, bfsId, income, relationship, confession, children). v1 cache entries (pre-dating the detailed breakdown) carry only the fields marked required below; v2 entries (current) additionally carry rates/income/simpleTax*/taxableIncome*.
      required:
      - total
      - federal
      - cantonal
      - municipal
      - church
      - personal
      - year
      - cached
      properties:
        total:
          type: number
          description: Total tax
          CHF/year.: null
        federal:
          type: number
        cantonal:
          type: number
        municipal:
          type: number
        church:
          type: number
        personal:
          type: number
        simpleTaxFed:
          type: number
          description: '"Einfache Steuer" before the federal multiplier.'
        simpleTaxCanton:
          type: number
        simpleTaxCity:
          type: number
        taxableIncomeFed:
          type: number
        taxableIncomeCanton:
          type: number
        marginalTaxRate:
          type:
          - number
          - 'null'
        rates:
          $ref: '#/components/schemas/TaxRates'
        income:
          $ref: '#/components/schemas/TaxIncomeBreakdown'
        year:
          type: integer
        v:
          type: integer
          description: Cache schema version (1 or 2). Absent on the oldest entries
          treated as 1.: null
        cached:
          type: boolean
          description: True when served from the tax cache rather than freshly computed.
      example:
        total: 11517
        federal: 1701
        cantonal: 4494
        municipal: 5298
        church: 0
        personal: 24
        simpleTaxFed: 1701
        simpleTaxCanton: 4730
        simpleTaxCity: 4730
        taxableIncomeFed: 85173
        taxableIncomeCanton: 84073
        marginalTaxRate: 25.1
        rates:
          canton: 95
          city: 112
          protestant: 11
          roman: 10
        income:
          gross: 100000
          net: 89662
          ahv: 5300
          alv: 1100
          nbu: 400
          bvg: 3538
        year: 2026
        v: 2
        cached: true
    MunicipalityDetail:
      type: object
      required:
      - year
      - years
      - municipality
      - current
      - tax
      - shares
      - effective
      - history
      - errors
      properties:
        year:
          type: integer
        years:
          type: integer
          description: How many years of history were requested/returned.
        municipality:
          type: object
          properties:
            bfsId:
              type: integer
            name:
              type: string
            canton:
              type: string
            zips:
              type: array
              items:
                type: string
        current:
          type: object
          properties:
            bfsId:
              type: integer
            name:
              type:
              - string
              - 'null'
            total:
              type:
              - number
              - 'null'
        tax:
          $ref: '#/components/schemas/TaxResult'
        delta:
          type:
          - number
          - 'null'
          description: This municipality's tax total minus the current home's
          for `year`.: null
        shares:
          type: object
          description: Each component as a fraction of tax.total for `year`.
          properties:
            federal:
              type: number
            cantonal:
              type: number
            municipal:
              type: number
            church:
              type: number
            personal:
              type: number
        effective:
          type: object
          properties:
            onGross:
              type: number
              description: tax.total / gross income.
            onTaxable:
              type: number
              description: tax.total / taxableIncomeCanton.
        history:
          type: array
          items:
            $ref: '#/components/schemas/MunicipalityDetailHistoryEntry'
        errors:
          type: array
          items:
            $ref: '#/components/schemas/MunicipalityDetailErrorEntry'
    MunicipalityDetailHistoryEntry:
      type: object
      properties:
        year:
          type: integer
        total:
          type: number
        currentTotal:
          type: number
        delta:
          type: number
          description: total − currentTotal for that year.
        pctOfGross:
          type: number
          description: total as a fraction of incomeAnnual.
        rates:
          $ref: '#/components/schemas/TaxRates'
    Error:
      type: object
      description: 'The base shape of every error response in this API: `{ error: <message>, ...extra }`, produced by throwing `ApiError(status, message, extra)` in server/app.js (caught centrally by handleRouteError) or, for unmatched routes, written directly by the dispatcher.'
      required:
      - error
      properties:
        error:
          type: string
      additionalProperties: true
    SessionExpiredError:
      allOf:
      - $ref: '#/components/schemas/Error'
      - type: object
        required:
        - code
        properties:
          code:
            type: string
            enum:
            - SESSION_EXPIRED
    TaxIncomeBreakdown:
      type: object
      description: The deductions ESTV applied to get from gross salary to net/taxable income. Absent on legacy v1 cache entries.
      properties:
        gross:
          type: number
        net:
          type: number
        ahv:
          type: number
        alv:
          type: number
        nbu:
          type: number
        bvg:
          type: number
    RateLimitError:
      description: A 429 from any of the guest-mode rate-limit buckets, or the login brute-force limiter.
      allOf:
      - $ref: '#/components/schemas/Error'
      - type: object
        required:
        - retryAfterSec
        properties:
          retryAfterSec:
            type: integer
            description: Also sent as the Retry-After response header.
  parameters:
    GuestConfession:
      name: confession
      in: query
      required: false
      description: Guest mode only. Ignored entirely when a session is present.
      schema:
        type: string
        enum:
        - reformed
        - roman_catholic
        - christ_catholic
        - none
        - other
        default: none
    GuestIncome:
      name: income
      in: query
      required: false
      description: Guest mode only — gross annual income, CHF. Ignored entirely when a session is present.
      schema:
        type: number
      example: 100000
    GuestChildren:
      name: children
      in: query
      required: false
      description: Guest mode only. Ignored entirely when a session is present.
      schema:
        type: integer
        default: 0
    GuestCurrentLabel:
      name: currentLabel
      in: query
      required: false
      description: Guest mode only — display label for the guest's current home. Ignored entirely when a session is present.
      schema:
        type: string
      example: Uster ZH
    GuestCurrentBfsId:
      name: currentBfsId
      in: query
      required: false
      description: Guest mode only — the BFS id of the guest's own current-home municipality. Required for a guest caller (400 without it); ignored entirely when a session is present, where the stored profile's currentHome.bfsId is used instead.
      schema:
        type: integer
      example: 198
    GuestRelationship:
      name: relationship
      in: query
      required: false
      description: Guest mode only. Ignored entirely when a session is present.
      schema:
        type: string
        enum:
        - single
        - married
        - concubinage
        - registered_partnership
        default: single
  responses:
    RateLimited:
      description: Guest-mode rate limit exceeded for this route's bucket (or the shared general bucket).
      headers:
        Retry-After:
          schema:
            type: integer
          description: Seconds until the oldest request in the window ages out.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/RateLimitError'
          example:
            error: Too many requests
            retryAfterSec: 137
    SessionExpired:
      description: No valid session cookie. This is the ONE error shape in the whole API that bypasses the standard ApiError → handleRouteError path (it's written directly by auth.js's authGate middleware before the route dispatcher runs), which is why it alone carries a `code` field.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/SessionExpiredError'
          example:
            error: Unauthorized — please log in
            code: SESSION_EXPIRED
  securitySchemes:
    cookieAuth:
      type: apiKey
      in: cookie
      name: zugle_session
      description: 64-hex-character session token set as an HttpOnly, SameSite=Strict cookie by POST /api/auth/login. Routes NOT in the guest-mode public set return 401 with code SESSION_EXPIRED when it is missing or invalid.