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

# Validate Tax Fields

> Validates tax field values against a country's ruleset before you use them in a calculation, returning any errors and cross-field warnings.



## OpenAPI

````yaml /openapi/global-tax.yaml post /v1/tax/fields/validate
openapi: 3.0.0
info:
  title: Global Tax Engine
  version: 1.0.0
  description: API module for calculating taxes globally
  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: Tax Calculator
    description: APIs for tax calculations
paths:
  /v1/tax/fields/validate:
    post:
      tags:
        - Tax Calculator
      summary: Validate Tax Fields
      description: >-
        Validates tax field values against a country's ruleset before you use
        them in a calculation, returning any errors and cross-field warnings.
      operationId: validateTaxFields
      parameters:
        - $ref: '#/components/parameters/XMultiTenantKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ValidateTaxFieldsRequest'
            examples:
              current:
                summary: Validate against the current ruleset
                value:
                  countryCode: MX
                  taxFields:
                    riskCategory: I
                    addressState: JAL
              pinnedVersion:
                summary: Validate against a pinned ruleset version
                value:
                  countryCode: MX
                  version: v2.1.0
                  taxFields:
                    riskCategory: I
      responses:
        '200':
          description: Validation result
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidateTaxFieldsResponse'
              example:
                valid: true
                rulesetVersion: v2.1.0
        '400':
          $ref: '#/components/responses/BadRequestError'
      security:
        - Authorization: []
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.
  schemas:
    ValidateTaxFieldsRequest:
      type: object
      required:
        - countryCode
        - taxFields
      properties:
        countryCode:
          type: string
        taxFields:
          type: object
          additionalProperties: true
          description: The tax field values to validate.
        version:
          type: string
          description: >-
            Validate against a pinned ruleset version. Omit for the current
            ruleset.
          example: v2.1.0
    ValidateTaxFieldsResponse:
      type: object
      properties:
        valid:
          type: boolean
        errors:
          type: array
          items:
            type: string
        warnings:
          type: array
          items:
            type: string
        rulesetVersion:
          type: string
          description: >-
            The pinned version the fields were validated against. Returned only
            when the request pinned a version.
    BadRequestError:
      description: Bad input provided by client
      allOf:
        - $ref: '#/components/schemas/Error'
        - type: object
          properties:
            params:
              description: A map for meta data around the error that occurred
              type: object
      example:
        code: invalid_request_body
        message: The request body provided is not valid
        params:
          field: Value is invalid.
    Error:
      type: object
      properties:
        code:
          description: A machine parsable error code
          type: string
          enum:
            - invalid_request_body
            - resource_not_found
            - forbidden
            - internal_error
        message:
          description: A human readable message describing the error
          type: string
  responses:
    BadRequestError:
      description: Bad input provided by client
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/BadRequestError'
  securitySchemes:
    Authorization:
      type: http
      scheme: bearer
      bearerFormat: API_SECRET_KEY

````