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

# Criar relatório regulatório

> Roda o workflow de relatório regulatório de forma síncrona a partir de uma análise concluída e retorna o relatório completo. Por norma COAF, a análise-fonte precisa ter sido criada nas últimas 24 horas.



## OpenAPI

````yaml POST /reports
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:
    post:
      tags:
        - reports
      summary: Criar relatório regulatório
      description: >-
        Roda o workflow de relatório regulatório de forma síncrona a partir de
        uma análise concluída e retorna o relatório completo. Por norma COAF, a
        análise-fonte precisa ter sido criada nas últimas 24 horas.
      operationId: create_report
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ReportCreateRequest'
        required: true
      responses:
        '201':
          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: >-
            Escopo necessário ausente, ou o plano atual não inclui esse recurso
            (detail: "feature_not_in_plan").
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Análise-fonte não encontrada.
        '422':
          description: >-
            Corpo da requisição, parâmetro de rota, parâmetro de query ou regra
            de negócio inválidos.
        '429':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: >-
            Limite de uso (quota) do período de faturamento excedido (detail:
            "quota_exceeded").
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: O processamento do relatório falhou.
components:
  schemas:
    ReportCreateRequest:
      additionalProperties: false
      examples:
        - analysis_uuid: 018ffd38-6d94-7c0c-a6dd-2d9690a118f8
          institution_type: banco
          source: frontend
      properties:
        analysis_uuid:
          description: UUID da análise-fonte para gerar o relatório.
          format: uuid
          title: Analysis Uuid
          type: string
        institution_type:
          $ref: '#/components/schemas/InstitutionType'
          description: >-
            Tipo de instituição, seleciona a norma setorial (banco=BCB,
            seguradora=SUSEP).
        operation:
          anyOf:
            - $ref: '#/components/schemas/ReportOperationInput'
            - type: 'null'
          description: >-
            Dados opcionais da comunicação COAF/COS que a análise não carrega
            (instituição comunicante, valores da operação, código de ocorrência,
            envolvidos, operações relacionadas). Quando informado, o XML gerado
            é completo; caso contrário, é produzido de forma parcial a partir
            dos dados da análise.
        source:
          anyOf:
            - maxLength: 128
              type: string
            - type: 'null'
          description: Identificador livre da origem da chamada, opcional.
          examples:
            - frontend
          title: Source
      required:
        - analysis_uuid
        - institution_type
      title: ReportCreateRequest
      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
    ReportOperationInput:
      additionalProperties: false
      properties:
        abroad_indicator:
          default: false
          title: Abroad Indicator
          type: boolean
        additional_info:
          anyOf:
            - type: string
            - type: 'null'
          title: Additional Info
        batch_number:
          anyOf:
            - type: string
            - type: 'null'
          title: Batch Number
        communicant_document:
          anyOf:
            - type: string
            - type: 'null'
          title: Communicant Document
        communicant_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Communicant Name
        currency:
          default: BRL
          title: Currency
          type: string
        decision_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Decision At
        detection_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Detection At
        environment:
          default: HOMOLOGACAO
          title: Environment
          type: string
        fact_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Fact At
        involved:
          items:
            $ref: '#/components/schemas/ReportInvolvedParty'
          title: Involved
          type: array
        layout_version:
          default: '1.0'
          title: Layout Version
          type: string
        occurrence_code:
          anyOf:
            - type: string
            - type: 'null'
          title: Occurrence Code
        occurrence_description:
          anyOf:
            - type: string
            - type: 'null'
          title: Occurrence Description
        operation_value:
          anyOf:
            - minimum: 0
              type: number
            - pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
              type: string
            - type: 'null'
          title: Operation Value
        origin_number:
          anyOf:
            - type: string
            - type: 'null'
          title: Origin Number
        payment_channel:
          anyOf:
            - type: string
            - type: 'null'
          title: Payment Channel
        product:
          anyOf:
            - type: string
            - type: 'null'
          title: Product
        refund_value:
          anyOf:
            - minimum: 0
              type: number
            - pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
              type: string
            - type: 'null'
          title: Refund Value
        related_operations:
          items:
            $ref: '#/components/schemas/ReportRelatedOperation'
          title: Related Operations
          type: array
      title: ReportOperationInput
      type: object
    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
    ReportInvolvedParty:
      additionalProperties: false
      properties:
        document:
          minLength: 1
          title: Document
          type: string
        involvement_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Involvement Type
        name:
          minLength: 1
          title: Name
          type: string
        pep:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Pep
        person_type:
          $ref: '#/components/schemas/PersonType'
      required:
        - name
        - document
        - person_type
      title: ReportInvolvedParty
      type: object
    ReportRelatedOperation:
      additionalProperties: false
      properties:
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
        occurred_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Occurred At
        operation_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Operation Type
        reference:
          minLength: 1
          title: Reference
          type: string
        value:
          anyOf:
            - minimum: 0
              type: number
            - pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
              type: string
            - type: 'null'
          title: Value
      required:
        - reference
      title: ReportRelatedOperation
      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
    PersonType:
      enum:
        - PF
        - PJ
      title: PersonType
      type: string
    ReportXmlFormat:
      enum:
        - susep_cos
        - bcb_coaf
      title: ReportXmlFormat
      type: string

````