New N/documentCapture Module: AI-Driven Document Extraction via SuiteScript
NetSuite adds the N/documentCapture SuiteScript 2.1 module, enabling server-side AI-powered extraction of text, tables, and key-value pairs from PDFs, images, and scanned documents using Oracle Cloud Infrastructure Document Understanding.
What changed
A new server-side SuiteScript 2.1 module, N/documentCapture, is now available by default when the Server SuiteScript feature is enabled. It wraps Oracle Cloud Infrastructure (OCI) Document Understanding — an AI/ML service — and exposes it directly within SuiteScript for programmatic document processing.
Supported input formats
- PDF, PNG, JPG, TIFF
Core methods
documentCapture.documentToStructure(options)— synchronous structured extraction (up to 5 pages). Returns adocumentCapture.Documentobject containing pages, lines, words, fields, and tables with confidence scores.documentCapture.documentToStructure.promise(options)— asynchronous variant for documents longer than 5 pages.documentCapture.documentToText(options)— synchronous plain-text extraction from PDF files. Returns astring.documentCapture.documentToText.promise(options)— asynchronous variant.documentCapture.getRemainingConcurrency()/.promise()— returns the number of available concurrent requests remaining. Use this to throttle workloads in scheduled or map/reduce scripts.documentCapture.parseResult(options)— converts a previously-saved JSON result back into adocumentCapture.Documentobject for re-processing without re-calling OCI.
Object model
The Document object exposes mimeType, a pages array, and a getText() convenience method. Each Page contains:
Page.lines— array ofLineobjects (text + confidence)Page.words— array ofWordobjects (text + confidence)Page.fields— array ofFieldobjects, each with aFieldLabel(name + confidence) andFieldValue(text + confidence). TheField.typeproperty maps to thedocumentCapture.FieldTypeenum.Page.tables— array ofTableobjects withheaderRows,bodyRows,footerRows(each containingCellobjects), plusrowCount,columnCount, andconfidence.Page.detectedDocumentTypes— array of objects with confidence levels for automatic document classification (invoice, receipt, contract, etc.).
Enums
documentCapture.DocumentType— document type valuesdocumentCapture.Feature— which extraction feature to invokedocumentCapture.FieldType— field type classificationdocumentCapture.Language— language of the source document
Deprecation notice
documentCapture.getRemainingFreeUsage() and its .promise() variant are deprecated. They now delegate to llm.getRemainingUsage() from the N/llm module. This indicates that N/documentCapture shares the same usage quota pool as N/llm — plan capacity accordingly if you are also using generative AI features.
What the source does not specify
- Governance cost — no governance-unit consumption is documented for these calls. Verify in your account by checking the SuiteScript governance topic or testing with
nlapiGetContext().getRemainingUsage(). - Concurrency limits — the
getRemainingConcurrency()method exists but no concrete default limit is stated. Test in sandbox. - Usage quotas — the exact monthly or per-account free-tier allocation is not disclosed here. The deprecation of
getRemainingFreeUsagein favor ofllm.getRemainingUsagesuggests a unified AI-services budget; check your account's AI usage dashboard. - File Cabinet integration — the docs do not clarify whether
optionsaccepts a File Cabinet internal ID, afile.Fileobject, or raw base64/URL. Review the linked "Getting Started" page or script samples for exact parameter shapes.
What to do
- Confirm feature enablement. Verify that Server SuiteScript is enabled at Setup > Company > Enable Features > SuiteCloud. No separate feature flag is required for this module.
- Load the module. Use
define(['N/documentCapture'], function(documentCapture) { ... })in SuiteScript 2.1. This module is server-side only — it will not load in client scripts. - Audit AI usage budgets. If you already use
N/llm, note that document capture shares the same usage pool. CalldocumentCapture.getRemainingConcurrency()before processing batches. - Replace deprecated calls. If you adopted
getRemainingFreeUsage()in any early-access code, migrate torequire(['N/llm'], function(llm) { llm.getRemainingUsage(); }). - Choose sync vs. async. For documents ≤ 5 pages, synchronous calls work. For longer documents, use the
.promise()variants — these are well-suited for Map/Reduce or Scheduled script contexts. - Use
parseResultfor reprocessing. If you persist the raw JSON output (e.g., to a custom record or file), you can reconstitute it into aDocumentobject later without re-calling OCI, saving both time and quota. - Test in sandbox first. OCI Document Understanding is a cloud service call — latency, concurrency limits, and quota consumption should be profiled before production deployment.
Source: Oracle NetSuite Release Notes