惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
AWS News Blog
AWS News Blog
V
Vulnerabilities – Threatpost
D
Darknet – Hacking Tools, Hacker News & Cyber Security
量子位
博客园 - 叶小钗
AI
AI
T
Tor Project blog
Forbes - Security
Forbes - Security
W
WeLiveSecurity
博客园_首页
爱范儿
爱范儿
J
Java Code Geeks
B
Blog
G
GRAHAM CLULEY
aimingoo的专栏
aimingoo的专栏
Cloudbric
Cloudbric
C
CXSECURITY Database RSS Feed - CXSecurity.com
TaoSecurity Blog
TaoSecurity Blog
L
LINUX DO - 热门话题
阮一峰的网络日志
阮一峰的网络日志
有赞技术团队
有赞技术团队
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Simon Willison's Weblog
Simon Willison's Weblog
云风的 BLOG
云风的 BLOG
Google DeepMind News
Google DeepMind News
H
Help Net Security
博客园 - 三生石上(FineUI控件)
C
Cisco Blogs
C
Cybersecurity and Infrastructure Security Agency CISA
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
P
Palo Alto Networks Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Recent Commits to openclaw:main
Recent Commits to openclaw:main
博客园 - 司徒正美
The Last Watchdog
The Last Watchdog
Blog — PlanetScale
Blog — PlanetScale
T
The Blog of Author Tim Ferriss
S
Secure Thoughts
Spread Privacy
Spread Privacy
F
Fortinet All Blogs
月光博客
月光博客
大猫的无限游戏
大猫的无限游戏
S
SegmentFault 最新的问题
H
Hackread – Cybersecurity News, Data Breaches, AI and More
A
About on SuperTechFans
Security Latest
Security Latest
Webroot Blog
Webroot Blog
Scott Helme
Scott Helme
Hugging Face - Blog
Hugging Face - Blog

Inside Nutrient

