POST /CapitalGain

Returns the tax calculation for Capital gain. Returns a string describing the failure condition when unsuccessful.

Sending an empty request will return an HTTP 415 error (Unsupported Media Type). Failure to provide any of the required parameters will result in an HTTP 400 error (Bad Request).

Resource URL

https://api.drtax.ch/TaxCalculator/CapitalGain

Resource Information

  • Response formats

    JSON

  • Requires authentication?

    Yes (HMAC-SHA256 based authentication)

  • Rate limited?

    Yes

Parameters

  • key Required

    API key which was given to you after registering for access to the Tax calculator API.

  • language Optional

    Language in which descriptions of tax calculation are returned. If not provided, the default language is set to English.Example Values: de, fr, it, en

  • basic-data Required

    Contains company basic data for a tax calculation. Either both canton and municipality-of-taxation, or either from zip and domicile must be provided in order for a request to succeed.

    • disbursement-yearOptional

      Disbursement year for which the request is issued. If not provided, a year preeceding the current calendar year will be used.Example Value: 2014

    • canton Semi-optional

      Canton of Switzerland to which a taxable person's domicile belongs to. This value corresponds to an index in a list returned by the /CantonList service.Example Values: 0-25

    • municipality-of-taxation Semi-optional

      Municipality of taxation.Example Value: Zug

    • zipOptional

      Postal code of the taxable person's residence.Example Value: 6984

    • domicileOptional

      Place of the taxable person's residence.Example Value: Pura

    • taxable-personOptional

      Taxable person.Example Value: Peter Müller

    • marital-statusRequired

      Marital status of the taxable person. This value corresponds to an index in a list returned by the /MaritalStatusList service.Example Values: 0-8

    • childrenOptional

      How many children does the taxable person have. Value can be integer or non-integer. If not provided, the default value is 0. Example Value: 1.5

    • concubinageOptional

      If relationship with partner involve concubinage then value should be set to 'true'. By default value is assumed to be false. This is important parameter for the Canton VD.

    • religious-affiliationSemi-optional

      Taxable person's religious affiliation, if taxable person has any. This value corresponds to an index in a list returned by the /ReligiousAffiliationList service.Example Values: 0-4

    • partner-religious-affiliationSemi-optional

      If taxable person has a partner, this parameter represents the taxable person partner's religious affiliation, if partner has any. This value corresponds to an index in a list returned by the /ReligiousAffiliationList service.Example Values: 0-4

    • church-communitySemi-optional

      If taxable person's domicile belongs to canton Appenzell Innerrhoden, this parameter represents the taxable person's church community, and it has to be one of the values in the list returned by the /ChurchCommunityList service.Example Value: Prot. Wald

    • partner-church-communitySemi-optional

      If taxable person has a partner, and taxable person's domicile belongs to canton Appenzell Innerrhoden, this parameter represents the taxable person's partner church community, and it has to be one of the values in the list returned by the /ChurchCommunityList service.Example Value: Kath. Schwende

    • date-of-birthOptional

      Date of birth of the taxable person. This value has to be in the following format: YYYY-MM-DD.Example Value: 1984-08-15

    • partner-date-of-birthOptional

      If taxable person has a partner, this value represents the date of birth of the taxable person's partner. This value has to be in the following format: YYYY-MM-DD.Example Value: 1992-04-01

    • genderOptional

      The taxable person's gender.Example Values: 0 for masculine, 1 for feminine

    • partner-genderOptional

      If taxable person has a partner, this value represents the taxable person partner's gender.Example Values: 0 for masculine, 1 for feminine

  • fiscal-factors Required

    Contains fiscal factors for the tax calculation.

    • occupational-pensions-2nd-pillarRequired

      Occupational pensions (2nd pillar).Example Value: 327893.32

    • bound-voluntary-insurance-pillar-3aRequired

      Bound voluntary insurance (Pillar 3a).Example Value: 758473.13

    • partnerOptional

      If taxable person has a partner, this parameter contains the taxable person partner's fiscal factors.

      • occupational-pensions-2nd-pillarSemi-optional

        Occupational pensions (2nd pillar).Example Value: 361426.66

      • bound-voluntary-insurance-pillar-3aSemi-optional

        Bound voluntary insurance (Pillar 3a).Example Value: 78463.34

Authentication

Tax Calculator API uses Hash-based message authentication code (HMAC-SHA256) to authenticate your request.

Each request to Tax Calculator API must contain:

  • API Key - used to identify your account,
  • HMAC-SHA256 signature inserted in 'X-Signature' HTTP header - used to verify your request.

To create an HMAC-SHA256 signature you perform hashing of your request with API Secret as the hashing key.

In-detail information on what API Key and API Secret are, where to find them, and how to create a request signature and put it in the request can be found here.

If either of API Key or HMAC-SHA256 signature is not present in the request, the request will be rejected.

Example Request

POST
https://api.drtax.ch/TaxCalculator/CapitalGain

{
  "basic-data": {
    "canton": 25,
    "gender": 1,
    "children": 1,
    "date-of-birth": "1972-03-03",
    "municipality-of-taxation": "Zürich",
    "religious-affiliation": 3,
    "marital-status": 3,
    "taxable-person": "Nadine Schneider",
    "disbursement-year": 2014
  },
  "fiscal-factors": {
    "bound-voluntary-insurance-pillar-3a": 135135,
    "occupational-pensions-2nd-pillar": 1365155115
  },
  "language": "de",
  "key": "55c35523dc19e8.64742828"
}

Example Result

{
  "data": {
    "id": "cff48cc5-7c13-495a-a139-344fce047359",
    "request-date-time": "2016-01-21T12:48:52.585+0100",
    "attributes": {
      "total-federal-tax": {
        "total": 409211,
        "description": "Total direkte Bundessteuer"
      },
      "church": {
        "total": 303267,
        "description": "Kirchgemeinde"
      },
      "total-taxes": {
        "total": 5456443,
        "description": "Total Steuern"
      },
      "community": {
        "total": 2577771,
        "description": "Gemeinde"
      },
      "total-capital-benefit-after-tax": {
        "total": 1.2335358E7,
        "description": "Total Kapitalleistungen nach Steuern"
      },
      "taxes-in-percent-of-the-capital-benefit": {
        "total": "30.67%",
        "description": "in % der Kapitalleistung"
      },
      "canton": {
        "total": 2166194,
        "description": "Kanton ZH"
      },
      "total-cantonal-community-church-taxes": {
        "total": 5047232,
        "description": "Total Kantons-, Gemeinde- und Kirchensteuern"
      }
    },
    "type": "calculation-results"
  }
}
No liability will be accepted for the outcome. Figures are not binding.