> ## 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.

# Get required fields for tax calculation and statutory filing

> Returns all fields required for tax calculation and/or statutory filing
in this jurisdiction. This is a **discovery endpoint** — it tells you
what data needs to be collected for both persons (workers) and businesses
(employers).

Each field includes:
- **`entity`** — Who the field belongs to: `person` (worker data) or
  `business` (employer data)
- **`scope`** — Whether the field is needed for `calculation` (tax engine input),
  `filing` (statutory return), or both
- **`condition`** — When present, the field only applies if another field
  matches a specific value (e.g. pension PIN only when `is_pensionable` is true)

Use this to:
- Render onboarding forms with the right fields for each country
- Split fields into separate person vs. business forms using each
  field's `entity` value in the response (there is no `entity` query
  parameter — use the `scope` and `worker_type` parameters to narrow
  the results server-side)
- Validate that existing records have complete data
- Understand what `worker_data` requirements will surface if fields are missing

**How to submit fields by scope:**
- `scope: ["filing"]` fields → Submit via
  `PUT /v1/statutory/persons/{id}/fields/{countryCode}` (person entity) or
  `PUT /v1/statutory/businesses/{id}/fields/{countryCode}` (business entity)
- `scope: ["calculation"]` fields → Submit via
  `PUT /v1/persons/{id}/taxProfile`
- `scope: ["filing", "calculation"]` fields → Submit to both endpoints




## OpenAPI

````yaml /openapi/statutory-compliance.yaml get /v1/statutory/jurisdictions/{country_code}/required-fields
openapi: 3.0.0
info:
  title: Statutory Compliance API
  version: 0.1.0
  description: Statutory filing, government remittance, and compliance tracking API
  termsOfService: https://cadanapay.com/terms-and-conditions
  contact:
    email: api@cadanapay.com
  license:
    name: Apache 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0.html
servers:
  - url: https://api.cadanapay.com
    description: Prod Server
  - url: https://dev-api.cadanapay.com
    description: Dev Server
security:
  - Authorization: []
tags:
  - name: Jurisdictions
    description: Discover supported countries, required fields, and filing types
  - name: Filings
    description: >-
      Create, submit, and track statutory returns — from upcoming obligations
      through acceptance
  - name: Remittances
    description: Government payments linked to filings
  - name: Requirements
    description: Prerequisites that must be satisfied before filing
  - name: Events
    description: Immutable audit trail
  - name: Statutory Fields
    description: Submit and read entity-level statutory filing data
