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

# Preview the rows of a query of the mapping

> Reads the first rows ONE query of a mapping returns — the mapping as sent, saved or not, and never saved by this call — exactly as a generation reads it: planned against the subscription's pinned contract, with its filters (a parameter edge cut by the contract's calendar), joins, computed columns, aggregation and closed-set narrowing, scoped to the institution the subscription files for. The closed-period rule does not apply, so the current period can be previewed. At most `limit` rows (1 to 100, default 20) are answered; `hasMore` says the query has more. A query that reads another query's rows, a construct the engine does not execute, and the CRM source are refused. Previews share PREVIEW_MAX_CONCURRENT slots and answer 429 when they are busy. The body is capped at 1048576 bytes.



## OpenAPI

````yaml /es/openapi/v3-current/reporter.yaml post /v1/regulatory/subscriptions/{subscriptionId}/binding/preview
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}/binding/preview:
    post:
      tags:
        - Regulatory Bindings
      summary: Preview the rows of a query of the mapping
      description: >-
        Reads the first rows ONE query of a mapping returns — the mapping as
        sent, saved or not, and never saved by this call — exactly as a
        generation reads it: planned against the subscription's pinned contract,
        with its filters (a parameter edge cut by the contract's calendar),
        joins, computed columns, aggregation and closed-set narrowing, scoped to
        the institution the subscription files for. The closed-period rule does
        not apply, so the current period can be previewed. At most `limit` rows
        (1 to 100, default 20) are answered; `hasMore` says the query has more.
        A query that reads another query's rows, a construct the engine does not
        execute, and the CRM source are refused. Previews share
        PREVIEW_MAX_CONCURRENT slots and answer 429 when they are busy. The body
        is capped at 1048576 bytes.
      operationId: previewRegulatoryBindingQuery
      parameters:
        - description: Unique subscription identifier.
          example: 00000000-0000-0000-0000-000000000000
          in: path
          name: subscriptionId
          required: true
          schema:
            description: Unique subscription identifier.
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PreviewBindingQueryInput'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BindingPreview'
          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
        '413':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Request Entity Too Large
        '422':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Unprocessable Entity
        '429':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Too Many Requests
        '500':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Internal Server Error
components:
  schemas:
    PreviewBindingQueryInput:
      additionalProperties: false
      properties:
        binding:
          description: >-
            The whole mapping, as YAML, exactly as a save would send it. It is
            planned against the subscription's pinned contract and NEVER saved.
          examples:
            - |
              contract: br.example.document
              queries: []
          type: string
        limit:
          description: 'How many rows to answer, 1 to 100. Absent: 20.'
          examples:
            - 20
          format: int64
          type: integer
        parameters:
          additionalProperties:
            type: string
          description: >-
            Generation parameters the query's filters read, as a generation
            would be given them. Only the ones supplied are validated; the
            closed-period rule does not apply to a preview.
          type: object
        query:
          description: The query of the mapping to read.
          examples:
            - saldos
          type: string
      required:
        - binding
        - query
      type: object
    BindingPreview:
      additionalProperties: false
      properties:
        columns:
          description: >-
            The columns the query answers, in order: its groups then its sums
            when it aggregates; the columns it selects, else the ones it reads,
            when it does not.
          examples:
            - - cosif
              - natureza
              - saldo
          items:
            type: string
          type:
            - array
            - 'null'
        durationMs:
          description: How long the read took.
          examples:
            - 41
          format: int64
          type: integer
        hasMore:
          description: >-
            True when the query has more rows than the limit; the rows were cut,
            never refused.
          examples:
            - false
          type: boolean
        limit:
          description: The limit applied.
          examples:
            - 20
          format: int64
          type: integer
        query:
          description: The query read.
          examples:
            - saldos
          type: string
        rows:
          description: >-
            At most limit rows, each keyed by the columns above. A number is its
            decimal text, never a float; null is null.
          items:
            additionalProperties: {}
            type: object
          type:
            - array
            - 'null'
      required:
        - query
        - columns
        - rows
        - limit
        - hasMore
        - durationMs
      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
    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
  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.