A guide to the invisible work behind documents Introducing Nutrient Documents for Salesforce: Native document generation and signing Document AI vs. traditional OCR: Choosing between OCR, AI, and hybrid pipelines PDF SDK compliance and security evaluation checklist for enterprise teams (2026) Invariant Corp replaces paper processes with Nutrient Workflow and scales without limits What is process mapping? A complete guide Nutrient vs. Conga Composer for Salesforce document generation (2026) Document routing: How to automate document distribution The CTO’s AI playbook: Why accountability architecture beats orchestration Compliance workflow automation: Why built-in compliance is table stakes Workflow diagrams: Examples, symbols, and how to build one that actually runs Digital forms: Replace paper forms with automated workflows Approval workflow software: How to automate approvals Why document-centric automation is different The CEO’s AI playbook: Why decision architecture beats model selection Nutrient SDK product updates for Q1 2026 PDF redaction verification: How to prove sensitive data is permanently removed What is a VPAT? The complete guide to accessibility conformance reports What is PDF/UA? The accessible PDF standard explained Salesforce eSignatures: Generate, sign, and track documents in one flow Online document viewer: Options, tradeoffs, and how to embed one Document viewer for web apps: React, Vue, Angular (2026) Best document viewers in 2026: A buyer’s guide How to edit a PDF in Python: Add text, images, and annotations Nutrient advances Workflow platform with agentic AI for enterprise-grade speed and consistency in document-heavy operations How to create a Salesforce quote template from opportunity data The business case for accessibility: Five ways it drives enterprise value Python PDF library comparison (2026): 7 libraries for developers Why your AI agent hallucinates PDF table data PDF.js limitations: When to upgrade to a commercial PDF SDK How Subject scaled 5× with Nutrient’s PDF SDK without rebuilding its document layer I replaced our sales training with an AI coach that runs in Slack — here’s what broke Redirecting to: https://securitybuzz.com/cybersecurity-news/why-enterprise-permissions-are-ais-most-dangerous-inheritance/ Nutrient .NET SDK vs. iText Core: Complete comparison for .NET developers DocuVieware: Support’s most frequently asked setup questions Introducing Nutrient Workflow How to convert PDF to Word in C# (.NET) When email and spreadsheets stop working: Work order approval workflows for field teams on the move Compliance with confidence: Why document-centric automation is the foundation of your mission Nutrient expands AI Assistant, automating multistep document workflows inside any application What is document generation? A developer’s guide to PDF generation Document Converter data flow and how real-time watermarks skip the queue PDF/UA compliance guide: Requirements, standards, and best practices Computers still can’t understand you How Athena Intelligence built AI agents for regulated enterprises with Nutrient’s document infrastructure How to convert HTML to PDF (2026): 4 methods from browser print to SDK How to build a document extraction pipeline with Nutrient Vision API OCR vs. intelligent document processing: Choosing the right document extraction engine Beyond OCR: How document intelligence eliminates manual processing in regulated industries Nutrient vs. IronPDF: Complete comparison for .NET developers Nutrient vs. Aspose.PDF: Complete comparison for .NET developers Redirecting to: https://fortune.com/2026/02/19/openclaw-who-is-peter-steinberger-openai-sam-altman-anthropic-moltbook/ Lufthansa Systems uses Nutrient to deliver reliable, scalable PDF rendering for pilots worldwide Nutrient vs. Syncfusion: Complete comparison for .NET developers React’s useTransition: The hook you’re probably using wrong First City Monument Bank streamlines banking processes with Nutrient Workflow Redirecting to: https://www.sdcexec.com/warehousing/automation/article/22957364/nutrient-workflow-automation-the-missing-link-in-supply-chain-efficiency The complete guide to digital signatures: PAdES, CAdES, and XAdES explained Nutrient Python SDK: Production-grade document processing for Python Introducing agentic document editing for web applications with AI Assistant Nutrient vs. QuestPDF: Complete comparison for .NET developers How we fixed the GdPicture license expiration (and what to do if you’re affected) Red team security testing with agentic AI The future of healthcare document automation Best healthcare workflow software compared Nutrient SDK product updates for Q4 2025 How Harvey scaled legal document workflows 50 percent MoM without rebuilding infrastructure HIPAA-compliant document management in hospitals How we optimized rendering performance while handling thousands of annotations in React — Part 2 Automated PII removal with Nutrient API Redirecting to: https://www.devopsdigest.com/2026-low-code-no-code-predictions Redirecting to: https://www.kmworld.com/Articles/Editorial/ViewPoints/Leaders-predict-AI-to-continue-permeating-all-aspects-of-KM-in-2026-172594.aspx What are deep agents and how do they solve complex problems? Whipping up document magic: Your easy-bake recipe for Vue and Nutrient Web SDK 🧁 What I’ve learned about product iteration planning while building SDKs Passwordless document signing: Three-layer security guide New zip folder functionality streamlines file management in Document Automation Server The keyboard shortcuts playbook: Taking control of keyboard events in Nutrient Web SDK From experienced engineer to AI beginner: My unexpected journey AI-assisted manual testing: Handling Safari’s PDF rendering and UI quirks How to keep a 20-year-old SDK up to date How we optimized rendering performance while handling thousands of annotations in React — Part 1 Nutrient announces new executive hires to accelerate next phase of growth High performance UI using web workers Automate document conversion at scale with Python and Nutrient DCS From curiosity to PLG (and AI): My journey to understanding product-led growth Prost to progress: One year as Nutrient Pigeon usage at Nutrient: Bridging native SDKs to Flutter Modernizing CI build servers: How to migrate from Chef to Ansible Unix man pages: AI-friendly documentation since 1971 Consistent hashing for even load distribution Best AI redaction APIs: Complete comparison guide for 2025 Why AI document redaction matters for modern security From coding to coordinating: How AI transformed my workflow What is intelligent document processing (IDP)? A complete guide Enterprise PDF SDKs: Best PSPDFKit (now Nutrient) alternatives Nutrient SDK product updates for Q3 2025 GdPicture support best practices How AI is transforming the customer experience at Nutrient: From instant answers to intelligent support How manual QA uses PR testing between releases
Redacting sensitive data with Nutrient AI redaction API
Hulya Masharipov · 2025-10-31 · via Inside Nutrient

