Nutrient Document Processing
Process documents with the Nutrient DWS Processor API. Convert formats, extract text and tables, OCR scanned documents, redact PII, add watermarks, digitally sign, and fill PDF forms.
Setup
Get a free API key at nutrient.io
bash1export NUTRIENT_API_KEY="pdf_live_..."
All requests go to https://api.nutrient.io/build as multipart POST with an instructions JSON field.
Operations
Convert Documents
bash1# DOCX to PDF 2curl -X POST https://api.nutrient.io/build \ 3 -H "Authorization: Bearer $NUTRIENT_API_KEY" \ 4 -F "document.docx=@document.docx" \ 5 -F 'instructions={"parts":[{"file":"document.docx"}]}' \ 6 -o output.pdf 7 8# PDF to DOCX 9curl -X POST https://api.nutrient.io/build \ 10 -H "Authorization: Bearer $NUTRIENT_API_KEY" \ 11 -F "document.pdf=@document.pdf" \ 12 -F 'instructions={"parts":[{"file":"document.pdf"}],"output":{"type":"docx"}}' \ 13 -o output.docx 14 15# HTML to PDF 16curl -X POST https://api.nutrient.io/build \ 17 -H "Authorization: Bearer $NUTRIENT_API_KEY" \ 18 -F "index.html=@index.html" \ 19 -F 'instructions={"parts":[{"html":"index.html"}]}' \ 20 -o output.pdf
Supported inputs: PDF, DOCX, XLSX, PPTX, DOC, XLS, PPT, PPS, PPSX, ODT, RTF, HTML, JPG, PNG, TIFF, HEIC, GIF, WebP, SVG, TGA, EPS.
Extract Text and Data
bash1# Extract plain text 2curl -X POST https://api.nutrient.io/build \ 3 -H "Authorization: Bearer $NUTRIENT_API_KEY" \ 4 -F "document.pdf=@document.pdf" \ 5 -F 'instructions={"parts":[{"file":"document.pdf"}],"output":{"type":"text"}}' \ 6 -o output.txt 7 8# Extract tables as Excel 9curl -X POST https://api.nutrient.io/build \ 10 -H "Authorization: Bearer $NUTRIENT_API_KEY" \ 11 -F "document.pdf=@document.pdf" \ 12 -F 'instructions={"parts":[{"file":"document.pdf"}],"output":{"type":"xlsx"}}' \ 13 -o tables.xlsx
OCR Scanned Documents
bash1# OCR to searchable PDF (supports 100+ languages) 2curl -X POST https://api.nutrient.io/build \ 3 -H "Authorization: Bearer $NUTRIENT_API_KEY" \ 4 -F "scanned.pdf=@scanned.pdf" \ 5 -F 'instructions={"parts":[{"file":"scanned.pdf"}],"actions":[{"type":"ocr","language":"english"}]}' \ 6 -o searchable.pdf
Languages: Supports 100+ languages via ISO 639-2 codes (e.g., eng, deu, fra, spa, jpn, kor, chi_sim, chi_tra, ara, hin, rus). Full language names like english or german also work. See the complete OCR language table for all supported codes.
Redact Sensitive Information
bash1# Pattern-based (SSN, email) 2curl -X POST https://api.nutrient.io/build \ 3 -H "Authorization: Bearer $NUTRIENT_API_KEY" \ 4 -F "document.pdf=@document.pdf" \ 5 -F 'instructions={"parts":[{"file":"document.pdf"}],"actions":[{"type":"redaction","strategy":"preset","strategyOptions":{"preset":"social-security-number"}},{"type":"redaction","strategy":"preset","strategyOptions":{"preset":"email-address"}}]}' \ 6 -o redacted.pdf 7 8# Regex-based 9curl -X POST https://api.nutrient.io/build \ 10 -H "Authorization: Bearer $NUTRIENT_API_KEY" \ 11 -F "document.pdf=@document.pdf" \ 12 -F 'instructions={"parts":[{"file":"document.pdf"}],"actions":[{"type":"redaction","strategy":"regex","strategyOptions":{"regex":"\\b[A-Z]{2}\\d{6}\\b"}}]}' \ 13 -o redacted.pdf
Presets: social-security-number, email-address, credit-card-number, international-phone-number, north-american-phone-number, date, time, url, ipv4, ipv6, mac-address, us-zip-code, vin.
Add Watermarks
bash1curl -X POST https://api.nutrient.io/build \ 2 -H "Authorization: Bearer $NUTRIENT_API_KEY" \ 3 -F "document.pdf=@document.pdf" \ 4 -F 'instructions={"parts":[{"file":"document.pdf"}],"actions":[{"type":"watermark","text":"CONFIDENTIAL","fontSize":72,"opacity":0.3,"rotation":-45}]}' \ 5 -o watermarked.pdf
Digital Signatures
bash1# Self-signed CMS signature 2curl -X POST https://api.nutrient.io/build \ 3 -H "Authorization: Bearer $NUTRIENT_API_KEY" \ 4 -F "document.pdf=@document.pdf" \ 5 -F 'instructions={"parts":[{"file":"document.pdf"}],"actions":[{"type":"sign","signatureType":"cms"}]}' \ 6 -o signed.pdf
Fill PDF Forms
bash1curl -X POST https://api.nutrient.io/build \ 2 -H "Authorization: Bearer $NUTRIENT_API_KEY" \ 3 -F "form.pdf=@form.pdf" \ 4 -F 'instructions={"parts":[{"file":"form.pdf"}],"actions":[{"type":"fillForm","formFields":{"name":"Jane Smith","email":"jane@example.com","date":"2026-02-06"}}]}' \ 5 -o filled.pdf
MCP Server (Alternative)
For native tool integration, use the MCP server instead of curl:
json1{ 2 "mcpServers": { 3 "nutrient-dws": { 4 "command": "npx", 5 "args": ["-y", "@nutrient-sdk/dws-mcp-server"], 6 "env": { 7 "NUTRIENT_DWS_API_KEY": "YOUR_API_KEY", 8 "SANDBOX_PATH": "/path/to/working/directory" 9 } 10 } 11 } 12}
When to Use
- Converting documents between formats (PDF, DOCX, XLSX, PPTX, HTML, images)
- Extracting text, tables, or key-value pairs from PDFs
- OCR on scanned documents or images
- Redacting PII before sharing documents
- Adding watermarks to drafts or confidential documents
- Digitally signing contracts or agreements
- Filling PDF forms programmatically