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

# Read what a report was made of, frozen

> Answers the report's provenance: which document at which pinned version, under which subscription, with which binding version and generation parameters, and the SHA-256 of the artifact that was stored. It is what answers, months later, why the filing says what it says — and whether the file in hand is the file that was approved. A custom report has none and answers 404.



## OpenAPI

````yaml /pt/openapi/v3-current/reporter.yaml get /v1/regulatory/reports/{reportId}/provenance
openapi: 3.1.0
info:
  contact:
    name: Discord community
    url: https://discord.gg/DnhqKwkGv3
  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: http://localhost:4005
  - url: https://localhost:4005
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/reports/{reportId}/provenance:
    get:
      tags:
        - Regulatory Reports
      summary: Read what a report was made of, frozen
      description: >-
        Answers the report's provenance: which document at which pinned version,
        under which subscription, with which binding version and generation
        parameters, and the SHA-256 of the artifact that was stored. It is what
        answers, months later, why the filing says what it says — and whether
        the file in hand is the file that was approved. A custom report has none
        and answers 404.
      operationId: getRegulatoryProvenance
      parameters:
        - description: Report identifier.
          example: 00000000-0000-0000-0000-000000000001
          in: path
          name: reportId
          required: true
          schema:
            description: Report identifier.
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Provenance'
          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:
    Provenance:
      additionalProperties: false
      description: >-
        Everything a report was made of, frozen at generation. Exactly one
        origin is present: `catalog` for a filing produced from a curated
        regulatory document, `template` for one produced from a template whose
        category makes it regulatory. A record carrying both, or neither, does
        not exist — it is refused before it is stored.
      oneOf:
        - required:
            - catalog
        - required:
            - template
      properties:
        artifactChecksum:
          description: SHA-256 of the artifact, hex.
          examples:
            - e3b0c44298fc1c149afbf4c8996fb924...
          type: string
        artifactSizeBytes:
          description: Size of the stored artifact in bytes.
          examples:
            - 20480
          format: int64
          type: integer
        catalog:
          $ref: '#/components/schemas/CatalogOrigin'
        generatedAt:
          format: date-time
          type: string
        parameters:
          additionalProperties:
            type: string
          description: Generation parameters as supplied.
          examples:
            - dataBase: 2026-03
          type: object
        template:
          $ref: '#/components/schemas/TemplateOrigin'
      required:
        - generatedAt
      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
    CatalogOrigin:
      additionalProperties: false
      properties:
        bindingVersion:
          description: Version of the binding the report was generated from.
          examples:
            - 3
          format: int64
          type: integer
        documentId:
          description: Curated document this report files.
          examples:
            - br.bcb.cadoc-4010
          type: string
        documentVersion:
          description: Catalog version of the document in force when it was generated.
          examples:
            - 1.0.0
          type: string
        institution:
          $ref: '#/components/schemas/InstitutionSnapshot'
          description: >-
            Institution the filing declares for, as frozen when it was
            requested. Absent on a filing generated before filings named an
            institution.
        subscriptionId:
          type: string
      required:
        - documentId
        - documentVersion
        - subscriptionId
        - bindingVersion
      type: object
    TemplateOrigin:
      additionalProperties: false
      properties:
        category:
          description: Template category, which is what makes the filing regulatory.
          examples:
            - cadoc4010
          type: string
        revision:
          description: Revision of the template the report was generated from.
          examples:
            - 4
          format: int64
          type: integer
        revisionChecksum:
          description: SHA-256 of the template revision used.
          examples:
            - 9f2c...
          type: string
        templateId:
          description: Template this report was generated from.
          examples:
            - 7c1e2f40-77d1-4a8a-9d0f-6b0e2c4a1111
          type: string
      required:
        - templateId
        - category
        - revision
        - revisionChecksum
      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
    InstitutionSnapshot:
      additionalProperties: false
      properties:
        cnpj:
          description: CNPJ of the institution when the report was requested.
          examples:
            - 12ABC34501DE35
          type: string
        id:
          description: Identifier of the institution the report reads for.
          examples:
            - 00000000-0000-0000-0000-000000000000
          type: string
        name:
          description: Name of the institution when the report was requested.
          examples:
            - Banco Exemplo S.A.
          type: string
        scope:
          additionalProperties:
            $ref: '#/components/schemas/DataSourceScope'
          description: >-
            The part of the institution's scope the report applied: each data
            source and table it reads, keyed as the template maps them.
          type: object
      required:
        - id
        - name
        - cnpj
        - scope
      type: object
    DataSourceScope:
      additionalProperties: false
      properties:
        tables:
          additionalProperties:
            $ref: '#/components/schemas/TableScope'
          description: >-
            The tables of the data source the institution reads, keyed by table
            name; empty when it owns the whole data source.
          type: object
        whole:
          description: The institution owns every table of the data source.
          examples:
            - false
          type: boolean
      required:
        - whole
        - tables
      type: object
    TableScope:
      additionalProperties: false
      properties:
        conditions:
          additionalProperties:
            $ref: '#/components/schemas/FilterCondition'
          description: >-
            Conditions a row must meet to belong to the institution, keyed by
            field, in the report filter vocabulary; at least one is eq or in,
            and the others may narrow with any operator. Empty on a shared
            table.
          examples:
            - organization_id:
                eq:
                  - 00000000-0000-0000-0000-000000000000
          type: object
        shared:
          description: The table is reference data every institution reads whole.
          examples:
            - false
          type: boolean
      required:
        - shared
        - conditions
      type: object
    FilterCondition:
      properties:
        between:
          description: Inclusive lower and upper bounds for a range match.
          examples:
            - - 100
              - 1000
          items: {}
          type:
            - array
            - 'null'
        eq:
          description: Values matched for equality; multiple values are combined with OR.
          examples:
            - - active
              - pending
          items: {}
          type:
            - array
            - 'null'
        gt:
          description: Single lower-bound value that the field must exceed.
          examples:
            - - 100
          items: {}
          type:
            - array
            - 'null'
        gte:
          description: Single inclusive lower-bound value for the field.
          examples:
            - - '2025-06-01'
          items: {}
          type:
            - array
            - 'null'
        in:
          description: Values for which the field may match any member of the list.
          examples:
            - - active
              - pending
              - suspended
          items: {}
          type:
            - array
            - 'null'
        lt:
          description: Single upper-bound value that the field must remain below.
          examples:
            - - 1000
          items: {}
          type:
            - array
            - 'null'
        lte:
          description: Single inclusive upper-bound value for the field.
          examples:
            - - '2025-06-30'
          items: {}
          type:
            - array
            - 'null'
        nin:
          description: Values excluded from matching records.
          examples:
            - - deleted
              - archived
          items: {}
          type:
            - array
            - 'null'
      type: object
  securitySchemes:
    BearerAuth:
      bearerFormat: JWT
      description: JWT bearer token issued by the identity provider.
      scheme: bearer
      type: http

````