> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cadanapay.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Integration Guide

> Integrate the Global Tax Engine API

## Prerequisites

**1. API key from Dashboard**

Get your API key from the [Cadana Dashboard](https://app.cadanapay.com). See [Authentication](https://docs.cadanapay.com/authentication.md) for details.

**2. Active business on Cadana**

Your business must be created and verified on the platform.

***

## Check Location Support

Verify which countries and regions are supported. The response includes valid state/region codes needed when creating a person.

**/v1/tax/locations**

**Response:**

```json theme={null}
{
  "data": [
    {
      "name": "Australia",
      "code": "AU",
      "regions": [
        { "name": "New South Wales", "code": "NSW" },
        { "name": "Victoria", "code": "VIC" },
        { "name": "Queensland", "code": "QLD" }
      ]
    }
  ]
}
```

***

## Get Required Tax Fields

Some countries require additional fields (state, employer risk class, year-to-date figures, etc.) for accurate calculations. Retrieve the required fields before creating a person.

**/v1/tax/fields**

**Response:**

```json theme={null}
{
  "data": [
    {
      "name": "riskCategory",
      "description": "IMSS Riesgos de Trabajo class (5 statutory classes per LSS Art. 73)",
      "type": "string",
      "required": false,
      "enum": ["I", "II", "III", "IV", "V"],
      "provider": "employer",
      "default": "I"
    },
    {
      "name": "addressState",
      "description": "State (entidad federativa) where the employee works",
      "type": "string",
      "required": false,
      "enum": ["AGU", "BCN", "BCS", "CAM", "CHP", "…"],
      "provider": "employee",
      "default": "OTHER"
    },
    {
      "name": "yearsOfService",
      "description": "Years of seniority — drives SBC factor de integración (LFT Art. 76+80+87)",
      "type": "number",
      "required": false,
      "provider": "employer",
      "default": 1
    },
    {
      "name": "hasInfonavitCredit",
      "description": "Toggle for INFONAVIT loan deduction line",
      "type": "boolean",
      "required": false,
      "provider": "employer",
      "default": false
    },
    {
      "name": "ytdGrossIncome",
      "description": "Pay this worker has already received in the current tax year, before they joined your payroll. Leave empty if this is their first payment of the tax year. If you enter an amount, also set the tax year it applies to.",
      "type": "number",
      "required": false,
      "provider": "employer",
      "default": 0
    }
  ],
  "schemaVersion": "2020-12",
  "version": "v2.4.0",
  "effectiveFrom": "2026-02-01",
  "pinnable": true,
  "schema": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "additionalProperties": false,
    "properties": {
      "riskCategory": {
        "type": "string",
        "enum": ["I", "II", "III", "IV", "V"],
        "default": "I"
      },
      "addressState": {
        "type": "string",
        "enum": ["AGU", "BCN", "BCS", "CAM", "CHP", "…"],
        "default": "OTHER"
      },
      "yearsOfService": {
        "type": "number",
        "default": 1
      },
      "hasInfonavitCredit": {
        "type": "boolean",
        "default": false
      },
      "ytdGrossIncome": {
        "type": "number",
        "default": 0
      }
    },
    "allOf": [
      {
        "if": {
          "properties": {
            "hasInfonavitCredit": {
              "const": true
            }
          },
          "required": ["hasInfonavitCredit"]
        },
        "then": {
          "required": ["infonavitDeductionValue"]
        }
      }
    ]
  }
}
```

### Field properties

Each field is self-describing, so you can render an onboarding form dynamically instead of hard-coding one per country.

| Property | Description |
| :- | :- |
| `name` | Field key. Submit the collected value under this key in `additionalAttributes` on [`POST /v1/tax/calculate`](https://docs.cadanapay.com/api-reference/tax/tax-calculator/calculate-taxes) or in the person's `taxProfile`. |
| `description` | Human-readable explanation — use it as the form label or helper text. |
| `type` | Value type: `string`, `number`, or `boolean`. Maps to the input control (text, number, checkbox). |
| `required` | Whether the field must be provided. Required fields never rely on a default. |
| `enum` | Present when the field accepts a fixed set of values — render as a dropdown of these options. |
| `default` | Present when the field has a default. If you omit the field, the engine applies this value automatically — so you can pre-fill the control with it, and optional fields that have a `default` need no user input at all. |

> [!TIP]
>
> The `default` is the same value the engine seeds during calculation, so what you see here is exactly what's applied when the field is omitted. Pre-populate your form with each field's `default` to reduce the inputs a worker has to fill in.

### Rendering forms from the schema

Alongside `data`, the response carries a full [JSON Schema (draft 2020-12)](https://json-schema.org/draft/2020-12/schema) under `schema`, and the `schemaVersion` it targets. `data` is enough for a flat form; `schema` describes the same fields **and the relationships between them**, so you can render conditional fields and validate a completed profile with any standard validator (e.g. [Ajv](https://ajv.js.org/) for JavaScript or [jsonschema](https://pypi.org/project/jsonschema/) for Python) — no per-country logic.

| Keyword | What it tells you |
| :- | :- |
| `properties` | Available fields with their types and constraints |
| `enum` | Allowed values for a fixed-option field — render as a dropdown |
| `const` | A fixed value the field must take (used inside conditional rules) |
| `minimum` | Lower bound for a numeric field |
| `default` | Value the engine applies when the field is omitted — use it to pre-fill |
| `required` | Fields that must be present |
| `additionalProperties` | Always `false` — only listed fields are accepted |
| `allOf` / `if`-`then` | Conditional rules — e.g. if one field has a given value, another is constrained |

Some cross-field relationships have no standard keyword, so they are expressed as `x-cadana-*` extensions. A standard validator ignores them; handle them yourself where you need the rule enforced:

| Keyword | Meaning |
| :- | :- |
| `x-cadana-lteField` | This numeric field must be **≤** the named field (e.g. `childrenUnder3 ≤ numberOfChildren`) |
| `x-cadana-groupSumLteField` | The **sum** of every field sharing a group must be ≤ the named field |
| `x-cadana-group` | The group label a field belongs to (used with `x-cadana-groupSumLteField`) |
| `x-cadana-ui` | Rendering hints keyed by field — e.g. `visibleWhen` tells your form when to show a conditional field |
| `x-cadana-provider` | Internal source that surfaces the field. May be omitted |

For example, a country schema can gate one field on another and cap a subset against a total:

```json theme={null}
{
  "properties": {
    "numberOfChildren": { "type": "number", "minimum": 0, "default": 0 },
    "childrenUnder3": { "type": "number", "minimum": 0, "default": 0, "x-cadana-lteField": "numberOfChildren" },
    "disabilityDegree": { "type": "string", "enum": ["none", "33_to_64", "65_plus"], "default": "none" },
    "hasReducedMobility": { "type": "boolean", "default": false }
  },
  "allOf": [
    {
      "if": { "not": { "required": ["disabilityDegree"], "properties": { "disabilityDegree": { "const": "33_to_64" } } } },
      "then": { "properties": { "hasReducedMobility": { "const": false } } }
    }
  ],
  "x-cadana-ui": {
    "hasReducedMobility": { "visibleWhen": { "field": "disabilityDegree", "equals": "33_to_64" } }
  }
}
```

Read `x-cadana-ui.visibleWhen` to decide when to show `hasReducedMobility`, and let the schema be the source of truth for validation before you submit.

***

## Create a Person

Create a person with their address, salary, and compensation details. The returned `id` is used for all subsequent tax calculations.

**/v1/persons**

**Response:**

```json theme={null}
{
  "id": "96bfcbf3-c201-405d-848d-f55bec77588c"
}
```

> [!TIP]
>
> Populate any country-specific fields from the previous step on the person record. Use [`PUT /v1/persons/{id}/personalInfo`](https://docs.cadanapay.com/api-reference/workforce/persons/update-personal-information) to add `taxId` and `socialSecurityId`, or [`PUT /v1/persons/{id}/taxProfile`](https://docs.cadanapay.com/api-reference/workforce/persons/update-tax-profile) for the `calculation`-scope fields returned by the fields endpoint above.

### Manage Persons

| Operation | Endpoint |
| :- | :- |
| Get | [`GET /v1/persons/{id}`](https://docs.cadanapay.com/api-reference/workforce/persons/get) |
| Update basic info | [`PUT /v1/persons/{id}/basicInfo`](https://docs.cadanapay.com/api-reference/workforce/persons/update-basic-information) |
| Update personal info | [`PUT /v1/persons/{id}/personalInfo`](https://docs.cadanapay.com/api-reference/workforce/persons/update-personal-information) |
| Update job info | [`PUT /v1/persons/{id}/jobInfo`](https://docs.cadanapay.com/api-reference/workforce/persons/update-job-information) |
| Update tax profile | [`PUT /v1/persons/{id}/taxProfile`](https://docs.cadanapay.com/api-reference/workforce/persons/update-tax-profile) |

***

## Calculate Taxes

Calculate taxes for a person. Pass the `personId` and the salary for the period.

**/v1/tax/calculate**

**Response:**

```json theme={null}
{
  "personId": "96bfcbf3-c201-405d-848d-f55bec77588c",
  "grossAmount": { "amount": 4000000, "currency": "MXN" },
  "netAmount": { "amount": 3213701, "currency": "MXN" },
  "deductions": [
    {
      "code": "MX_IMSS_EYM_EE",
      "name": "Sickness and Maternity Insurance",
      "isStatutory": true,
      "amount": { "amount": 38232, "currency": "MXN" }
    },
    {
      "code": "MX_IMSS_IV_EE",
      "name": "Disability and Life Insurance",
      "isStatutory": true,
      "amount": { "amount": 25887, "currency": "MXN" }
    },
    {
      "code": "MX_IMSS_CEAV_EE",
      "name": "Severance at Advanced Age and Old Age",
      "isStatutory": true,
      "amount": { "amount": 46597, "currency": "MXN" }
    },
    {
      "code": "MX_ISR",
      "name": "Income Tax (ISR)",
      "isStatutory": true,
      "amount": { "amount": 675582, "currency": "MXN" }
    }
  ],
  "employerContributions": [
    {
      "code": "MX_IMSS_RT_ER",
      "name": "Work Risk Insurance",
      "isStatutory": true,
      "amount": { "amount": 22514, "currency": "MXN" }
    },
    {
      "code": "MX_IMSS_EYM_ER",
      "name": "Sickness and Maternity Insurance",
      "isStatutory": true,
      "amount": { "amount": 178226, "currency": "MXN" }
    },
    {
      "code": "MX_IMSS_IV_ER",
      "name": "Disability and Life Insurance",
      "isStatutory": true,
      "amount": { "amount": 72485, "currency": "MXN" }
    },
    {
      "code": "MX_PENSION_RETIRO_ER",
      "name": "Retirement",
      "isStatutory": true,
      "amount": { "amount": 82839, "currency": "MXN" }
    },
    {
      "code": "MX_IMSS_CEAV_ER",
      "name": "Severance at Advanced Age and Old Age",
      "isStatutory": true,
      "amount": { "amount": 311186, "currency": "MXN" }
    },
    {
      "code": "MX_IMSS_GUARDERIAS_ER",
      "name": "Nurseries and Social Benefits",
      "isStatutory": true,
      "amount": { "amount": 41420, "currency": "MXN" }
    },
    {
      "code": "MX_INFONAVIT_ER",
      "name": "National Housing Fund",
      "isStatutory": true,
      "amount": { "amount": 207099, "currency": "MXN" }
    },
    {
      "code": "MX_ISN",
      "name": "State Payroll Tax",
      "isStatutory": true,
      "amount": { "amount": 160000, "currency": "MXN" }
    }
  ]
}
```

### Response fields

| Field | Description |
| :- | :- |
| `grossAmount` | Input salary for the period |
| `netAmount` | Take-home pay after all deductions |
| `allowances` | Imputed-income line items (e.g. benefits-in-kind) surfaced by the country engine. Omitted when none apply. |
| `deductions` | Employee deductions (social security, income tax, etc.). Each entry's `isStatutory` flag indicates whether the deduction is mandated by law. `code` is the tax engine's identifier for the line (e.g. `MX_ISR`); it is absent on custom lines and some other lines. |
| `employerContributions` | Employer-side costs not deducted from the employee's pay. Entries carry the same `code` as deductions. |
| `summary` | Step-by-step calculation breakdown showing formulas, brackets, and rates for each line item |

The `additionalAttributes` field accepts country-specific values like year-to-date salary or pension contributions. These are calculation-time inputs — different from the tax profile fields set when [creating a person](#create-a-person). Use the [tax fields endpoint](#get-required-tax-fields) to discover what's available for each country. Numeric fields are expressed in major currency units — e.g. India's `hraReceived`, `rentPaid`, and `declared80c` are whole rupees — unlike `amount` objects, which use the lowest denomination.

***

## Next Steps

> [card] [Employment Cost Calculator](https://docs.cadanapay.com/tax/estimate.md)
>
> Quick estimates without a person record — great for compensation planning

> [card] [Tax API Reference](https://docs.cadanapay.com/api-reference/tax)
>
> Full API documentation

> [card] [Global Tax Engine](https://docs.cadanapay.com/tax/overview.md)
>
> Product overview and capabilities

> [card] [File Statutory Returns](https://docs.cadanapay.com/statutory/the-full-loop.md)
>
> After calculating taxes, file returns and remit to government authorities

> [card] [Run Payroll](https://docs.cadanapay.com/workforce/pay-workers-via-payroll.md)
>
> Pay your workers using the calculated tax amounts


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.