Skip to main content

Export report to PDF

The Export Report to PDF endpoint exports a generated mortgage report to PDF format and returns a downloadable PDF file URL.

Request


  • Type: POST
  • Path: /engine/export-report-pdf

Endpoint

The Export Report to PDF endpoint can be accessed from the following URLs:

Environment Endpoint URL
Test https://api.mre.test.blackfin.tools/engine/export-report-pdf
Production https://api.mre.blackfin.tools/engine/export-report-pdf (NOT LIVE)


Authentication

An API_Key is required to call this endpoint. HTTP Bearer Token authentication is used.


JSON Schema

The request payload is sent as HTTP JSON body using the following schema:

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "title": "Export Report to PDF Request",
  "description": "Request payload for exporting a generated mortgage report to PDF format",
  "properties": {
    "reportId": {
      "type": "string",
      "description": "ID of the report to export",
      "minLength": 1
    },
    "lenders": {
      "type": "array",
      "description": "Array of lender codes to include in the PDF",
      "items": {
        "type": "string",
        "enum": [
          "aia",
          "anz", 
          "asb",
          "bnz",
          "co-op",
          "kiwibank",
          "liberty",
          "sbs",
          "tsb",
          "westpac"
        ]
      },
      "minItems": 1,
      "uniqueItems": true
    },
    "currentLoanAmount": {
      "type": "number",
      "description": "Optional override for loan amount",
      "minimum": 0
    },
    "includeWarningsErrors": {
      "type": "boolean",
      "description": "Whether to include warnings and errors in the PDF",
      "default": false
    },
    "notes": {
      "type": "string",
      "description": "Optional notes to include in the PDF",
      "maxLength": 5000
    }
  },
  "required": [
    "reportId",
    "lenders"
  ],
  "additionalProperties": false
}


Examples

Example request payload:

JSON Request Body
{
  "reportId": "abc123def456",
  "lenders": ["anz", "asb", "westpac"],
  "currentLoanAmount": 500000,
  "includeWarningsErrors": true,
  "notes": "Custom notes for this PDF export"
}

 


Validation

The API performs validation on the request payload:

  • reportId and lenders are required fields
  • lenders must be a non-empty array with valid lender codes
  • currentLoanAmount must be a positive number if provided
  • notes cannot exceed 5000 characters


Response


Success

If the Export Report to PDF completes successfully:

JSON Body

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "title": "Export Report to PDF Response",
  "description": "Response payload for the export report to PDF operation",
  "properties": {
    "url": {
      "type": "string",
      "description": "Signed download URL for the generated PDF file (valid for 24 hours)",
      "format": "uri",
      "pattern": "^https://",
      "example": "https://storage.googleapis.com/project.appspot.com/pdf_reports/abc123def456.pdf?GoogleAccessId=...&Expires=1691234567&Signature=..."
    }
  },
  "required": [
    "url"
  ],
  "additionalProperties": false
}

Examples

200: Success

Success Response
{
  "url": "https://storage.googleapis.com/project.appspot.com/pdf_reports/abc123def456.pdf?GoogleAccessId=...&Expires=1691234567&Signature=..."
}


Error

If errors are encountered during the Export Report to PDF operation:

JSON Body

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "description": "Error information",
      "properties": {
        "message": {
          "type": "string",
          "description": "Human readable error message"
        },
        "status": {
          "type": "string",
          "description": "Error code in uppercase letters and _ as space",
          "enum": ["INVALID_ARGUMENT","NOT_FOUND","INTERNAL_ERROR","METHOD_NOT_ALLOWED","UNAUTHENTICATED"]
        }
      }
    }
  }
}

Examples

400: Bad Request

Invalid input
{
    "error": {
        "message": "Invalid input: reportId and lenders are required",
        "status": "INVALID_ARGUMENT"
    }
}

 

401: Missing API Key

Missing API Key
{
    "error": {
        "message": "Missing API Key",
        "status": "UNAUTHENTICATED"
    }
}

 

401: Invalid API Key

Invalid API Key
{
    "error": {
        "message": "Invalid API Key",
        "status": "UNAUTHENTICATED"
    }
}

 

404: Report Not Found

Report not found
{
    "error": {
        "message": "Report not found",
        "status": "NOT_FOUND"
    }
}

 

405: Method Not Allowed

Method not allowed
{
    "error": {
        "message": "Method Not Allowed",
        "status": "METHOD_NOT_ALLOWED"
    }
}

 

Internal Server Error

500: Internal Server Error

{
    "error": {
        "message": "Error generating PDF",
        "status": "INTERNAL_ERROR"
    }
}