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

# Get the contract of the version this subscription files

> Returns the contract of the version THIS subscription adopted — the same shape as the document's contract route — read from this tenant's own copy. A mapping is made for one subscription, and two institutions may file one document at different versions; the document's route answers the newest active subscription of the document, whichever institution files it, so a client mapping a subscription reads this one. With `version`, it answers a version the subscription adopted earlier, which is how a filing is read against the version it was generated with.



## OpenAPI

````yaml /es/openapi/v3-current/reporter.yaml get /v1/regulatory/subscriptions/{subscriptionId}/contract
openapi: 3.1.0
info:
  contact:
    email: contact@lerian.studio
    name: Lerian Studio
    url: https://lerian.studio
  description: >-
    This is OpenAPI documentation for Reporter. The unified reporter binary
    serves the REST API (RUN_MODE=api) and/or the RabbitMQ report-generation
    worker (RUN_MODE=worker); RUN_MODE=all runs both in one process for local
    development. All REST endpoints documented here serve only when RUN_MODE=api
    or all (port :4005); the worker (port :4006) exposes health/readyz/version
    only.
  license:
    name: Lerian Studio General License
  title: Midaz Reporter API
  version: 4.0.0
servers:
  - url: https://reporter.sandbox.lerian.net
security:
  - BearerAuth: []
tags:
  - description: Generated report instances and their lifecycle.
    name: Reports
  - description: Reusable report definitions.
    name: Templates
  - description: Interactive construction of report templates.
    name: Template Builder
  - description: Scheduled report due-date tracking.
    name: Deadlines
  - description: Configured inputs that feed report data.
    name: Data Sources
  - description: Aggregated reporting metrics.
    name: Metrics
  - description: Published business event catalog and delivery policies.
    name: Streaming
paths:
  /v1/regulatory/subscriptions/{subscriptionId}/contract:
    get:
      tags:
        - Regulatory Subscriptions
      summary: Get the contract of the version this subscription files
      description: >-
        Returns the contract of the version THIS subscription adopted — the same
        shape as the document's contract route — read from this tenant's own
        copy. A mapping is made for one subscription, and two institutions may
        file one document at different versions; the document's route answers
        the newest active subscription of the document, whichever institution
        files it, so a client mapping a subscription reads this one. With
        `version`, it answers a version the subscription adopted earlier, which
        is how a filing is read against the version it was generated with.
      operationId: getRegulatorySubscriptionContract
      parameters:
        - description: Unique subscription identifier.
          example: 00000000-0000-0000-0000-000000000000
          in: path
          name: subscriptionId
          required: true
          schema:
            description: Unique subscription identifier.
            type: string
        - description: >-
            A version this subscription adopted at some point — the one a filing
            was generated with. Absent: the version in force. One it never
            adopted answers 404.
          example: 1.7.0
          explode: false
          in: query
          name: version
          schema:
            description: >-
              A version this subscription adopted at some point — the one a
              filing was generated with. Absent: the version in force. One it
              never adopted answers 404.
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RegulatoryContractWire'
          description: OK
        '400':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Bad Request
        '401':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Unauthorized
        '403':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Forbidden
        '404':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Not Found
        '500':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Internal Server Error
