paperless-ngx Setup Guide¶
This guide covers configuring paperless-ngx to work with the Records Manager Skill, including API token generation and best practices.
What is paperless-ngx?¶
paperless-ngx is an open-source document management system that provides:
-
OCR (Optical Character Recognition) for searchable documents
-
Tagging and categorization
-
Document type management
-
REST API for automation
The Records Manager Skill uses paperless-ngx as its storage engine, providing intelligent organization on top of paperless-ngx's robust foundation.
Installation¶
If you don't have paperless-ngx installed, follow the official installation guide.
Recommended deployment methods:
-
Docker Compose - Easiest for self-hosting
-
Kubernetes - For production environments
-
Cloud hosting - Various providers offer pre-configured paperless-ngx
PAI User Security Best Practices¶
Tip
Security First: Create a Dedicated PAI User
For enhanced security, create a dedicated user in paperless-ngx for the Records Manager Skill with limited permissions. This provides isolation and auditability.
Step 1: Create a Dedicated PAI User¶
Why create a dedicated user?
-
Isolation: Separates automated operations from human activities
-
Auditability: Clear tracking of AI-assisted document management
-
Safety: Can restrict permissions to prevent accidental bulk deletions
-
Compliance: Easier to demonstrate proper access controls
Steps to create the PAI user:
-
Log in to paperless-ngx as administrator
-
Navigate to Settings → Users
-
Create new user:
-
Username:
pai-records-manager(or descriptive name) -
Email:
pai@yourdomain.com(or monitoring email) -
Password: Generate strong random password
-
Groups: Assign to appropriate groups (see below)
-
Set user permissions:
-
Can add documents: ✅ Enable
-
Can change document tags: ✅ Enable
-
Can view documents: ✅ Enable
-
Can delete documents: ❌ DISABLE (critical safety feature)
-
Create API token for this user:
-
Log in as the PAI user
-
Navigate to Settings → Tokens
-
Create token with Read/Write permissions
-
Copy token for Records Manager configuration
Step 2: Configure Group-Based Entity Access¶
For multi-entity deployments (household + corporate + trusts), use groups to isolate document access:
Create groups:
-
Navigate to Settings → Groups
-
Create groups for each entity:
-
household-access -
corporate-access -
trust-access
Assign PAI user to groups:
-
Assign the PAI user to all groups it needs to manage
-
Each group can have different permissions per entity
Configure entity-level access:
# Example group permissions in paperless-ngx
household-access:
* Can view: household documents
* Can tag: household documents
* Cannot delete: any documents
corporate-access:
* Can view: corporate documents
* Can tag: corporate documents
* Cannot delete: any documents
Step 3: Verify Security Configuration¶
Test the PAI user setup:
- Test read access:
- Test write access:
bun run src/skills/RecordsManager/Tools/RecordManager.ts upload \
--file test.pdf \
--domain household
- Verify deletion is blocked:
# This should require Deletion Auditor approval
bun run src/skills/RecordsManager/Tools/RecordManager.ts delete \
--id <test-document-id>
Expected outcome:
-
✅ Read operations work
-
✅ Upload and tagging work
-
❌ Direct deletion is blocked (requires Deletion Auditor workflow)
Step 4: Monitor PAI User Activity¶
Regular monitoring tasks:
-
Review access logs in paperless-ngx:
-
Settings → Logs → User Activity
-
Filter by PAI user
-
Check for unusual activity
-
Audit document changes:
-
Review tags added by PAI user
-
Verify document uploads are expected
-
Check for failed deletion attempts
-
Set up alerts (if available):
-
Alert on bulk operations (e.g., >10 documents in 5 minutes)
-
Alert on deletion attempts
-
Alert on failed authentication
Security Checklist¶
-
Created dedicated PAI user in paperless-ngx
-
Disabled direct deletion permissions for PAI user
-
Assigned PAI user to appropriate groups
-
Created API token for PAI user (not admin token)
-
Verified PAI user can upload and tag documents
-
Verified PAI user cannot directly delete documents
-
Set up monitoring for PAI user activity
-
Documented PAI user credentials in secure location
-
Scheduled periodic permission reviews (quarterly)
Warning
IMPORTANT: The PAI user should NOT have delete permissions in paperless-ngx. All deletions must go through the Deletion Auditor workflow, which provides explicit confirmation and audit logging.
Configuration for Records Manager¶
1. Generate API Token¶
The Records Manager Skill requires an API token with Read/Write permissions.
Steps:
-
Log in to your paperless-ngx instance
-
Navigate to Settings → Tokens
-
Click + New Token
-
Configure the token:
-
Name:
Records Manager(or descriptive name) -
Permissions: Enable both Read and Write
-
Expiry: Optional (recommended: no expiry for automated use)
-
Click Create
-
Copy the token immediately - it won't be shown again
![Token creation screenshot placeholder]
2. Configure Environment Variables¶
Add the paperless-ngx configuration to your $PAI_DIR/.env file:
MADEINOZ_RECORDMANAGER_PAPERLESS_URL="https://paperless.example.com"
MADEINOZ_RECORDMANAGER_PAPERLESS_API_TOKEN="your-copied-token-here"
Important security notes:
-
Use
https://for remote instances (required for secure token transmission) -
Keep the API token secret - treat it like a password
-
Never commit
.envfiles to version control
3. Verify Connection¶
Test the connection using the status command:
Success output:
Records Manager Status
======================
Paperless-ngx: Connected (https://paperless.example.com)
API Version: v1
Country: Australia
Default Domain: household
Error output: Check the troubleshooting section below.
Recommended paperless-ngx Settings¶
Document Types¶
Create document types that align with your domain. For households:
| Document Type | Description |
|---|---|
| Tax Return | Annual tax returns and assessments |
| Medical Receipt | Healthcare expenses |
| Insurance Policy | Insurance documents |
| Warranty Document | Product warranties |
| Bank Statement | Monthly statements |
| Receipt | General receipts |
Tags Structure¶
Establish a consistent tag hierarchy:
financial/
├── tax
├── income
└── expense
medical/
├── doctor
├── hospital
└── pharmacy
insurance/
├── home
├── contents
└── vehicle
The Records Manager Skill will suggest tags automatically based on your country and domain configuration.
OCR Configuration¶
Ensure OCR is enabled for optimal search:
-
Go to Settings → OCR
-
Enable Automatic OCR for new documents
-
Set OCR Language to your primary language
-
Configure OCR Mode (recommended:
redofor re-processing existing documents)
Storage Path¶
Organize documents in paperless-ngx with a consistent storage path:
Troubleshooting¶
Connection Refused¶
Error: ECONNREFUSED or Connection refused
Solutions:
-
Verify the URL in
.envis correct and accessible -
Check if paperless-ngx is running:
docker ps(if using Docker) -
Test the URL in a browser
-
Check firewall settings
Unauthorized (401)¶
Error: 401 Unauthorized or Invalid API token
Solutions:
-
Verify the API token is copied correctly (no extra spaces)
-
Confirm the token hasn't expired
-
Check that Read/Write permissions are enabled
-
Generate a new token if necessary
SSL Certificate Errors¶
Error: certificate has expired or self-signed certificate
Solutions:
-
For development: Use
http://instead ofhttps:// -
For production: Renew your SSL certificate
-
For self-signed certs: Add the certificate to your system's trust store
CORS Errors¶
Error: CORS policy blocking requests
Solutions:
-
Configure paperless-ngx
CORS_ALLOWED_ORIGINSsetting -
Add your PAI instance domain to allowed origins
Best Practices¶
Security¶
-
Use HTTPS for all remote connections
-
Rotate API tokens periodically (every 6-12 months)
-
Limit token permissions to only what's needed
-
Monitor access logs for suspicious activity
-
Back up regularly - paperless-ngx data should be backed up
Performance¶
-
Enable OCR for all documents (improves search)
-
Use consistent tagging (the Records Manager Skill helps with this)
-
Archive old documents to improve performance
-
Monitor storage - set up alerts for disk space
Maintenance¶
-
Update paperless-ngx regularly for security patches
-
Review retention periods annually
-
Clean up tags - merge duplicates and remove unused
-
Test backups - ensure you can restore if needed
Advanced Configuration¶
Custom Storage Path¶
If using a custom storage path in paperless-ngx, ensure the Records Manager Skill can access it:
Multiple Instances¶
For multiple paperless-ngx instances (e.g., personal vs business), use separate configurations:
# Personal records
MADEINOZ_RECORDMANAGER_PERSONAL_PAPERLESS_URL="https://personal.example.com"
MADEINOZ_RECORDMANAGER_PERSONAL_PAPERLESS_API_TOKEN="..."
# Business records
MADEINOZ_RECORDMANAGER_BUSINESS_PAPERLESS_URL="https://business.example.com"
MADEINOZ_RECORDMANAGER_BUSINESS_PAPERLESS_API_TOKEN="..."
Webhook Configuration¶
Configure webhooks in paperless-ngx to trigger Records Manager actions:
-
Go to Settings → Webhooks
-
Create a new webhook
-
Set the trigger (e.g.,
document_consumed) -
Point to your Records Manager endpoint
Next Steps¶
- Configure environment variables
- Choose your country for compliance rules
- Set up retention policies
Warning
DELETION DISCLAIMER
While the Records Manager Skill provides safety checks, retention guidance, and the Deletion Auditor workflow, you are ultimately responsible for verifying deletions and understanding retention requirements before deleting documents.
The system provides recommendations based on general taxonomies and common retention periods, but these may not apply to your specific situation. You should:
-
Verify retention periods apply to your jurisdiction and use case
-
Consult with legal or tax professionals for compliance-critical documents
-
Understand that deletion is permanent - once deleted, documents cannot be recovered
-
Consider maintaining backups of important documents, even after retention expires
-
Review audit trails regularly to track deletion decisions
The Records Manager Skill provides tools to assist with document management, but compliance is your responsibility.