Table of contents

    This tutorial shows you how to build a Python workflow using the Nutrient AI redaction API. You'll upload documents, apply permanent redactions, and verify the results.

    Redacting sensitive data with Nutrient AI redaction API

    TL;DR

    Data breaches cost organizations millions. Legal contracts, healthcare records, and financial documents contain PII(opens in a new tab) that needs redaction for compliance.

    Nutrient’s AI redaction API uses AI to understand context, not just keywords. It distinguishes Social Security numbers (SSNs) from case numbers and birthdates from contract dates. The API processes thousands of documents per hour.

    Traditional redaction uses keyword matching. AI-powered redaction works differently — it handles thousands of documents at once, which is critical for legal discovery deadlines.

    What you’ll learn

    In this tutorial, you’ll learn:

    • How to upload PDF documents to the Nutrient AI redaction API
    • How to apply permanent, irreversible redaction to sensitive content
    • The difference between staging and applying redactions
    • How to process API responses and download redacted files
    • How to verify that sensitive data has been removed
    • Best practices for handling scanned documents and minimizing false positives

    Prerequisites

    Before you begin, make sure you have:

    • Python 3.7 or higher — You need Python installed on your system.
    • A Nutrient API keySign up for a free trial(opens in a new tab) to get started.
    • A sample PDF — You need a PDF containing sensitive data. You can download our example document or use your own.
    • Basic Python knowledge — You should be familiar with requests and JSON handling, as well as async/await for the Python client.

    Step 1: Set up your environment

    Set up your Python environment and install the required dependencies:

    # Create a new project directory.

    mkdir nutrient-redaction-tutorial

    cd nutrient-redaction-tutorial

    # (Optional) Create and activate a virtual environment.

    python -m venv venv

    source venv/bin/activate # On Windows: venv\Scripts\activate

    # Install dependencies.

    # For HTTP requests approach:

    pip install requests python-dotenv

    Store your API key securely in an .env file:

    # .env file

    NUTRIENT_API_KEY=your_api_key_here

    After you sign up, find your API key in the Nutrient Dashboard(opens in a new tab).

    dashboard

    Tip: Never commit your API key to version control. Add .env to your .gitignore.

    Step 2: Write the redaction code

    Create a Python script (for example, redaction_tutorial.py) to redact your PDF using the Nutrient API:

    import os

    import requests

    import json

    from dotenv import load_dotenv

    load_dotenv()

    API_KEY = os.getenv("NUTRIENT_API_KEY")

    url = "https://api.nutrient.io/ai/redact"

    headers = {

    "Authorization": f"Bearer {API_KEY}"

    }

    files = {

    "file1": open("redaction.pdf", "rb")

    }

    data = {

    "data": json.dumps({

    "documents": [{"documentId": "file1"}],

    "criteria": "All personally identifiable information",

    "redaction_state": "apply" # or "stage" for review

    })

    }

    response = requests.post(url, headers=headers, files=files, data=data, stream=True)

    if response.ok:

    with open("result.pdf", "wb") as fd:

    for chunk in response.iter_content(chunk_size=8096):

    fd.write(chunk)

    print("Redacted PDF saved as result.pdf")

    else:

    print("Error:", response.text)

    exit()

    This script uploads your document, instructs the API to redact PII per your criteria, and saves the output locally.

    Stage vs. apply (how redactions are finalized)

    Nutrient supports two modes:

    • "redaction_state": "stage" — Creates redaction annotations for review. The text remains in the file (you’ll see colored boxes, and text may still be selectable).
    • "redaction_state": "apply" — Permanently removes the underlying content (burn-in). Copy/paste and text search over redacted regions will return nothing.

    Minimal payload difference:

    {

    "documents": [{ "documentId": "file1" }],

    "criteria": "All personally identifiable information",

    "redaction_state": "stage" // review annotations (non-destructive)

    }

    Document with redaction annotations for review

    {

    "documents": [{ "documentId": "file1" }],

    "criteria": "All personally identifiable information",

    "redaction_state": "apply" // burn-in (permanent, content removed)

    }

    Document with permanent redactions applied

    Important: Redactions are finalized based on the redaction_state you send. Use "apply" to permanently remove content, or "stage" to create reviewable annotations. For clarity and consistency, always set redaction_state explicitly.

    Step 3: Customizing redaction criteria

    You can specify the types of sensitive information to redact by changing the criteria field. For example, to target a broader set of data:

    "criteria": "All personally identifiable information, financial data, and medical information"

    Adjust criteria based on your compliance requirements.

    Step 4: Download and verify results

    After processing, open result.pdf in a PDF viewer to confirm sensitive data is removed. For additional verification, reupload the redacted file to check for remaining content, or add automated checks like searching for known test values.

    Step 5: Processing multiple documents

    For organizations processing multiple documents, you’ll need to handle files in batches. Since the /ai/redact endpoint processes one document per request, you can loop through your files sequentially or in parallel.

    Here’s a production-ready script that processes multiple PDFs:

    """

    Process PDFs with Nutrient AI Redaction

    This script loads the API key from .env (NUTRIENT_API_KEY) and saves each result next to the input as <name>.redacted.pdf (or .stage.pdf).

    """

    import os

    import json

    import requests

    from pathlib import Path

    from dotenv import load_dotenv

    # --- Config ---

    API_URL = "https://api.nutrient.io/ai/redact"

    REDACTION_STATE = "apply" # "stage" or "apply"

    CRITERIA = "All personally identifiable information"

    INPUT_FILES = ["docs_in/contract1.pdf", "docs_in/contract2.pdf", "docs_in/contract3.pdf"] # sample files

    CHUNK = 8192

    TIMEOUT = 300

    def out_path_for(input_path: Path, state: str) -> Path:

    suffix = ".stage.pdf" if state == "stage" else ".redacted.pdf"

    return input_path.with_suffix("").with_name(input_path.stem + suffix)

    def redact_file(api_key: str, in_path: Path, state: str) -> Path:

    if not in_path.exists():

    raise FileNotFoundError(f"Missing file: {in_path}")

    files = {"file1": (in_path.name, open(in_path, "rb"), "application/pdf")}

    data = {

    "data": json.dumps({

    "documents": [{"documentId": "file1"}],

    "criteria": CRITERIA,

    "redaction_state": state

    })

    }

    40 collapsed lines

    try:

    resp = requests.post(

    API_URL,

    headers={"Authorization": f"Bearer {api_key}"},

    files=files,

    data=data,

    stream=True,

    timeout=TIMEOUT

    )

    finally:

    files["file1"][1].close()

    if not resp.ok:

    raise RuntimeError(f"{in_path.name}: {resp.status_code} {resp.reason}\n{resp.text}")

    out_path = out_path_for(in_path, state)

    with open(out_path, "wb") as fd:

    for chunk in resp.iter_content(chunk_size=CHUNK):

    if chunk:

    fd.write(chunk)

    return out_path

    def main():

    load_dotenv()

    api_key = os.getenv("NUTRIENT_API_KEY", "").strip()

    if not api_key:

    raise SystemExit("Missing API key. Set NUTRIENT_API_KEY in .env")

    for f in INPUT_FILES:

    p = Path(f)

    try:

    outp = redact_file(api_key, p, REDACTION_STATE)

    print(f"OK {p.name}{outp.name}")

    except Exception as e:

    print(f"ERR {p.name}{e}")

    if __name__ == "__main__":

    main()

    Setup instructions:

    1. Create an .env file with your API key: NUTRIENT_API_KEY=pdf_live_...
    2. Set REDACTION_STATE to "stage" (reviewable annotations) or "apply" (permanent)
    3. Update INPUT_FILES with your document paths
    4. Run: python redact_batch.py

    The script outputs files like contract1.redacted.pdf (or contract1.stage.pdf in stage mode).

    Troubleshooting batch processing:

    • 401 Unauthorized — Check that your API key is correct and loaded from .env
    • File not found — Verify that paths in INPUT_FILES exist
    • Rate limiting — Add delays between requests or implement exponential backoff

    Alternative: Using the Python client

    You can also use Nutrient’s official Python client(opens in a new tab) library for a more streamlined experience. The Python client provides a cleaner API and handles authentication, error handling, and async operations automatically.

    pip install nutrient-dws python-dotenv

    Here’s the same redaction using the Python client:

    import asyncio

    import os

    from dotenv import load_dotenv

    from nutrient_dws import NutrientClient

    async def redact_with_client():

    load_dotenv()

    client = NutrientClient(api_key=os.getenv('NUTRIENT_API_KEY'))

    # Simple AI redaction (applies redactions by default).

    result = await client.create_redactions_ai(

    './redaction.pdf',

    'All personally identifiable information',

    'apply' # Apply redactions immediately.

    )

    # Save the redacted file.

    with open('result.pdf', 'wb') as f:

    f.write(result['buffer'])

    print("Redacted PDF saved as result.pdf")

    # Run the async function.

    asyncio.run(redact_with_client())

    Use 'stage' while tuning criteria, and then switch to 'apply' to burn in redactions once you’re satisfied.

    Benefits of the Python client:

    • Cleaner, more Pythonic API — Simplified method calls and intuitive structure
    • Automatic error handling and retries — Built-in resilience for production use
    • Built-in async support — Better performance for high-volume processing
    • Type hints and IDE support — Enhanced developer experience
    • Simplified authentication management — Secure credential handling

    Troubleshooting common issues

    This section helps you identify and resolve common challenges when using the AI redaction API, including handling false positives and negatives, addressing scanned document OCR limitations, and managing errors or configuration issues in both single- and batch-processing workflows.

    False positives (over-redaction)

    When the API redacts content that shouldn’t be removed, use more specific criteria:

    def handle_false_positives(self, file_path):

    """Use more specific criteria to reduce false positives."""

    # Instead of broad criteria like "All personally identifiable information"

    # Use specific, targeted criteria.

    specific_criteria = "Social Security Numbers and credit card numbers only"

    # Always stage first to review results.

    return self.upload_document(

    file_path=file_path,

    criteria=specific_criteria,

    redaction_state="stage"

    )

    False negatives (missed content)

    When sensitive content isn’t detected, try broader criteria or use staging mode for manual review:

    def handle_false_negatives(self, file_path):

    """Use broader criteria and manual review for missed content."""

    # Use broader criteria that might catch more content.

    broad_criteria = "All personally identifiable information including names, addresses, phone numbers, and identification numbers"

    # Always use staging mode for manual review.

    return self.upload_document(

    file_path=file_path,

    criteria=broad_criteria,

    redaction_state="stage" # Review before applying

    )

    Scanned document issues

    The API includes OCR for scanned PDFs and images. OCR accuracy depends on scan quality and document layout. Test with your actual documents and use high-quality scans. Poor scan quality reduces text extraction accuracy.

    Key considerations for production use

    When deploying redaction workflows in production:

    1. Security

    • Store API keys securely — for example, environment variables or a key management system.
    • All API requests use HTTPS/TLS for secure data transmission.
    • Never log or expose sensitive document content.
    • There’s no document retention; Nutrient DWS Processor API doesn’t store documents; they’re permanently deleted after each operation.

    2. Rate limiting

    • The API enforces rate limits, so use retry logic with exponential backoff.
    • For high-volume processing, batch documents and introduce delays between requests.
    • Monitor your credit usage to avoid interruptions.

    3. Error handling

    • Use try-except blocks for all API interactions.
    • Implement retries for transient errors.
    • Log errors for diagnostics, but never log document content.
    • Use staging mode for sensitive or critical documents to enable manual review.

    4. Monitoring and compliance

    • Log redaction activities (excluding document content) for audit trails.
    • Track API usage and monitor for false positives and false negatives.
    • Establish review processes for edge cases and compliance requirements.

    Next steps and advanced usage

    You’ve built a PDF redaction workflow. Below are ways to extend it.

    1. Integration ideas

    • Document management systems — Integrate with SharePoint or Google Drive to redact documents directly from cloud storage.
    • Workflow automation — Use Zapier or Power Automate to build no-code redaction pipelines.
    • Batch processing systems — Build high-volume document redaction workflows for enterprise use.
    • Cloud storage — Leverage AWS S3 or Azure Blob Storage for scalable workflows.
    • Deterministic redaction — Use regex and preset patterns via the redaction API for rule-based redaction.

    2. Industry-specific applications

    Healthcare (HIPAA compliance)

    Automatically redact patient names, medical record numbers, Social Security numbers, and dates of birth from clinical notes, insurance forms, and research documents.

    Legal discovery

    Process thousands of legal documents to remove attorney-client privileged information. AI distinguishes between contexts (for example, a judge’s name in a caption versus a witness name in testimony). Learn more about transforming legal discovery workflows.

    Financial services (PCI DSS)

    Remove credit card numbers, account information, and financial identifiers from loan applications, transaction records, and compliance reports.

    Government and FOIA

    Comply with Freedom of Information Act requests by redacting sensitive information while preserving document integrity for public release.

    For comprehensive redaction solutions across different platforms, explore our redaction solutions.

    Conclusion

    You can now use the Nutrient AI redaction API to protect sensitive information in PDFs. The AI-powered approach offers these advantages over traditional methods:

    • Permanent removal — This isn’t just overlays; sensitive text is completely deleted.
    • Context awareness — The API finds entities that simple patterns can miss.
    • Scalable processing — The API handles large document volumes efficiently.
    • Flexible styles — The API fits different review and presentation needs.
    • Auditability — The API supports compliance requirements.

    Ready to get started?

    FAQ

    AI redaction leverages context rather than keywords. For sensitive workflows, start in stage mode to review, and then switch to apply.

    Nutrient DWS Processor API doesn’t store documents — they’re permanently deleted after each operation. All processing occurs over secure HTTPS/TLS connections, and document retention follows your account configuration.

    Yes. AI distinguishes between different contexts (for example, a judge’s name in a caption versus a witness name in testimony). Specialized document types may still require human review.

    Most organizations see ROI quickly. AI processes thousands of documents in the time needed for manual review of just a few. Read more about the business impact of AI redaction.

    Staging mode creates redaction annotations for review before permanent changes. This provides human oversight for sensitive documents while automating detection.

    You’re likely viewing a staged result. "redaction_state": "stage" creates reviewable annotations without deleting content. To permanently remove the text, set "redaction_state": "apply" and rerun.

    Explore related topics

    Try for free Ready to get started?

    Related Cloud articles

    Explore more