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

# Create all filings for a period

> **Beta** — contact Cadana to enable access for your business.

Creates statutory filings for a business and period in a single call.
Supports two modes:

**Cadana payroll:** Provide `payrollRunIds` — Cadana determines which
filing types apply based on active workers and their compensation flags
(IMSS-eligible, INFONAVIT-eligible, etc.) and pulls amounts from the tax engine.

**External payroll:** Provide a `filings` array with explicit amounts and
person IDs per filing type. Use this when the client runs payroll outside
Cadana and just needs Cadana to file and remit.

All filings in one batch must share the same `source` — a batch is either
all `cadana` or all `external`; mixing sources returns `400`.

For example, a Mexican business with 15 employees would get up to 4 filings:
ISR, IMSS, INFONAVIT, and ISN.




## OpenAPI

````yaml /openapi/statutory-compliance.yaml post /v1/statutory/filings/batch
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/filings/batch:
    post:
      tags:
        - Filings
      summary: Create all filings for a period
      description: >
        **Beta** — contact Cadana to enable access for your business.


        Creates statutory filings for a business and period in a single call.

        Supports two modes:


        **Cadana payroll:** Provide `payrollRunIds` — Cadana determines which

        filing types apply based on active workers and their compensation flags

        (IMSS-eligible, INFONAVIT-eligible, etc.) and pulls amounts from the tax
        engine.


        **External payroll:** Provide a `filings` array with explicit amounts
        and

        person IDs per filing type. Use this when the client runs payroll
        outside

        Cadana and just needs Cadana to file and remit.


        All filings in one batch must share the same `source` — a batch is
        either

        all `cadana` or all `external`; mixing sources returns `400`.


        For example, a Mexican business with 15 employees would get up to 4
        filings:

        ISR, IMSS, INFONAVIT, and ISN.
      operationId: createFilingsBatch
      parameters:
        - $ref: '#/components/parameters/XMultiTenantKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateFilingsBatchRequest'
      responses:
        '201':
          description: Filings created
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/IDResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
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:
    CreateFilingsBatchRequest:
      type: object
      required:
        - businessId
        - periodStart
        - periodEnd
      description: |
        Batch create filings for a business and period in one call. Pick one
        input shape:

        - **`payrollRunIds`** — Cadana derives the filing types and breakdowns
          from the linked Cadana payroll runs. Each filing is created as
          `source: cadana` and runs the full lifecycle.
        - **`filings`** — Provide an explicit array, each entry with its own
          `filingTypeId`, `currency`, and `breakdown`. Each entry can be
          `source: cadana` (Cadana files for you) or `source: external` (you
          already filed and supply a `filingReference`). Use this when amounts
          were computed outside Cadana.

        Exactly one of `payrollRunIds` or `filings` must be provided. All
        entries in `filings` must share the same `source` (all `cadana` or all
        `external`); mixing sources returns `400`.
      properties:
        businessId:
          type: string
        periodStart:
          type: string
          format: date
          example: '2026-02-01'
        periodEnd:
          type: string
          format: date
          example: '2026-02-28'
        payrollRunIds:
          type: array
          items:
            type: string
          description: |
            Link to Cadana payroll runs. Cadana auto-determines filing types
            and populates amounts from the tax engine.
            Mutually exclusive with `filings`.
        filings:
          type: array
          description: |
            Explicit per-filing data. Use this when you computed the amounts
            outside Cadana — works for both `source: cadana` (Cadana still
            files) and `source: external` (you already filed). Mutually
            exclusive with `payrollRunIds`.
          items:
            type: object
            required:
              - filingTypeId
              - currency
              - breakdown
            properties:
              filingTypeId:
                type: string
                example: ft_mx_isr_monthly
              source:
                type: string
                enum:
                  - cadana
                  - external
                default: cadana
              currency:
                type: string
                description: ISO 4217 currency code applied to every breakdown line.
                example: MXN
              filingReference:
                type: string
                description: Required when this entry's `source` is `external`.
                example: 0123456ABCD7890EF
              breakdown:
                type: array
                items:
                  $ref: '#/components/schemas/FilingBreakdownEntry'
        countryCode:
          type: string
          description: |
            Limit to a specific jurisdiction. If omitted, creates filings
            for all jurisdictions where the business has active workers.
        filingTypeIds:
          type: array
          items:
            type: string
          description: |
            Limit to specific filing types (only applies when using
            `payrollRunIds` mode). If omitted, creates all applicable
            filing types based on worker flags.
    IDResponse:
      type: object
      description: Response containing the ID of a newly created resource.
      properties:
        id:
          type: string
          example: fil_01HQ3K4N7XYZABC
    FilingBreakdownEntry:
      type: object
      description: |
        One contribution line that rolls up into a filing's total. The breakdown
        array as a whole is the canonical description of the filing — its sum is
        the filing total.

        **Identifying the worker:**
        - For `source: cadana` filings, each line must reference a `personId`
          (Cadana needs the worker record to populate filing fields).
        - For `source: external` filings, lines may use `personId` (when the
          worker is onboarded), `externalEmployeeId` (when not), or neither
          (for business-level taxes computed on aggregate payroll, like
          Mexico's ISN, where there's no per-worker allocation).
      required:
        - amount
      properties:
        personId:
          type: string
          description: |
            Cadana person ID. Required on `source: cadana` filings.
          example: per_01HQ3K4N7XYZABC
        externalEmployeeId:
          type: string
          description: |
            Your own employee identifier. Use on `source: external` filings when
            the worker is not onboarded into Cadana.
          example: EMP-00142
        employeeName:
          type: string
          description: Human-readable name for audit trail and reconciliation.
          example: María García López
        amount:
          type: number
          format: decimal
          description: Contribution amount for this line in the filing currency.
          example: 4250
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              example: invalid_request
            message:
              type: string
              example: countryCode is required
            details:
              type: array
              nullable: true
              items:
                type: object
                properties:
                  field:
                    type: string
                  message:
                    type: string
  responses:
    BadRequest:
      description: Invalid request parameters
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    Authorization:
      type: http
      scheme: bearer
      bearerFormat: API_SECRET_KEY

````