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

# Reconciliar com o BI

> As linhas atribuídas do período contra o arquivo do seu BI, linha a linha, com o desvio nas linhas que os dois lados conhecem.



## OpenAPI

````yaml openapi/pt/cell.json POST /v1/measure/reconcile
openapi: 3.1.0
info:
  title: API de dados da Niadra
  version: '1'
  description: >-
    Escrita, contexto, histórico, objetos, identidade, privacidade e governança
    de um espaço. Cada espaço tem um endereço estável, com o espaço e a região
    no nome.
servers:
  - url: https://{space}.{region}.api.niadra.com
    variables:
      space:
        default: acme-prod
        description: O espaço, que vem na chave de fonte.
      region:
        default: us-east-2
        description: A região do espaço, que também vem na chave.
security: []
paths:
  /v1/measure/reconcile:
    post:
      tags:
        - signals
      summary: Reconciliar com o BI
      description: >-
        As linhas atribuídas do período contra o arquivo do BI da empresa, linha
        a linha, com o desvio guardado.


        **Autenticação.** Token de pessoa do Console com o papel `analysis` (ou
        admin), ou chave de fonte com o escopo `admin`. Só responde num espaço
        com a funcionalidade `measurement` ligada (o documento `features`); num
        espaço sem ela, 404.
      operationId: reconcile_v1_measure_reconcile_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ReconcileRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReconcileResult'
          description: Resposta de sucesso.
        '422':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
          description: O pedido não bate com o contrato.
      security:
        - sourceKey: []
        - personToken: []
components:
  schemas:
    ReconcileRequest:
      additionalProperties: false
      properties:
        file:
          $ref: '#/components/schemas/BiFile'
        since:
          format: date
          title: Since
          type: string
        until:
          format: date
          title: Until
          type: string
      required:
        - since
        - until
        - file
      title: ReconcileRequest
      type: object
    ReconcileResult:
      additionalProperties: false
      description: >-
        O nosso valor de cada linha contra o do BI, nas linhas que os dois
        conhecem; linhas que só um lado conhece são contadas à parte e nunca
        entram no desvio.
      properties:
        bi_minor:
          title: Bi Minor
          type: integer
        currency:
          anyOf:
            - type: string
            - type: 'null'
          title: Currency
        deviation:
          anyOf:
            - type: number
            - type: 'null'
          description: '|nosso - BI| / BI nas linhas que os dois conhecem.'
          title: Deviation
        matched:
          title: Matched
          type: integer
        only_bi:
          title: Only Bi
          type: integer
        only_ours:
          title: Only Ours
          type: integer
        ours_minor:
          title: Ours Minor
          type: integer
        report_id:
          maxLength: 512
          minLength: 1
          title: Report Id
          type: string
        tolerance:
          title: Tolerance
          type: number
        within_tolerance:
          title: Within Tolerance
          type: boolean
        worst:
          description: As linhas que mais divergem.
          items:
            $ref: '#/components/schemas/ReconciledLine'
          title: Worst
          type: array
      required:
        - report_id
        - deviation
        - tolerance
        - within_tolerance
        - matched
        - only_ours
        - only_bi
        - ours_minor
        - bi_minor
      title: ReconcileResult
      type: object
    Problem:
      additionalProperties: false
      description: >-
        Detalhes do problema no formato da RFC 9457; `code` vem do catálogo de
        erros versionado.
      properties:
        code:
          title: Code
          type: string
        detail:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Detail
        request_id:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Request Id
        status:
          title: Status
          type: integer
        title:
          title: Title
          type: string
        type:
          default: about:blank
          title: Type
          type: string
      required:
        - title
        - status
        - code
      title: Problem
      type: object
    BiFile:
      additionalProperties: false
      description: >-
        A exportação do BI da empresa para o período, enviada antes (`POST
        /v1/measure/reconcile/uploads`), em CSV com cabeçalho: `order` (o id
        pelo qual a empresa conhece o objeto), `line` (opcional), `value` (em
        unidades maiores, como a definição assinada o líquida) e `currency`. É
        lida uma vez e apagada.
      properties:
        format:
          const: csv
          default: csv
          title: Format
          type: string
        upload_id:
          format: uuid
          title: Upload Id
          type: string
      required:
        - upload_id
      title: BiFile
      type: object
    ReconciledLine:
      additionalProperties: false
      properties:
        bi_minor:
          title: Bi Minor
          type: integer
        line:
          title: Line
          type: string
        order:
          maxLength: 512
          minLength: 1
          title: Order
          type: string
        ours_minor:
          title: Ours Minor
          type: integer
      required:
        - order
        - line
        - ours_minor
        - bi_minor
      title: ReconciledLine
      type: object
  securitySchemes:
    sourceKey:
      type: http
      scheme: bearer
      description: nia_sk_...
    personToken:
      type: http
      scheme: bearer
      bearerFormat: JWT

````