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

# Finalize Report

> Re-validate, then render the goAML XML and PDF and upload both to S3. On SAR/STR/TFR reports, this also moves the case's transaction alerts from Pending SAR to SAR filed.

export const AgentPromptAccordion = ({prompt, title = "AI Agent Integration Prompt"}) => {
  const [copied, setCopied] = React.useState(false);
  const handleCopy = e => {
    e.stopPropagation();
    if (!prompt) return;
    navigator.clipboard.writeText(prompt.trim()).then(() => {
      setCopied(true);
      setTimeout(() => setCopied(false), 2000);
    });
  };
  const agents = ["Claude Code", "Codex", "Cursor", "Devin", "Windsurf", "GitHub Copilot"];
  return <div className="didit-agent-card">
      {}
      <div className="didit-agent-titlebar">
        <div className="didit-agent-dots" aria-hidden="true">
          <span className="didit-agent-dot didit-agent-dot-red"></span>
          <span className="didit-agent-dot didit-agent-dot-yellow"></span>
          <span className="didit-agent-dot didit-agent-dot-green"></span>
        </div>
        <span className="didit-agent-filename">{title}</span>
        <button type="button" className={`didit-agent-copy ${copied ? "didit-agent-copy-copied" : ""}`} onClick={handleCopy} title="Copy prompt to clipboard" aria-label={copied ? "Copied!" : "Copy prompt to clipboard"}>
          {copied ? <>
              <svg width="13" height="13" viewBox="0 0 16 16" fill="none">
                <path d="M3 8.5l3.5 3.5L13 4" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" />
              </svg>
              <span>Copied</span>
            </> : <>
              <svg width="13" height="13" viewBox="0 0 16 16" fill="none">
                <rect x="5" y="5" width="9" height="9" rx="1.5" stroke="currentColor" strokeWidth="1.5" />
                <path d="M11 5V3.5A1.5 1.5 0 0 0 9.5 2h-6A1.5 1.5 0 0 0 2 3.5v6A1.5 1.5 0 0 0 3.5 11H5" stroke="currentColor" strokeWidth="1.5" />
              </svg>
              <span>Copy</span>
            </>}
        </button>
      </div>

      {}
      <pre className="didit-agent-body"><code>{prompt.trim()}</code></pre>

      {}
      <div className="didit-agent-footer">
        <span className="didit-agent-footer-label">Paste into</span>
        <div className="didit-agent-chips">
          {agents.map(name => <span key={name} className="didit-agent-chip">{name}</span>)}
        </div>
      </div>
    </div>;
};

<AgentPromptAccordion
  title="Finalize Report API Prompt"
  prompt={`Finalize a FIU report through the Management API.

Endpoint:
POST https://verification.didit.me/v3/organization/{organization_id}/application/{application_id}/regulatory-reports/{report_uuid}/finalize/

Authentication:
Use the x-api-key header with my Didit API key.

Goal:
- Re-validate the report, then render the goAML XML and a PDF, upload both to S3, and mark the report FINALIZED (irreversible - no further edits or deletes).
- On SAR, STR, and TFR reports, this also moves the case's transaction alerts from Pending SAR to SAR filed.

Example call:
curl -X POST "https://verification.didit.me/v3/organization/{organization_id}/application/{application_id}/regulatory-reports/{report_uuid}/finalize/" \\
-H "x-api-key: YOUR_API_KEY"

Response 200: RegulatoryReportDetail with status "FINALIZED", finalized_at set. Fetch files via GET .../download-url/?file=xml|pdf.

Failure modes:
- 400 - validation failed: {"detail": "Report failed validation.", "errors": [{"field": "rentity_id", "message": "Reporting entity ID is required."}, ...]}. errors is an array of {field, message} objects.
- 409 - report is not in a finalizable state (e.g. already finalized).
- 401/403 - auth/permission errors (requires write:cases).

Side effects: generates and stores XML + PDF in S3; updates linked transaction alerts' SAR-filed marking; irreversible.

For the full integration shape, see /integration/integration-prompt.`}
/>

Finalize a report. This is the point of no return, a finalized report cannot be edited or deleted, only downloaded.

## Related

* [Download report](/management-api/regulatory-reports/download-url)
* [Validate report](/management-api/regulatory-reports/validate)
* [Print case](/management-api/cases/print)


## OpenAPI

````yaml POST /v3/organization/{organization_id}/application/{application_id}/regulatory-reports/{report_uuid}/finalize/
openapi: 3.0.0
info:
  version: 3.0.0
  title: Didit Verification API
  description: Identity verification API. Authenticate with x-api-key header.