components:
  schemas:
    RegulatoryContractWire:
      additionalProperties: false
      properties:
        apiVersion:
          description: Format identifier of the contract document.
          examples:
            - reporter.lerian.io/v1alpha1
          type: string
        calendar:
          $ref: '#/components/schemas/RegulatoryCalendarWire'
          description: >-
            Business-day calendar the document is filed by, from the
            subscription's pinned copy. Null when the contract declares none.
        datasets:
          description: Every set the file carries and every field of it.
          items:
            $ref: '#/components/schemas/RegulatoryDatasetWire'
          type:
            - array
            - 'null'
        filing:
          $ref: '#/components/schemas/RegulatoryFilingWire'
          description: >-
            What makes two generations the same filing and which remittance is
            the original, as the contract declares it. Null when the contract
            declares no filing block.
        kind:
          description: Document kind; always DocumentContract.
          examples:
            - DocumentContract
          type: string
        knownGaps:
          description: What this contract knowingly does not yet cover.
          items:
            $ref: '#/components/schemas/RegulatoryKnownGapWire'
          type:
            - array
            - 'null'
        metadata:
          $ref: '#/components/schemas/RegulatoryMetadataWire'
          description: Which obligation this is, at which version.
        parameters:
          description: What the generation must be told, answered per request.
          items:
            $ref: '#/components/schemas/RegulatoryParameterWire'
          type:
            - array
            - 'null'
        reportTimezone:
          description: >-
            IANA time zone whose calendar decides when a period has closed
            (REPORT_TIMEZONE).
          examples:
            - America/Sao_Paulo
          type: string
        rules:
          description: 'Every rule of the document: what the engine transforms and checks.'
          items:
            $ref: '#/components/schemas/RegulatoryRuleWire'
          type:
            - array
            - 'null'
        tables:
          description: Lookup tables published beside the contract, which its rules read.
          items:
            $ref: '#/components/schemas/RegulatoryTableWire'
          type:
            - array
            - 'null'
      required:
        - metadata
        - parameters
        - datasets
        - rules
        - tables
        - knownGaps
        - calendar
        - reportTimezone
        - filing
      type: object
    Detail:
      properties:
        code:
          description: >-
            Stable, machine-readable domain error code scoped to the emitting
            service (format: <SERVICE>-NNNN).
          type: string
        detail:
          description: >-
            A human-readable explanation specific to this occurrence of the
            problem.
          examples:
            - Property foo is required but is missing.
          type: string
        errors:
          description: Optional list of individual error details
          examples:
            - - location: body.templateId
                message: expected string to match 'uuid' format
                value: not-a-uuid
          items:
            $ref: '#/components/schemas/ErrorDetail'
          type:
            - array
            - 'null'
        instance:
          description: >-
            A URI reference that identifies the specific occurrence of the
            problem.
          examples:
            - https://example.com/error-log/abc123
          format: uri
          type: string
        status:
          description: HTTP status code
          examples:
            - 400
          format: int64
          type: integer
        title:
          description: >-
            A short, human-readable summary of the problem type. This value
            should not change between occurrences of the error.
          examples:
            - Bad Request
          type: string
        type:
          default: about:blank
          description: A URI reference to human-readable documentation for the error.
          examples:
            - https://example.com/errors/example
          format: uri
          type: string
        upstream:
          $ref: '#/components/schemas/Upstream'
          description: >-
            RFC 9457 extension member: the error a proxied third-party provider
            reported. Absent unless the emitting service explicitly surfaced
            one.
      type: object
    RegulatoryCalendarWire:
      additionalProperties: false
      properties:
        from:
          description: First day the calendar answers for, as AAAA-MM-DD.
          examples:
            - '2025-01-01'
          type: string
        nonBusinessDays:
          description: Weekdays inside the span that are not business days, in date order.
          items:
            $ref: '#/components/schemas/RegulatoryNonBusinessDayWire'
          type:
            - array
            - 'null'
        until:
          description: Last day the calendar answers for, as AAAA-MM-DD.
          examples:
            - '2027-12-31'
          type: string
        weekends:
          description: Saturday and Sunday are never business days.
          type: boolean
      required:
        - weekends
        - from
        - until
        - nonBusinessDays
      type: object
    RegulatoryDatasetWire:
      additionalProperties: false
      properties:
        childOf:
          $ref: '#/components/schemas/RegulatoryChildOfWire'
          description: Present when this set is a nested list on each row of another.
        consolidation:
          $ref: '#/components/schemas/RegulatoryConsolidationWire'
          description: >-
            How this set's rows, read from more than one source, become one set,
            as the document's curator declared it. Null when the set reads from
            one source.
        description:
          type: string
        fields:
          items:
            $ref: '#/components/schemas/RegulatoryFieldWire'
          type:
            - array
            - 'null'
        grain:
          $ref: '#/components/schemas/RegulatoryGrainWire'
          description: Row shape the file requires of this set.
        means:
          description: What the set represents, in prose, for whoever writes the mapping.
          type: string
        name:
          examples:
            - cosif_balances
          type: string
        rowSet:
          $ref: '#/components/schemas/RegulatoryRowSetWire'
          description: Present when the ROWS come from the catalog rather than the client.
      required:
        - name
        - grain
        - consolidation
        - fields
      type: object
    RegulatoryFilingWire:
      additionalProperties: false
      properties:
        period:
          description: >-
            Parameters that identify the filing period. Empty when the contract
            does not name them: then every parameter except the remittance one
            does.
          examples:
            - - dataBase
          items:
            type: string
          type:
            - array
            - 'null'
        remittance:
          $ref: '#/components/schemas/RegulatoryRemittanceWire'
          description: >-
            Which parameter says whether a generation is the original or a
            replacement, and the value of each. Null when the contract declares
            none.
      required:
        - period
        - remittance
      type: object
    RegulatoryKnownGapWire:
      additionalProperties: false
      properties:
        description:
          type: string
        id:
          type: string
      required:
        - id
      type: object
    RegulatoryMetadataWire:
      additionalProperties: false
      properties:
        appliesTo:
          $ref: '#/components/schemas/RegulatoryAppliesToWire'
          description: Which institutions owe this document.
        country:
          examples:
            - BR
          type: string
        document:
          description: The regulator's own number for it.
          examples:
            - '4010'
          type: string
        family:
          description: Group of filings the document belongs to, as a lowercase code.
          examples:
            - cadoc
          type: string
        id:
          description: Document identifier, as a subscription names it.
          examples:
            - br.bcb.cadoc-4010
          type: string
        layout:
          $ref: '#/components/schemas/RegulatoryLayoutWire'
          description: >-
            Layout edition this contract is written against, on a document with
            more than one.
        output:
          description: File format the regulator receives.
          examples:
            - xml
          type: string
        periodicity:
          examples:
            - monthly
          type: string
        regulator:
          examples:
            - BCB
          type: string
        status:
          examples:
            - stable
          type: string
        summary:
          description: What the document is, in one or two sentences.
          type: string
        title:
          examples:
            - Balancete Patrimonial Analítico
          type: string
        version:
          examples:
            - 1.0.0
          type: string
      required:
        - id
        - appliesTo
      type: object
    RegulatoryParameterWire:
      additionalProperties: false
      properties:
        allowedMonths:
          description: >-
            Months of any year this parameter may name, as two-digit numbers.
            Null when any month is allowed.
          items:
            type: string
          type:
            - array
            - 'null'
        businessDay:
          description: >-
            The parameter is a date that must be a business day of the
            document's calendar; any other day is refused (RPT-0140).
          examples:
            - true
          type: boolean
        closed:
          description: >-
            The parameter names a period that must already have ended on the
            report calendar: a month from the first day of the next, a day from
            the day after. An open period is refused (RPT-0140).
          examples:
            - true
          type: boolean
        default:
          description: >-
            Applied when the request omits the parameter. Null when the
            parameter has none — an empty string is a declared default of empty,
            which is a different thing.
          type:
            - string
            - 'null'
        description:
          type: string
        domain:
          description: >-
            Closed set of values the parameter accepts. Null when it is not
            narrowed.
          items:
            type: string
          type:
            - array
            - 'null'
        name:
          examples:
            - dataBase
          type: string
        required:
          type: boolean
        type:
          examples:
            - month
          type: string
      required:
        - name
        - type
        - required
        - default
        - domain
        - allowedMonths
        - businessDay
        - closed
      type: object
    RegulatoryRuleWire:
      additionalProperties: false
      properties:
        appliesTo:
          type: string
        does:
          $ref: '#/components/schemas/RegulatoryRuleDoesWire'
          description: >-
            What the engine runs: a transform or a check of the closed
            vocabulary.
        id:
          type: string
        message:
          type: string
        severity:
          description: >-
            error refuses the generation. Absent on a transform, which does not
            fail.
          examples:
            - error
          type: string
        where:
          $ref: '#/components/schemas/RegulatoryRuleWhereWire'
          description: The rows the rule is narrowed to.
      required:
        - id
      type: object
    RegulatoryTableWire:
      additionalProperties: false
      properties:
        from:
          examples:
            - natureza.yaml
          type: string
        match:
          examples:
            - longestPrefix
          type: string
        name:
          examples:
            - natureza
          type: string
      required:
        - name
        - from
        - match
      type: object
    ErrorDetail:
      properties:
        location:
          description: >-
            Where the error occurred, e.g. 'body.items[3].tags' or
            'path.thing-id'
          examples:
            - body.templateId
          type: string
        message:
          description: Error message text
          examples:
            - expected string to match 'uuid' format
          type: string
        value:
          description: The value at the given location
          examples:
            - not-a-uuid
      type: object
    Upstream:
      additionalProperties: false
      properties:
        code:
          description: The upstream provider's own error code, verbatim.
          examples:
            - E4001
          type: string
        message:
          description: >-
            The upstream provider's own error message, verbatim (bounded, never
            its raw response body).
          examples:
            - account not found at provider
          type: string
      type: object
    RegulatoryNonBusinessDayWire:
      additionalProperties: false
      properties:
        date:
          examples:
            - '2026-11-02'
          type: string
        description:
          examples:
            - Finados
          type: string
      required:
        - date
      type: object
    RegulatoryChildOfWire:
      additionalProperties: false
      properties:
        dataset:
          description: Parent set this one hangs from.
          type: string
      required:
        - dataset
      type: object
    RegulatoryConsolidationWire:
      additionalProperties: false
      properties:
        columns:
          additionalProperties:
            type: string
          description: >-
            What becomes of each field that is neither a key nor derived: sum
            (the sources' values added), equal (the sources must agree), first
            (the first source's value).
          type: object
        key:
          description: >-
            Fields a row is unified by: rows of different sources with the same
            values here become one row.
          examples:
            - - code
          items:
            type: string
          type:
            - array
            - 'null'
        whenKeyRepeats:
          description: >-
            combine: rows sharing a key are unified by the column rules. refuse:
            the sources' rows are appended and a key found in two sources
            refuses the generation.
          enum:
            - combine
            - refuse
          examples:
            - combine
          type: string
      required:
        - key
        - whenKeyRepeats
        - columns
      type: object
    RegulatoryFieldWire:
      additionalProperties: false
      properties:
        checkDigit:
          description: >-
            Check-digit rule the value satisfies; cnpj verifies a numeric or
            alphanumeric CNPJ.
          examples:
            - cnpj
          type: string
        description:
          type: string
        domain:
          items:
            type: string
          type:
            - array
            - 'null'
        expects:
          description: >-
            What the mapping must deliver into the field before the document's
            rules run, in prose: the convention a value arrives in when a rule
            depends on it.
          type: string
        format:
          $ref: '#/components/schemas/RegulatoryFormatWire'
        identifiesInstitution:
          description: >-
            true when this value must be the identifier the filing's institution
            is registered under; a filing whose declarant is another institution
            is refused (RPT-0196).
          examples:
            - 'true'
          type: string
        length:
          description: Exact length the file requires, when it requires one.
          format: int64
          type: integer
        means:
          type: string
        name:
          examples:
            - saldo
          type: string
        normalize:
          type: string
        pattern:
          type: string
        prefixOf:
          description: >-
            Field of the same set this value is cut from: its first length
            positions. A derived field is never mapped by a binding.
          examples:
            - cnpj
          type: string
        required:
          type: boolean
        type:
          examples:
            - decimal
          type: string
      required:
        - name
        - type
        - required
      type: object
    RegulatoryGrainWire:
      additionalProperties: false
      properties:
        keys:
          description: Fields whose combination is unique across the set.
          items:
            type: string
          type:
            - array
            - 'null'
        singleton:
          description: True when the set is always exactly one row.
          type: boolean
      required:
        - singleton
      type: object
    RegulatoryRowSetWire:
      additionalProperties: false
      properties:
        columns:
          description: Every column the published rows carry, sorted.
          items:
            type: string
          type:
            - array
            - 'null'
        key:
          description: Field of this set each catalog-supplied row is identified by.
          type: string
        rows:
          description: The published rows, in the catalog's order.
          items:
            additionalProperties:
              type: string
            type: object
          type:
            - array
            - 'null'
      required:
        - key
        - columns
        - rows
      type: object
    RegulatoryRemittanceWire:
      additionalProperties: false
      properties:
        original:
          description: Its value for the original filing of a period.
          examples:
            - I
          type: string
        parameter:
          description: The generation parameter that carries the remittance.
          examples:
            - tipoRemessa
          type: string
        replacement:
          description: Its value for a replacement of an approved original.
          examples:
            - S
          type: string
      required:
        - parameter
        - original
        - replacement
      type: object
    RegulatoryAppliesToWire:
      additionalProperties: false
      properties:
        institutionTypes:
          items:
            type: string
          type:
            - array
            - 'null'
      type: object
    RegulatoryLayoutWire:
      additionalProperties: false
      properties:
        mandatoryFrom:
          description: First data-base this layout applies to, as AAAA-MM-DD.
          examples:
            - '2026-01-01'
          type: string
        version:
          type: string
      type: object
    RegulatoryRuleDoesWire:
      additionalProperties: false
      properties:
        equals:
          examples:
            - debit
          type: string
        field:
          examples:
            - saldo
          type: string
        fields:
          description: The fields a unique check reads.
          examples:
            - - cosifCode
          items:
            type: string
          type:
            - array
            - 'null'
        key:
          examples:
            - cosifCode
          type: string
        kind:
          description: The rule kind.
          enum:
            - negateWhen
            - unique
            - notStartsWith
            - existsIn
            - equalsLookup
          examples:
            - negateWhen
          type: string
        rowSet:
          examples:
            - contas.yaml
          type: string
        table:
          examples:
            - natureza
          type: string
        values:
          items:
            type: string
          type:
            - array
            - 'null'
      required:
        - kind
      type: object
    RegulatoryRuleWhereWire:
      additionalProperties: false
      properties:
        equals:
          type: string
        field:
          type: string
        in:
          items:
            type: string
          type:
            - array
            - 'null'
        notIn:
          items:
            type: string
          type:
            - array
            - 'null'
        rowSet:
          description: A column of the published row set.
          type: string
      type: object
    RegulatoryFormatWire:
      additionalProperties: false
      properties:
        decimalSeparator:
          type: string
        groupSeparator:
          type: string
        pattern:
          type: string
        scale:
          format: int64
          type: integer
        scaleDeclared:
          type: boolean
        scaleIsExact:
          type: boolean
      required:
        - scaleDeclared
        - scaleIsExact
      type: object
  securitySchemes:
    BearerAuth:
      bearerFormat: JWT
      description: JWT bearer token issued by the identity provider.
      scheme: bearer
      type: http

````

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