A Singapore Government Agency Website

AISAY

The AISAY Node connects your workflow to GovTech’s AISAY system, an advanced AI-powered document processing solution that leverages Optical Character Recognition (OCR) and cutting-edge Large Language Models (LLM) to extract, classify, and seamlessly integrate information from various types of Government documents, including images and PDFs, into existing systems. Visit AISAY Documentation or AI Platform to learn more.

AISAY Support: For any enquiries or issues related to AISAY, please contact the AISAY team at gdp_platform_aisay@tech.gov.sg.

How Does It Work?

Prerequisites: You will need an AISAY API key. Visit https://go.gov.sg/aisaykey to obtain an API key.

Setup Steps:

  1. Build your workflow using Graph Edit Mode (minimum setup: input node → AISAY node → output node, but you can add more nodes as needed)
  2. Click on the AISAY node settings to open its configuration
  3. Configure the connection settings with your credentials (API Key)
  4. Select the operation you want to perform and configure the required parameters

Tip: Try running a simulation to load available fields from upstream nodes for selection!

Output:

The AISAY Node returns the response from the AISAY API. The output structure varies depending on the operation performed:

Document Classification Output:

{
  "document_type": "PASSPORT",
  "categories": [
    "PASSPORT",
    "NRIC",
    "DRIVING_LICENCE"
  ],
  "metadata": {
    "processing_time_seconds": 1.641,
    "file_size_mb": 0.418,
    "page_count": 1,
    "model": "classification_rsn_v1"
  }
}

Document Key Information Extraction (KIE) Output — Specify Your Own Fields:

{
  "document_type": null,
  "document": {
    "value": {
      "response": {
        "value": "{\"person_name\":\"JOHN LEE\",\"nationality\":\"SINGAPORE CITIZEN\"}",
        "confidence": null
      }
    },
    "confidence": null
  },
  "metadata": {
    "processing_time_seconds": 6.027,
    "file_size_mb": 0.418,
    "page_count": 1,
    "model": "vlm_rsn_v1"
  }
}

Document Key Information Extraction (KIE) Output — Preset Document Types:

{
  "document_type": "RECEIPT",
  "document": {
    "value": {
      "merchant_name": { "value": "ABC COMPUTER PTE LTD", "confidence": 0.488 },
      "merchant_address": { "value": "ABC ROAD, SINGAPORE 123456", "confidence": 0.411 },
      "total": { "value": "94.00", "confidence": 0.672 },
      "total_tax": { "value": "7.76", "confidence": 0.711 },
      "transaction_date": { "value": "03 Jun 25", "confidence": 0.536 }
    },
    "confidence": 0.5055
  },
  "metadata": {
    "processing_time_seconds": 25.76,
    "file_size_mb": 1.131,
    "page_count": 1,
    "model": "receipt_rsn_v1"
  }
}

Document OCR Output:

{
  "parsed_document": "# Document Title\n\nExtracted text content in Markdown format...",
  "metadata": {
    "processing_time_seconds": 4.407,
    "file_size_mb": 0.418,
    "page_count": 1,
    "model": "ocr_rsn_v1"
  }
}

Subsequent nodes can access the response data using field names like document_type, document, parsed_document, metadata, etc.

Configuration

Connection Settings

API Key

Your AISAY API key for Bearer token authentication.

Format: Plain text (will be encrypted)

Example: your-api-key-here

Operations

The AISAY Node supports three operations:

Document Classification

Classifies a document into one of your predefined categories using LLMs to intelligently analyse document content.

Field Description Required Example
File Document file to process, as a base64 encoded string from an upstream node Yes {{{input.fileBase64}}}
Select Model Model suite to use for processing. Flagship Models are the latest models from model providers. Locally Hosted Models are based in Singapore Yes Locally Hosted Models
Document Categories JSON array of category objects for the model to choose from. Each object must have a category field Yes [{"category":"PASSPORT"},{"category":"NRIC"},{"category":"DRIVING_LICENCE"}]

Note: Both Flagship Models and Locally Hosted Models support up to Restricted, Sensitive Normal documents. Support for Confidential (Cloud Eligible) documents for Locally Hosted Models is pending clearance.

Document Key Information Extraction (KIE)

Extracts key fields from a document using either a preset model for a specific document type, or custom-defined fields.

Field Description Required Example
File Document file to process, as a base64 encoded string from an upstream node Yes {{{input.fileBase64}}}
Select Model Model suite to use for processing. Flagship Models are the latest models from model providers. Locally Hosted Models are based in Singapore Yes Locally Hosted Models
Use Case Select a preset document type for structured extraction, or Specify Your Own Fields to define custom extraction fields Yes Payslip

Note: Preset Use Cases include: Passport, Marriage Cert, Receipt, Payslip, Education Cert, Employment Letter, NRIC, Cheque, Invoice, Quotation, NS Transcript, Bank Statement, PUB Mail. These have preset extraction fields. Use Specify Your Own Fields for document types not listed or when you need custom fields.

Specify Your Own Fields

When Use Case is set to Specify Your Own Fields, you define the fields to extract by adding one or more custom field entries. Each entry has:

Property Description Options
Data Label Name of the field to extract, used as the key in the output Any text (e.g. person_name)
Data Type The data type of the extracted value Text, True/False, Date, Number, List, Object
Prompt Description or instructions to guide the model in extracting this field Any text (e.g. Full legal name of the person)

Note: When Data Type is set to List or Object, you will be prompted to define nested custom fields using the same structure (Data Label, Data Type, Prompt). This supports multi-level nesting for complex document structures.