servers:
  - url: https://verification.didit.me
security: []
tags: []
paths:
  /v3/organization/{organization_id}/application/{application_id}/regulatory-reports/{report_uuid}/finalize/:
    post:
      tags:
        - Regulatory Reports
      summary: Finalize report
      description: >-
        Re-validate, then render the goAML XML and PDF and upload both to S3. On
        SAR/STR/TFR reports, this also moves the case's transaction alerts from
        Pending SAR to SAR filed.
      operationId: finalize_regulatory_report
      parameters:
        - name: organization_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: Organization UUID.
        - name: application_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: Application UUID.
        - name: report_uuid
          in: path
          required: true
          schema:
            type: string
            format: uuid
            example: 5ec00000-0000-4000-8000-000000000007
          description: Report UUID.
      responses:
        '200':
          description: Report finalized; xml_s3_key and pdf_s3_key are set.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RegulatoryReportDetail'
        '400':
          description: Report failed validation.
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                  errors:
                    type: array
                    items:
                      type: object
                      properties:
                        field:
                          type: string
                        message:
                          type: string
        '409':
          description: Report is not in a finalizable state.
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
      x-codeSamples:
        - lang: curl
          label: curl
          source: >-
            curl -X POST
            'https://verification.didit.me/v3/organization/11111111-2222-3333-4444-555555555555/application/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee/regulatory-reports/5ec00000-0000-4000-8000-000000000007/finalize/'
            \
              -H 'x-api-key: YOUR_API_KEY'
        - lang: python
          label: Python
          source: |-
            import os

            import requests

            resp = requests.post(
                'https://verification.didit.me/v3/organization/11111111-2222-3333-4444-555555555555/application/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee/regulatory-reports/5ec00000-0000-4000-8000-000000000007/finalize/',
                headers={'x-api-key': os.environ['DIDIT_API_KEY']},
                timeout=30,
            )
            if resp.status_code == 400:
                print('Validation failed:', resp.json()['errors'])
            else:
                resp.raise_for_status()
                report = resp.json()
                print(report['status'], report['report_number'])
components:
  schemas:
    RegulatoryReportDetail:
      type: object
      properties:
        uuid:
          type: string
          format: uuid
        case_uuid:
          type: string
          format: uuid
        case_number:
          type: string
          nullable: true
        report_type:
          type: string
          enum:
            - SAR
            - STR
            - CTR
            - TTR
            - UTR
            - IFT
            - CBR
            - TFR
        report_type_display:
          type: string
        report_code:
          type: string
          description: goAML report code derived from report_type, e.g. STR, CTR, BCR.
        report_number:
          type: string
          nullable: true
        status:
          type: string
          enum:
            - DRAFT
            - VALIDATED
            - FINALIZED
        status_display:
          type: string
        jurisdiction:
          type: string
          minLength: 2
          maxLength: 2
        rentity_id:
          type: string
          nullable: true
          description: Reporting entity ID issued by the FIU.
        rentity_branch:
          type: string
          nullable: true
        submission_code:
          type: string
          enum:
            - E
            - M
        entity_reference:
          type: string
          nullable: true
        fiu_ref_number:
          type: string
          nullable: true
        currency_code_local:
          type: string
          minLength: 3
          maxLength: 3
          nullable: true
        submission_date:
          type: string
          format: date-time
          nullable: true
        reporting_person:
          type: object
        location:
          type: object
        reason:
          type: string
          nullable: true
        action:
          type: string
          nullable: true
        activity:
          type: string
          nullable: true
        narrative:
          type: object
          description: Five Ws narrative sections.
          properties:
            who:
              type: string
            what:
              type: string
            when:
              type: string
            where:
              type: string
            why:
              type: string
            how:
              type: string
        report_indicators:
          type: array
          items:
            type: string
        included_fields:
          type: array
          items:
            type: string
        transactions:
          type: array
          items:
            type: string
            format: uuid
        validation_errors:
          type: array
          description: >-
            Result of the most recent validation; each entry is a {field,
            message} object.
          items:
            type: object
            properties:
              field:
                type: string
              message:
                type: string
        validated_at:
          type: string
          format: date-time
          nullable: true
        finalized_at:
          type: string
          format: date-time
          nullable: true
        created_by_email:
          type: string
          nullable: true
        created_by_name:
          type: string
          nullable: true
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time

````