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

# Regenerar parágrafos do relatório produzidos por agente

> Reexecuta de forma síncrona a etapa de agente que produziu parágrafos específicos de um relatório já gerado, sem reexecutar o workflow inteiro, e retorna o relatório atualizado completo. Apenas parágrafos produzidos por agente são regeneráveis (hoje: 'enquadramento_suggestion', 'legal_basis', 'coaf_communication_draft'); seções determinísticas são rejeitadas. Validação é tudo-ou-nada: qualquer parágrafo inválido rejeita a requisição e nada é regenerado. Apenas os parágrafos solicitados são substituídos no resultado persistido; as demais seções e os artefatos XML/PDF gerados são mantidos como produzidos originalmente.



## OpenAPI

````yaml POST /reports/{report_uuid}/paragraphs/regenerate
openapi: 3.1.0
info:
  description: Superfície pública da API para clientes autenticados por chave de API.
  title: NL Labs Gateway (Public API)
  version: 0.1.0
servers:
  - url: https://api.nlbs.ai
security: []
tags:
  - description: Busca de entidades canônicas.
    name: entities
  - description: Criação, leitura, grafo e dossiê de análises.
    name: analyses
  - description: Relatório regulatório (COAF/SUSEP).
    name: reports
  - description: Triagem de mídia adversa.
    name: adverse-media
  - description: Versões do manifesto regulatório.
    name: regulatory
  - description: Versões do catálogo de regras do motor de risco.
    name: rules
  - description: Endpoints e eventos de webhook.
    name: webhooks
  - description: >-
      Entrypoints HTTP de workflow: invocar um workflow e consultar sua
      execução.
    name: workflow-endpoints