paths:
  /v1/statutory/jurisdictions/{country_code}/required-fields:
    get:
      tags:
        - Jurisdictions
      summary: Get required fields for tax calculation and statutory filing
      description: >
        Returns all fields required for tax calculation and/or statutory filing

        in this jurisdiction. This is a **discovery endpoint** — it tells you

        what data needs to be collected for both persons (workers) and
        businesses

        (employers).


        Each field includes:

        - **`entity`** — Who the field belongs to: `person` (worker data) or
          `business` (employer data)
        - **`scope`** — Whether the field is needed for `calculation` (tax
        engine input),
          `filing` (statutory return), or both
        - **`condition`** — When present, the field only applies if another
        field
          matches a specific value (e.g. pension PIN only when `is_pensionable` is true)

        Use this to:

        - Render onboarding forms with the right fields for each country

        - Split fields into separate person vs. business forms using each
          field's `entity` value in the response (there is no `entity` query
          parameter — use the `scope` and `worker_type` parameters to narrow
          the results server-side)
        - Validate that existing records have complete data

        - Understand what `worker_data` requirements will surface if fields are
        missing


        **How to submit fields by scope:**

        - `scope: ["filing"]` fields → Submit via
          `PUT /v1/statutory/persons/{id}/fields/{countryCode}` (person entity) or
          `PUT /v1/statutory/businesses/{id}/fields/{countryCode}` (business entity)
        - `scope: ["calculation"]` fields → Submit via
          `PUT /v1/persons/{id}/taxProfile`
        - `scope: ["filing", "calculation"]` fields → Submit to both endpoints
      operationId: getRequiredFields
      parameters:
        - $ref: '#/components/parameters/XMultiTenantKey'
        - $ref: '#/components/parameters/CountryCode'
        - name: worker_type
          in: query
          schema:
            type: string
            enum:
              - employee
              - contractor
          description: Filter fields by worker type
        - name: scope
          in: query
          schema:
            type: string
            enum:
              - calculation
              - filing
          description: >-
            Filter fields by scope — "calculation" for tax engine inputs,
            "filing" for statutory return fields. Omit to return all fields.
      responses:
        '200':
          description: Required fields with entity, scope, type, and validation rules
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RequiredFieldsResponse'
components:
  parameters:
    XMultiTenantKey:
      name: X-MultiTenantKey
      in: header
      required: false
      schema:
        type: string
      description: >-
        Required when using a Platform API token. The tenant key identifying
        which business to operate on.
    CountryCode:
      name: country_code
      in: path
      required: true
      schema:
        type: string
        pattern: ^[A-Z]{2}$
      description: ISO 3166-1 alpha-2 country code
      example: MX
  schemas:
    RequiredFieldsResponse:
      type: object
      description: |
        Flat list of fields required for tax calculation and/or statutory filing
        in a jurisdiction. Each field includes its entity (person or business),
        scope (calculation, filing, or both), and validation rules.

        Fields with `entity: "person"` are worker-level data. Fields with
        `entity: "business"` are employer-level data. Use the `entity` field
        to build separate onboarding forms for workers and employers.
      properties:
        countryCode:
          type: string
          example: MX
        workerType:
          type: string
          enum:
            - employee
            - contractor
          example: employee
        version:
          type: integer
          description: |
            Schema version number, per jurisdiction. Increments when fields are
            added, removed, or changed for this country. Use this to detect
            when your cached field list is stale.
          example: 3
        fields:
          type: array
          items:
            $ref: '#/components/schemas/RequiredField'
      required:
        - countryCode
        - version
        - fields
    RequiredField:
      type: object
      description: A single field required for tax calculation and/or statutory filing.
      properties:
        key:
          type: string
          description: Machine-readable field identifier, unique within a jurisdiction
          example: taxId
        name:
          type: string
          description: Human-readable field label, suitable for form rendering
          example: RFC (Registro Federal de Contribuyentes)
        description:
          type: string
          description: What this field is used for, with legislative context where relevant
          example: SAT-issued RFC, required on all ISR withholding returns
        type:
          type: string
          enum:
            - string
            - number
            - boolean
            - date
            - document
          description: |
            Data type of the field value. For `document` fields the value is a
            `fileId`: request an upload URL with `POST /v1/files/upload-url`
            (Workforce Management API, purpose `statutory-document`), HTTP PUT
            the file bytes to the returned `putUrl`, then submit the `fileId`
            as the field value. GET responses return document fields as an
            object with a presigned download `url`.
          example: string
        required:
          type: boolean
          description: >-
            Whether the field is mandatory. Conditional fields may be required
            only when their condition is met.
          example: true
        entity:
          type: string
          enum:
            - person
            - business
          description: |
            Who this field belongs to:
            - `person` — Worker-level data. Submit filing-scoped fields via
              `PUT /v1/statutory/persons/{id}/fields/{countryCode}`.
            - `business` — Employer-level data. Submit filing-scoped fields via
              `PUT /v1/statutory/businesses/{id}/fields/{countryCode}`.
          example: person
        scope:
          type: array
          items:
            type: string
            enum:
              - calculation
              - filing
          description: >
            What this field is used for:

            - `calculation` — Required by the tax engine for gross-to-net
            computation.
              Submit via `PUT /v1/persons/{id}/taxProfile`.
            - `filing` — Required on the statutory return submitted to the
            authority.
              Submit via the statutory fields endpoints.
            A field can appear in both scopes — submit to both endpoints.
          example:
            - calculation
            - filing
        enum:
          type: array
          items:
            type: string
          description: Allowed values, when the field accepts a fixed set of options
        pattern:
          type: string
          description: Regex pattern for string validation
          example: ^[A-Z&Ñ]{4}\d{6}[A-Z0-9]{3}$
        condition:
          $ref: '#/components/schemas/FieldCondition'
      required:
        - key
        - name
        - description
        - type
        - required
        - entity
        - scope
    FieldCondition:
      type: object
      description: |
        Conditional applicability — this field is only required when another
        field or person attribute matches a specific value. For example,
        a pension PIN is only required when the worker's `is_pensionable`
        flag is true.
      properties:
        field:
          type: string
          description: The key of another field or person attribute to check
          example: is_pensionable
        equals:
          description: The value that triggers this field's requirement
          example: true
      required:
        - field
        - equals
  securitySchemes:
    Authorization:
      type: http
      scheme: bearer
      bearerFormat: API_SECRET_KEY

````