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

# Create regulatory report

> Run the Motor 2 regulatory report workflow synchronously from a completed analysis and return the full report. Per COAF rule, the source analysis must have been created within the last 24 hours.



## OpenAPI

````yaml https://api.qa.nlbs.ai/api/openapi.json post /reports
openapi: 3.1.0
info:
  description: >-
    NL Labs AI AML API. Use Bearer API keys for protected endpoints. The /live
    and /ready probes are public.
  title: NL Labs AI
  version: 0.1.0
servers:
  - url: https://api.qa.nlbs.ai/api
security:
  - ApiKeyAuth: []
tags:
  - description: Runtime health checks and source freshness endpoints.
    name: health
  - description: Canonical entity lookup endpoints used before starting analyses.
    name: entities
  - description: AML analysis creation, status, result, and debug endpoints.
    name: analyses
  - description: Regulatory report (Motor 2) creation, status, result, and debug endpoints.
    name: reports
  - description: Versioned deterministic rules catalog endpoints.
    name: rules
  - description: Versioned regulatory reference catalog endpoints.
    name: regulatory
  - description: Webhook endpoint configuration and delivery-event operations.
    name: webhooks
paths:
  /reports:
    post:
      tags:
        - reports
      summary: Create regulatory report
      description: >-
        Run the Motor 2 regulatory report workflow synchronously from a
        completed analysis and return the full report. Per COAF rule, the source
        analysis must have been created within the last 24 hours.
      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: Missing, malformed, expired, or invalid Bearer API key.
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: The authenticated API key does not have the required scope.
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Source analysis was not found.
        '422':
          description: >-
            Invalid request body, path parameter, query parameter, or business
            rule.
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Report processing failed.
      security:
        - HTTPBearer: []
components:
  schemas:
    ReportCreateRequest:
      additionalProperties: false
      examples:
        - analysis_uuid: 018ffd38-6d94-7c0c-a6dd-2d9690a118f8
          institution_type: banco
          source: frontend
      properties:
        analysis_uuid:
          description: Source analysis UUID to build the report from.
          format: uuid
          title: Analysis Uuid
          type: string
        institution_type:
          $ref: '#/components/schemas/InstitutionType'
          description: >-
            Institution type selecting the sector norm (banco=BCB,
            seguradora=SUSEP).
        operation:
          anyOf:
            - $ref: '#/components/schemas/ReportOperationInput'
            - type: 'null'
          description: >-
            Optional COAF/COS filing data the analysis does not carry (reporting
            institution, transactional values, occurrence code, involved
            parties, related operations). When provided, the generated XML is
            complete; otherwise it is produced partially from analysis data.
        source:
          anyOf:
            - maxLength: 128
              type: string
            - type: 'null'
          description: Optional caller-defined source label.
          examples:
            - frontend
          title: Source
      required:
        - analysis_uuid
        - institution_type
      title: ReportCreateRequest
      type: object
    ReportResponse:
      description: >-
        Complete regulatory report returned by POST and GET /reports/{uuid}.


        A synchronously-returned report is always COMPLETED; failures do not
        persist, so the

        queue-lifecycle fields (status/error/timestamps) are dropped. `result`
        carries the XML/PDF

        storage references (bucket/key/uri) — artifacts live in MinIO, not
        inline in the response.
      properties:
        analysis_uuid:
          description: Source analysis UUID.
          format: uuid
          title: Analysis Uuid
          type: string
        institution_type:
          $ref: '#/components/schemas/InstitutionType'
          description: Institution type used.
        result:
          anyOf:
            - $ref: '#/components/schemas/ReportResult'
            - type: 'null'
          description: Complete assembled report result.
        uuid:
          description: Report execution UUID.
          format: uuid
          title: Uuid
          type: string
      required:
        - uuid
        - analysis_uuid
        - institution_type
        - result
      title: ReportResponse
      type: object
    ErrorResponse:
      properties:
        detail:
          description: Stable public error message.
          examples:
            - Resource not found.
          title: Detail
          type: string
      required:
        - detail
      title: ErrorResponse
      type: object
    InstitutionType:
      description: >-
        Type of supervised institution requesting the regulatory report.


        The institution type selects the applicable sector norm (regime) used
        when

        resolving regulatory references and prompting the narrative agent.
      enum:
        - banco
        - seguradora
      title: InstitutionType
      type: string
    ReportOperationInput:
      additionalProperties: false
      description: >-
        Optional operational data for the COAF/COS regulatory filing.


        The AML analysis does not carry these (reporting institution,
        transactional values,

        occurrence code, parties, related operations). When omitted, the XML is
        produced in a

        partial form from analysis data only.
      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
      description: >-
        Complete regulatory report assembled by the Motor 2 workflow.


        Each report topic is a ready-to-display PT-BR text string. The
        deterministic sections

        (§1, §2, §3, §7) are always present; the narrative sections (§4–§6) are
        ``None`` when the

        single narrative agent could not produce a valid result, with the
        matching limitation

        recorded in ``limitations``.
      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
      description: One involved party (Envolvido) of the COAF/COS communication.
      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
      description: One related operation (OperacaoRelacionada) of the communication.
      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
      description: >-
        Reference to the generated COAF/COS XML filing stored in object storage.


        Deterministic artifact. ``available`` is ``False`` only when no XML can
        be produced

        because the regime's official leiaute is not implemented yet (e.g.
        bank/BCB); the

        ``limitations`` explain why and the rest of the report is unaffected. A
        real

        serialization or storage-upload error is not represented here — it fails
        the step.

        ``limitations`` may also be non-empty on an available artifact when
        optional operation

        data was missing (partial filing).
      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:
          title: Format
          type: string
        limitations:
          items:
            $ref: '#/components/schemas/AnalysisLimitation'
          title: Limitations
          type: array
        regime:
          $ref: '#/components/schemas/RegulatoryRegime'
        storage_bucket:
          anyOf:
            - type: string
            - type: 'null'
          title: Storage Bucket
        storage_key:
          anyOf:
            - type: string
            - type: 'null'
          title: Storage Key
        storage_uri:
          anyOf:
            - type: string
            - type: 'null'
          title: Storage Uri
      required:
        - regime
        - format
        - available
      title: ReportXmlArtifact
      type: object
    AnalysisLimitation:
      additionalProperties: false
      description: >-
        Structured description of missing, partial, or constrained analysis
        data.
      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
      description: >-
        Reference to the generated human-readable PDF report stored in object
        storage.


        Presentation artifact (best-effort): ``available`` is ``False`` when the
        PDF could not be

        rendered or stored; in that case ``limitations`` explains why and the
        rest of the report

        (JSON + XML) is unaffected. The PDF is a rendering of the assembled
        report sections; it is

        not a regulatory filing.
      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
        storage_bucket:
          anyOf:
            - type: string
            - type: 'null'
          title: Storage Bucket
        storage_key:
          anyOf:
            - type: string
            - type: 'null'
          title: Storage Key
        storage_uri:
          anyOf:
            - type: string
            - type: 'null'
          title: Storage Uri
      required:
        - available
      title: ReportPdfArtifact
      type: object
    RegulatoryRegime:
      description: Sector regulatory regime selected from the institution type.
      enum:
        - BCB
        - SUSEP
      title: RegulatoryRegime
      type: string
    ReportVersions:
      additionalProperties: false
      description: Version identifiers recorded with the generated report.
      properties:
        model:
          anyOf:
            - type: string
            - type: 'null'
          title: Model
        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:
      description: Party type used by the COAF/COS communication (TipoPessoa).
      enum:
        - PF
        - PJ
      title: PersonType
      type: string
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key

````