paths:
  /reports/{report_uuid}/paragraphs/regenerate:
    post:
      tags:
        - reports
      summary: Regenerar parágrafos do relatório produzidos por agente
      description: >-
        Reexecuta de forma síncrona a etapa de agente que produziu parágrafos
        específicos de um relatório já gerado, sem reexecutar o workflow
        inteiro, e retorna o relatório atualizado completo. Apenas parágrafos
        produzidos por agente são regeneráveis (hoje:
        'enquadramento_suggestion', 'legal_basis', 'coaf_communication_draft');
        seções determinísticas são rejeitadas. Validação é tudo-ou-nada:
        qualquer parágrafo inválido rejeita a requisição e nada é regenerado.
        Apenas os parágrafos solicitados são substituídos no resultado
        persistido; as demais seções e os artefatos XML/PDF gerados são mantidos
        como produzidos originalmente.
      operationId: regenerate_report_paragraphs
      parameters:
        - description: UUID de execução do relatório.
          in: path
          name: report_uuid
          required: true
          schema:
            description: UUID de execução do relatório.
            format: uuid
            title: Report Uuid
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ReportParagraphsRegenerateRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReportResponse'
          description: Successful Response
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Chave de API ausente, malformada, expirada ou inválida.
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: A chave de API autenticada não tem o escopo necessário.
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Relatório não encontrado para o cliente autenticado.
        '422':
          description: >-
            Corpo da requisição, parâmetro de rota, parâmetro de query ou regra
            de negócio inválidos.
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: O processamento do relatório falhou.
components:
  schemas:
    ReportParagraphsRegenerateRequest:
      additionalProperties: false
      examples:
        - paragraphs:
            - enquadramento_suggestion
            - coaf_communication_draft
      properties:
        paragraphs:
          description: >-
            Identificadores dos parágrafos produzidos por agente a regenerar —
            chaves das seções do resultado do relatório (ex.:
            'enquadramento_suggestion', 'legal_basis',
            'coaf_communication_draft'). Seções determinísticas não são
            regeneráveis.
          items:
            type: string
          minItems: 1
          title: Paragraphs
          type: array
      required:
        - paragraphs
      title: ReportParagraphsRegenerateRequest
      type: object
    ReportResponse:
      properties:
        analysis_uuid:
          description: UUID da análise-fonte.
          format: uuid
          title: Analysis Uuid
          type: string
        institution_type:
          $ref: '#/components/schemas/InstitutionType'
          description: Tipo de instituição usado.
        result:
          anyOf:
            - $ref: '#/components/schemas/ReportResult'
            - type: 'null'
          description: Resultado completo do relatório montado.
        uuid:
          description: UUID de execução do relatório.
          format: uuid
          title: Uuid
          type: string
      required:
        - uuid
        - analysis_uuid
        - institution_type
        - result
      title: ReportResponse
      type: object
    ErrorResponse:
      properties:
        detail:
          description: Mensagem de erro pública e estável.
          examples:
            - Resource not found.
          title: Detail
          type: string
      required:
        - detail
      title: ErrorResponse
      type: object
    InstitutionType:
      enum:
        - banco
        - seguradora
      title: InstitutionType
      type: string
    ReportResult:
      additionalProperties: false
      properties:
        audit_trail:
          title: Audit Trail
          type: string
        coaf_communication_draft:
          anyOf:
            - type: string
            - type: 'null'
          title: Coaf Communication Draft
        coaf_xml:
          anyOf:
            - $ref: '#/components/schemas/ReportXmlArtifact'
            - type: 'null'
        consolidated_risk_signals:
          title: Consolidated Risk Signals
          type: string
        counterparty_identification:
          title: Counterparty Identification
          type: string
        enquadramento_suggestion:
          anyOf:
            - type: string
            - type: 'null'
          title: Enquadramento Suggestion
        institution_type:
          $ref: '#/components/schemas/InstitutionType'
        legal_basis:
          anyOf:
            - type: string
            - type: 'null'
          title: Legal Basis
        limitations:
          items:
            $ref: '#/components/schemas/AnalysisLimitation'
          title: Limitations
          type: array
        ownership_and_ubo:
          title: Ownership And Ubo
          type: string
        pdf:
          anyOf:
            - $ref: '#/components/schemas/ReportPdfArtifact'
            - type: 'null'
        regime:
          $ref: '#/components/schemas/RegulatoryRegime'
        source_analysis_uuid:
          format: uuid
          title: Source Analysis Uuid
          type: string
        versions:
          $ref: '#/components/schemas/ReportVersions'
      required:
        - source_analysis_uuid
        - institution_type
        - regime
        - counterparty_identification
        - ownership_and_ubo
        - consolidated_risk_signals
        - audit_trail
        - versions
      title: ReportResult
      type: object
    ReportXmlArtifact:
      additionalProperties: false
      properties:
        available:
          title: Available
          type: boolean
        byte_size:
          anyOf:
            - minimum: 0
              type: integer
            - type: 'null'
          title: Byte Size
        content_type:
          default: application/xml
          title: Content Type
          type: string
        filename:
          anyOf:
            - type: string
            - type: 'null'
          title: Filename
        format:
          $ref: '#/components/schemas/ReportXmlFormat'
        limitations:
          items:
            $ref: '#/components/schemas/AnalysisLimitation'
          title: Limitations
          type: array
        regime:
          $ref: '#/components/schemas/RegulatoryRegime'
      required:
        - regime
        - format
        - available
      title: ReportXmlArtifact
      type: object
    AnalysisLimitation:
      additionalProperties: false
      properties:
        code:
          minLength: 1
          pattern: ^[a-z][a-z0-9_]*$
          title: Code
          type: string
        details:
          additionalProperties: true
          title: Details
          type: object
        entity_id:
          anyOf:
            - exclusiveMinimum: 0
              type: integer
            - type: 'null'
          title: Entity Id
        message:
          minLength: 1
          title: Message
          type: string
      required:
        - code
        - message
      title: AnalysisLimitation
      type: object
    ReportPdfArtifact:
      additionalProperties: false
      properties:
        available:
          title: Available
          type: boolean
        byte_size:
          anyOf:
            - minimum: 0
              type: integer
            - type: 'null'
          title: Byte Size
        content_type:
          default: application/pdf
          title: Content Type
          type: string
        filename:
          anyOf:
            - type: string
            - type: 'null'
          title: Filename
        limitations:
          items:
            $ref: '#/components/schemas/AnalysisLimitation'
          title: Limitations
          type: array
      required:
        - available
      title: ReportPdfArtifact
      type: object
    RegulatoryRegime:
      enum:
        - BCB
        - SUSEP
      title: RegulatoryRegime
      type: string
    ReportVersions:
      additionalProperties: false
      properties:
        narrative_prompt_version:
          anyOf:
            - type: string
            - type: 'null'
          title: Narrative Prompt Version
        regulatory_catalog_version:
          minLength: 1
          title: Regulatory Catalog Version
          type: string
        report_workflow_version:
          minLength: 1
          title: Report Workflow Version
          type: string
        source_analysis_workflow_version:
          anyOf:
            - type: string
            - type: 'null'
          title: Source Analysis Workflow Version
      required:
        - report_workflow_version
        - regulatory_catalog_version
      title: ReportVersions
      type: object
    ReportXmlFormat:
      enum:
        - susep_cos
        - bcb_coaf
      title: ReportXmlFormat
      type: string

````