Configure¶
Three things make Paperless documents show in Nextcloud's search: a Paperless account that may view them, whose API token goes into the settings of the app; the documents as files of one Nextcloud account, the archive account; and shares of that archive with the users who may find them. This page sets up all three, once the app is installed.
The settings of the app, from the empty form to the first search. The sections below explain each step.
How it works¶
- Nextcloud forwards an enabled external-search query to Paperless-ngx.
- Paperless returns results from its native OCR/full-text index, with only the fields that a result shows: not the whole OCR text of each document, only the excerpt around the term.
- The app maps each Paperless document ID to a synchronized file of the archive account whose name contains the unique marker
[P<ID>], for example[P123], with one search of Nextcloud's file cache for all documents of a page. The archive account is the one that owns the synchronized files: the account of Paperless Sync, or the one of the settings. - A result is returned only if the current Nextcloud user can access that file: the archive account itself, or a user it shared the file with read-only. A file with the marker in its name that belongs to another account stands for no document, and neither does a file of the archive account that the user may change, or one in a folder where the user may add files: through a share with write permission, the user could have given it the marker.
- A page of results holds as many results as Nextcloud asks for while Paperless has more: when documents that the user can't open rank first, the app asks Paperless for its next pages, up to four pages of 25 hits per search, or up to twenty while it has found no result yet, so that Paperless results still show and Load more results keeps working. A next page follows only when the search found a further result that the user may open, and its cursor works only for that user and search; after that budget, the results end, so that they tell nothing about documents of others.
- Each result shows the preview of its file, or the icon of its type, and below its title the date of the document in the language of the user, its correspondent, its type, up to two of its tags and the words around the term, as What a result shows describes.
- Selecting a result opens the synchronized file in Nextcloud, not Paperless. Browsers use Nextcloud's
/f/{fileId}viewer route. The official iOS app receives its nativenextcloud://open-filedeep link, while Android receives the file ID and user-relative path required by its in-app viewer.
Who sees document 412, when paperless is the archive account and has shared its archive read-only with jamie and with write permission with alex:
This app does not synchronize documents itself. The companion app Paperless Sync does, natively and with settings of its own, and any other synchronization that writes the marker into the file names works as well. Both apps use the same stable [P<ID>] marker and are designed to work together without coupling their release cycles.
A Paperless account for the search¶
The search asks Paperless with the API token of one Paperless account, and Paperless answers with the documents that this account may view, and no others. The account thus sets the limit of what anyone in Nextcloud can find: a document that it can't view never shows, whoever searches. Give it a Paperless account of its own that may only view documents, so that a token that leaks can change nothing. The settings set it up with one click, or four steps in Paperless do, which the pictures show in Paperless-ngx 3.
With one click¶
Below the token, open No token yet? Create the search account in Paperless, enter the API token of a superuser of Paperless, and select Create the search account and save. The settings then add the user nextcloud-search to Paperless, which is neither Superuser nor Admin and may only view documents, correspondents, document types, tags, users and its UI settings, with a random password that nobody learns; get its API token; and save the settings with it, together with the URL, the archive account and the switches of the form, once the test of the connection passes. The token of the superuser only sets up the account: it is never stored, logged or sent back to the browser, and it goes only to the Paperless URL of the form, without redirects (decision 0012). As for saving, Nextcloud asks for your password when you haven't confirmed it in the last 30 minutes.
Two choices, both on at first, say what else changes in Paperless. Each only adds the account: whoever may view or change something keeps it.
- Let it view each new document adds the workflow Nextcloud search: view new documents, with the trigger Document Added and an action Assignment that gives the account the permission to view, as under Its documents.
- Let it view what Paperless has adds the account to the permission to view of every document, correspondent, document type and tag that Paperless has, as the bulk editor does with Merge with existing permissions on.
A user nextcloud-search that Paperless has already stays as it is: save the settings with its token, or delete the user in Paperless and try again. Paperless gives a name to one workflow alone, so a workflow Nextcloud search: view new documents, such as the one of an earlier set-up whose user you deleted, stays as it is too, and the set-up stops before it changes anything: delete the workflow in Paperless as well, or turn off Let it view each new document. A set-up that fails halfway removes the user and the workflow again, so that a second try starts afresh; when Paperless refuses that as well, the message names the user or the workflow that remains. Correspondents, types and tags that someone adds later in the web interface of Paperless still need the account in the Default View Permissions of that person, as below says. Paperless takes new permissions into the index of its search a moment later, so right after the set-up a search may find a few documents less for some seconds. Paperless-ngx 2 with its default database, SQLite, updates the documents of each change of permissions in a task of its own and fails a change that comes meanwhile; the set-up then makes that change again after a pause, up to five times within a quarter of a minute, before it gives up. occ paperless_unified_search:setup --create-account does the same in a script (Set up the app). With Let it view what Paperless has, Paperless changes the permissions of each document before it answers, so in an archive of tens of thousands of documents the set-up can take minutes, longer than a reverse proxy in front of Nextcloud waits by default (60 seconds with nginx). The page then shows a network error while the set-up goes on; reload it before you try again, as the account may exist by then. Use occ for such an archive, which no proxy cuts off, or raise the timeout of the proxy.
The steps below set up the same account by hand, for administrators who would rather not enter the token of a superuser in Nextcloud.
The account¶
As an administrator of Paperless, open Users & Groups and add a user, such as nextcloud, that is neither Superuser nor Admin (staff). Under Permissions, give it View for Document, Correspondent, DocumentType, Tag and UISettings, and nothing else, as the picture of step 1 of Configuration, below, shows. The search reads nothing else: it asks for the documents of a term and, of each, only the ID, the title, the date, the IDs of its correspondent, its type, its tags and its owner, and the excerpt around the term; for the names of these correspondents, types and tags, which the results show; and, when the connection is tested, for what the account may do, which Paperless tells only an account that may view its UI settings. When Paperless Sync gives each user the documents that they own, give it View for User as well: the search then reads the list of the users of Paperless and keeps only the ID and username of each, which tell whose files stand for the documents of an owner. What each permission gives the search says what each of them does.
Its documents¶
Paperless lets a user view its own documents, those without an owner, and those whose permissions let the user or one of its groups view them. Documents of another owner, such as every document that an administrator uploads, need the permission to view for the account, or for a group that it is in:
- New documents: open Workflows and add a workflow with the trigger Document Added and an action Assignment that names the account, or its group, under Assign view permissions. Paperless then lets the account view each document as it adds it.
- The documents that Paperless has: select them in the list of documents and grant the account the permission to view them with the bulk editor, under Permissions, with Merge with existing permissions on, which keeps the permissions that they have.
The names of correspondents, types and tags¶
The permission to view correspondents, document types and tags works as the one for documents: the account sees the names of those that it owns, that have no owner, and those that it may view. Whoever adds a correspondent, a type or a tag in the web interface of Paperless owns it, so until the account may view them, the results and the dashboard show no correspondent, no type and no tag. The settings warn about it when the newest documents name one that the account can't see:
- The correspondents, types and tags that Paperless has: open Correspondents, select all of them, select Permissions, add the account under View, Users, and select Confirm with Merge with existing permissions on. Then do the same under Document types and Tags.
- New ones: each administrator of Paperless adds the account under Settings, Permissions, Default View Permissions, Users. Paperless then lets it view each correspondent, type and tag that they add in the web interface.
Its token¶
Sign in to Paperless as the account, open My Profile in the menu of the account, and create the token with the button next to API Auth Token; the button before it copies the token. An administrator of Paperless can also create it for the account in the Django administration of Paperless, at /admin/, under Auth Token.
What each permission gives the search¶
| Permission of the account | What the search does with it | Without it |
|---|---|---|
| View for Document | Finds the documents that the account may view, with the words around the term, also those whose note has the term, such as notes:transfer |
Paperless refuses the token, and the test of the connection fails |
| View for Correspondent | Shows the correspondent of each result and of each document on the dashboard, when the account may view that correspondent | No correspondent in the results and on the dashboard, and the settings warn |
| View for DocumentType | Shows the type of each result and of each document on the dashboard, when the account may view that type | No type in the results and on the dashboard, and the settings warn |
| View for Tag | Shows up to two tags of each result and of each document on the dashboard, of those that the account may view, never the tag of the inbox | No tags in the results and on the dashboard, and the settings warn |
| View for User | Reads the usernames of Paperless, once in ten minutes and at once after a save of the settings and in occ paperless_unified_search:check, when Paperless Sync gives each user the documents that they own: a file of the user whom Paperless Sync gives the owner of a document then stands for it (decision 0013) |
The search shows only the files of the archive account, and the settings warn while Paperless Sync gives each owner an archive |
| View for UISettings | Lets the test of the connection ask Paperless what the account may do, for the warnings about the token | No warnings at all, and occ paperless_unified_search:check says that Paperless doesn't tell |
| View for Note | Nothing: the notes of a document match without it | Nothing is missing |
| Add, Change or Delete | Nothing: the search only reads | Nothing is missing; the settings warn about any of them for documents, and about adding or changing users or changing groups, since whoever gets hold of such a token may change documents too |
The contract tests check this table against real Paperless-ngx 2.20 and 3.x every week and in every pull request that changes the app, together with the workflow and the permissions of the steps above.
To see what the search can find at most, sign in to Paperless as the account and search there: the search of Nextcloud finds the same documents, of which each user then sees those whose files they can open. A token of a superuser works as well, but whoever gets hold of it may also change and delete every document: a view-only account is the safer choice. The test of the connection says so: the settings warn below the token about an account that is a superuser or an admin, or may add, change or delete documents, and about one that may not view correspondents, document types or tags, or those of the newest documents that another user owns, and Troubleshooting says what to do about each warning.
Configuration¶
The settings can create the Paperless account of steps 1 and 2 themselves: below the token, open No token yet? Create the search account in Paperless, enter the API token of a superuser of Paperless, which serves this alone and is never stored, and select Create the search account and save in place of step 10. With one click says what it changes in Paperless.
-
Create a dedicated Paperless account, neither Superuser nor Admin, with only the permissions to view that the search needs: View for Document, for Correspondent, DocumentType and Tag, whose names the results show, and for UISettings, from which the test of the connection learns what the account may do. When Paperless Sync gives each user the documents that they own, add View for User, whose usernames tell whose files stand for a document. Let it view the documents, correspondents, types and tags that another user owns, such as an administrator who adds them; A Paperless account for the search shows each step in Paperless, with a workflow that does it for every new document.
-
Create an API token for that account, in My Profile of Paperless, signed in as the account.
- In Nextcloud, open Administration settings → Paperless Unified Search.
- Enter the Paperless base URL and API token.
- When Nextcloud reaches Paperless at an address of your local network or by the name of its Docker service, such as
http://192.168.1.20:8000orhttp://paperless:8000, select Paperless runs in my local network (below). - Under Archive account, enter the Nextcloud account that owns the synchronized files, or leave it blank to use the account that Paperless Sync writes the archive with. The settings store the ID as Nextcloud spells it, whatever its case, and warn when the account doesn't exist, and when Paperless Sync also gives each user copies of the documents that they may view, which the search doesn't show.
- Optionally enable Always include Paperless in global search to treat the configured Paperless server as trusted.
- Leave Let users include Paperless in all their searches on to let each user include Paperless in every search of their own, in their personal settings, or turn it off.
- Choose with Let users ask for notifications about new documents whether each user can save searches for notifications about new documents in their personal settings. Until you choose, it is on only where Nextcloud has a memory cache.
- Select Test connection and save. Nextcloud asks for your password when you haven't confirmed it in the last 30 minutes, as for its own settings of this kind; so does Disconnect.
Leave the token blank to keep the stored one. The stored token goes only to the Paperless server it was saved for: when the URL names another server, with another scheme, host or port, the settings ask for the token again, so that the token never reaches a server it wasn't meant for. Another path on the same server keeps it. When Nextcloud can no longer decrypt the stored token, as after a move or a restore with another secret in config.php, the settings say so and ask for it again, and until then the search shows no Paperless documents.
The test of the connection also asks Paperless what the account of the token may do. The settings save the token in any case, and warn below it when the account is a superuser or an admin of Paperless or may add, change or delete documents, since whoever gets hold of such a token may do the same, and when it may not view correspondents, document types or tags, or those of the newest documents that another user owns, whose names the results then lack. Paperless says this only to an account that may view its UI settings; for any other, the settings warn about nothing. occ paperless_unified_search:check and the overview of the administration settings repeat the warnings until the next test, and Troubleshooting says what to do about each.
The configuration is global. Access control remains user-specific because the app discards every Paperless hit for which the searching Nextcloud user can't open a matching file of the archive account. Share the archive read-only with the users who may see its documents. Without an archive account, the search shows no Paperless documents. Below the archive account, the settings say with whom it shares its files, such as Shared read-only: 1 user, 2 groups., and warn about each share that allows changes: its recipients don't find the documents in it until it is read-only.
When Paperless documents are missing from the search, look at Search problems at the end of the settings, and for a document that Paperless finds but a user doesn't see, use Try a search below it: enter the term and the user ID, and it lists the first 20 documents that Paperless ranks for the term, each with its ID, its title, its tags and whether it shows to that user, or why not: Shared with write permission, Not shared with the user, Not a file of the archive account, or No file with its marker, such as [P412]. It asks the same questions as occ paperless_unified_search:search --explain, for administrators of a managed instance without a shell, and answers with the titles and tags alone, without the content or the files of the documents. A failed search shows the users no Paperless documents and no error, and a request that fails before it reaches Paperless, as when the connection fails, is sent a second time before the search gives up; one that waited for a Paperless that hangs is not, so that a search never waits twice. After a request that gets no answer at all, because Paperless doesn't answer in time, refuses the connection or its name doesn't resolve, the searches of the next 30 seconds show no Paperless documents without asking it, so that a Paperless that is down doesn't hold the PHP workers of Nextcloud at every keystroke; a test of the connection that Paperless answers, as saving the settings runs it, ends that at once. The settings count both, the failed searches and the requests that only their second try answered, and list the latest 20 with the time, the step, asking Paperless or looking for the files in Nextcloud, the kind and the message of the error and how long it took, along with since when searches work again after the last failure. A query that Paperless refuses while it is still being typed isn't a problem and doesn't show up, and during an outage, also one that comes and goes, the problems of one kind are written at most once in 30 seconds, with those in between still counted. This helps where the hoster keeps the log of Nextcloud from administrators. Clear history and Disconnect forget the history; saving the settings keeps it.
By default, Nextcloud's search in the browser asks Paperless only after the user enables Search connected services, and the smart picker only after the user picks Paperless documents in it. When the trusted-service option is enabled, every global search term from every Nextcloud user is sent to Paperless automatically and the connected-services switch no longer controls this provider. Reload Nextcloud after changing this option. A user can make the same choice for their own searches alone, in the personal settings, while Let users include Paperless in all their searches is on (Usage).
Paperless in your local network¶
Nextcloud refuses to connect to addresses of the local network, such as 192.168.1.20, paperless.local or the name of a Docker service, so that no URL that someone enters can reach the services behind its firewall. Most Paperless servers run at exactly such an address. Select Paperless runs in my local network, and Nextcloud allows the address for the requests of this app to the Paperless URL of the settings, and for nothing else: those requests follow no redirect, and every other app keeps the protection. Without the switch, Test connection and save fails with a message that names it. Enter the address at which Paperless itself answers, such as https://paperless.example.com rather than http://paperless.example.com when a proxy redirects http to https: with the switch, Nextcloud follows no redirect, and a redirect makes the test of the connection fail.
Paperless itself may refuse the name under which Nextcloud reaches it: since Paperless-ngx 3.5, a Paperless that sets PAPERLESS_URL answers only the host name of that URL and localhost, and Test connection and save fails with Paperless does not accept the host name of its URL. Add the name to PAPERLESS_ALLOWED_HOSTS of Paperless and restart it, as its row says.
Don't set allow_local_remote_servers in config.php for Paperless: it lifts the protection for every app and every URL that users can enter, such as link previews, webhooks and the servers of federated shares.
If you set allow_local_remote_servers in config.php for Paperless before, first select Paperless runs in my local network and save, and only then remove it from config.php. Otherwise the search shows no Paperless documents until the switch is saved.
The URL may name a Docker service with an underscore, such as http://paperless_ngx:8000, an IPv6 address in brackets, such as http://[fd00::5]:8000, or an internationalized name, which the settings store in the ASCII form that DNS knows, such as https://xn--bcher-kva.example for https://bücher.example.
When the test of the connection fails¶
Test connection and save saves the connection only once Paperless answers, and the message says what failed. While a connection is stored, it saves the archive account and the three switches all the same, so that you can turn them off while Paperless is down; the URL, the API token and Paperless runs in my local network stay as they were. Troubleshooting lists every message, with what to do about it.
Languages¶
The app speaks English, German, French, Spanish, Dutch, Simplified Chinese and Traditional Chinese as written in Taiwan, each account in its language: the search and its results, the widget on the dashboard, the personal and the administration settings with their messages, the warnings of the overview, and its listing in the App Store. German says du to accounts set to Deutsch (Persönlich: Du) and Sie to accounts set to Deutsch (Förmlich: Sie); French says vous, Spanish tú, Dutch je and Chinese the polite 您, as Nextcloud does in these languages. In every other language, the app speaks English, also in Traditional Chinese as written in Hong Kong, 正體中文(香港), which has no catalog of its own yet.
The French, Spanish, Dutch and Chinese texts were drafted with the help of an AI, with the words of Nextcloud's own translations, such as Rechercher dans les services connectés, 搜索已连接的服务 and 搜尋已連結的服務 for Search connected services, and wait for native speakers to read them. The Traditional Chinese texts take the words used in Taiwan, such as 檔案 for a file and 帳號 for an account, not the Simplified ones in other characters. The Chinese ones use the words of Paperless Sync, the companion of this app, where both name the same thing, so that the pair reads as one. Translate shows how to correct a text or add a language.
Share the archive read-only¶
The archive account decides who finds which document: a user sees a Paperless document when the archive account shares its file with them, alone or with a folder around it. Share read-only, so that nobody changes, moves or deletes a file that the synchronization writes. Paperless Sync can narrow it down further: a user whom it lets see only the documents with some tags finds only those of the shared documents that carry one of them, as the section Tags that a user may see below explains.
- Sign in to Nextcloud as the archive account, such as
paperless, and open Files. - Open the details of the folder of the archive, such as Paperless, and there the tab Sharing.
- Enter the user or the group, and set the share to View only.
- A group gives every member the documents at once, also those who join it later.
- A subfolder, such as
Paperless/ACME, gives someone only the documents in it; Paperless Sync sorts the documents into folders by correspondent, type and year. - The archive account finds every document without a share. An administrator of Nextcloud finds only what is shared with them, as any user does: being an administrator opens no file.
- Only what a user may only read counts: a user who may change a file of the archive, or add files to its folder, finds none of the documents in it, since that user could give a file the marker of any document. Below the archive account, the settings show with whom it shares its files, such as Shared read-only: 1 user, 2 groups., and warn about each share that allows changes, and so do
occ paperless_unified_search:checkand the overview of the administration settings.
A script shares through the OCS API of Nextcloud, with an app password of the archive account: shareType is 0 for a user and 1 for a group, and permissions=1 is read-only.
curl -u paperless -H 'OCS-APIRequest: true' \
-d path=/Paperless -d shareType=1 -d shareWith=accounting -d permissions=1 \
'https://cloud.example.com/ocs/v2.php/apps/files_sharing/api/v1/shares'
Works with any synchronization¶
The search needs one thing from a synchronization: each document of Paperless-ngx as a file of the archive account in Nextcloud, with the marker [P<ID>] of the document in the name of the file. Paperless Sync writes such files, with folders by correspondent, type and year, and so can any other way:
-
Let Paperless put the marker into its file names. The file name format of Paperless has the placeholder
{{ doc_pk }}, the ID of the document. In the environment of Paperless, such as itsdocker-compose.env:PAPERLESS_FILENAME_FORMAT={{ created_year }}/{{ correspondent }}/{{ title }} [P{{ doc_pk }}]Paperless then stores document 412 as
2026/ACME/Invoice [P412].pdf. Its commanddocument_renamerrenames the documents it already has, and each storage path of Paperless needs the marker as well. -
Copy the files to the archive account, one way, from Paperless to Nextcloud. The folder
media/documents/archiveof Paperless holds the PDFs with their recognized text,media/documents/originalsthe files as they came in.-
rclone, or another WebDAV client, on a timer or in a container next to Paperless, with an app password of the archive account
paperless:rclone config create nextcloud webdav vendor=nextcloud \ url=https://cloud.example.com/remote.php/dav/files/paperless/ \ user=paperless pass=app-password --obscure rclone sync /path/to/paperless/media/documents/archive nextcloud:Paperless -
The Nextcloud desktop client, signed in as the archive account, on a copy of the folder rather than the folder itself: it syncs both ways, and Paperless loses track of a file that is moved or deleted in its media folder.
- An external storage with the files, mounted for the archive account alone and shared from there. A mount can't be shared until Enable sharing is switched on in its options, behind the gear of the storage under External storage in the administration settings. Nextcloud's search finds only the files it has scanned, so let a timer run
occ files:scanfor the storage. On a storage mounted for every user, each user owns the files they see there, and such a file stands for no document, unless you trust the storage, as the next point says. - A Team folder, or an external storage mounted for several users or groups. Such a mount has no account of its own: Nextcloud names each user who sees a file there as its owner, so the archive account can't name it. Trust it with
occ paperless_unified_search:trusted-mounts, a Team folder by its ID, asocc groupfolders:listshows it, and an external storage by its mount ID, asocc files_external:listshows it, such asocc paperless_unified_search:trusted-mounts team:3 external:7. A file there then stands for its document for each user who may only read it there, and the settings name the trusted mounts below the shares. A user who may change a file there, or add files to its folder, sees none of its documents, since that user could have given a file any marker: trust only a mount that nobody but the synchronization writes, also outside Nextcloud. An external storage that a user adds in their personal settings never counts, and neither does a file that a user shares out of the mount. The archive account stays: name the account that writes the archive, such as the one of Paperless Sync, and let it see the mount too, since the notifications about new documents wait until it sees the file of a document.
-
-
Share the archive read-only with the users who may find its documents, and enter the archive account in the settings, as in the configuration.
With Who gets the documents set to Each user, those they own in Paperless, Paperless Sync writes the documents of each user into their own files instead, and the search shows those too: a file of the user whom Paperless Sync gives the owner of a document in Paperless stands for that document, besides the files of the archive account, and a file renamed after a document of another owner stands for none. The account of the API token then needs View for User, to learn the usernames of the owners. With Each user, those they own or may view in Paperless, the files of the owners count the same way, but not the copies that Paperless Sync gives the users who may only view a document: such a user finds it through a file of its owner or of the archive account that is shared with them, and the settings, occ paperless_unified_search:check and the overview say so, with what you can do.
Tags that a user may see¶
Since its version 1.9.0, Paperless Sync can let a user see only the documents with some tags of Paperless: its setting Tags that a user may see takes a line for each such user, such as katja = Katja, Household. The search reads the same lines, so the administrator sets them in one place, and shows such a user only the documents that carry at least one of their tags in Paperless, whatever the case of the names, in the search, the smart picker, on the dashboard and in the notifications:
- The tags that Paperless sends with each document decide, never a file: a share of the archive that shows the user more, made by hand before, changes nothing, and neither does a file of theirs renamed after another document. Paperless Sync lists such shares in its settings so that you can remove them.
- Their own copies, which Paperless Sync writes while the archive account is its target user, stand for the documents with their tags, as do the files of the archive account that are shared with them read-only.
- A user without a line, such as you as the administrator, and every installation without Paperless Sync, sees what they saw before.
- A tag removed in Paperless hides its document from the user with the next search. While Paperless has none of their tags, after a typo or a rename, or the account of the API token may not view tags, such a user finds no document at all, never every document.
The administration settings list the users with tags below the archive account, and Try a search and occ paperless_unified_search:search --explain name a document without one of their tags Not among the tags that katja may see (not tagged).
The user reads it too: the section Paperless of their personal settings begins with Your administrator lets you find only the documents that have one of these tags in Paperless: Katja, Household., and shows for such a user even when you let users choose neither of its settings, so that a search that comes back empty for another document doesn't look broken.
Check that it works¶
- Sign in as a user with whom the archive is shared, or as the archive account.
- Open Nextcloud's search and search for a word from the text of a document, one that isn't in its file name.
- Switch on Search connected services: the document shows under Paperless documents, and selecting it opens its file.
No Paperless documents? Troubleshooting finds the cause step by step.