Document Optical Character Recognition (OCR)

Runs OCR on a document to extract all text content in Markdown format.

Field Description Required Example
File Document file to process, as a base64 encoded string from an upstream node Yes {{{input.fileBase64}}}
Select Model Model suite to use for processing. Only Locally Hosted Models is supported for OCR Yes Locally Hosted Models

Examples

Example 1: Classify Submitted Documents

A workflow that classifies incoming documents to route them to the appropriate processing pipeline.

Configuration:

Connection:
  API Key: ••••••••••••••••

Operation: Document Classification

Parameters:
  File: {{{input.documentBase64}}}
  Select Model: Locally Hosted Models
  Document Categories: [{"category":"PASSPORT"},{"category":"NRIC"},{"category":"PAYSLIP"},{"category":"INVOICE"}]

Input:

{
  "documentBase64": "<base64-encoded-document>",
  "submissionId": "SUB-2025-001234"
}

Output:

{
  "document_type": "PAYSLIP",
  "categories": ["PASSPORT", "NRIC", "PAYSLIP", "INVOICE"],
  "metadata": {
    "processing_time_seconds": 1.641,
    "file_size_mb": 0.418,
    "page_count": 1,
    "model": "classification_rsn_v1"
  }
}

Example 2: Extract Key Information from a Payslip

A workflow that extracts structured fields from a payslip using the specific PAYSLIP model.

Configuration:

Connection:
  API Key: ••••••••••••••••

Operation: Document Key Information Extraction (KIE)

Parameters:
  File: {{{input.payslipBase64}}}
  Select Model: Locally Hosted Models
  Use Case: Payslip

Input:

{
  "payslipBase64": "<base64-encoded-payslip>",
  "applicantId": "APP-2025-005678"
}

Output:

{
  "document_type": "PAYSLIP",
  "document": {
    "value": {
      "employee_name": { "value": "TAN AH KOW", "confidence": 0.95 },
      "employer_name": { "value": "ACME PTE LTD", "confidence": 0.92 },
      "net_pay": { "value": "3500.00", "confidence": 0.88 },
      "pay_period": { "value": "January 2025", "confidence": 0.91 }
    },
    "confidence": 0.915
  },
  "metadata": {
    "processing_time_seconds": 18.42,
    "file_size_mb": 0.521,
    "page_count": 1,
    "model": "payslip_rsn_v1"
  }
}

Example 3: Extract Custom Fields Using General Model

A workflow that extracts specific fields from a document type not covered by a preset model, using a custom prompt.

Configuration:

Connection:
  API Key: ••••••••••••••••

Operation: Document Key Information Extraction (KIE)

Parameters:
  File: {{{input.documentBase64}}}
  Select Model: Locally Hosted Models
  Use Case: Specify Your Own Fields
  Custom Fields:
    - Data Label: applicant_name
      Data Type: Text
      Prompt: Full name of the applicant
    - Data Label: application_date
      Data Type: Date
      Prompt: Date the application was submitted
    - Data Label: approved_amount
      Data Type: Number
      Prompt: Total approved amount in dollars

Input:

{
  "documentBase64": "<base64-encoded-document>",
  "caseId": "CASE-2025-009012"
}

Output:

{
  "document_type": null,
  "document": {
    "value": {
      "response": {
        "value": "{\"applicant_name\":\"MARY LIM\",\"application_date\":\"15 Jan 2025\",\"approved_amount\":\"5000\"}",
        "confidence": null
      }
    },
    "confidence": null
  },
  "metadata": {
    "processing_time_seconds": 6.027,
    "file_size_mb": 0.418,
    "page_count": 1,
    "model": "vlm_rsn_v1"
  }
}

Example 4: OCR a Scanned Document

A workflow that runs OCR on a scanned document to extract its full text content for downstream processing.

Configuration:

Connection:
  API Key: ••••••••••••••••

Operation: Document Optical Character Recognition (OCR)

Parameters:
  File: {{{input.scannedDocBase64}}}
  Select Model: Locally Hosted Models

Input:

{
  "scannedDocBase64": "<base64-encoded-scanned-document>",
  "documentId": "DOC-2025-003456"
}

Output:

{
  "parsed_document": "# Medical Certificate\n\nPatient Name: John Doe\nDate: 15 January 2025\n\nThis is to certify that the above-named patient...",
  "metadata": {
    "processing_time_seconds": 4.407,
    "file_size_mb": 0.418,
    "page_count": 1,
    "model": "ocr_rsn_v1"
  }
}

Error Handling

The AISAY Node treats both 4xx and 5xx responses as unrecoverable errors — the activity fails and the workflow stops rather than continuing.

  • 4xx errors (client errors): Thrown as typed errors (e.g., BadRequestError, UnauthorizedError). These indicate a configuration or input problem that must be fixed before re-running the workflow.
  • 5xx errors (server errors): Thrown as errors, causing the workflow to fail.

Tip: Use a Switch Node after the AISAY Node to handle different response scenarios (success vs. error) in your workflow.

When to Use It?

Use AISAY Node when:

  • You need to extract key information from documents such as payslips, invoices, bank statements, and medical forms.
  • You want to classify documents according to predefined categories, routing them to the correct processing pipeline.
  • You need to convert scanned or image-based documents into machine-readable text using OCR.
  • You are processing government documents and require WOG-approved, data-secure AI processing.
  • You want to automate document intake workflows without manual data entry.

Tip: Document Key Information Extraction (KIE) is used by 90% of users and is a good place to start. Use supported preset document types to get structured, confidence-scored field extractions.

Chat with me!
Bot Launcher