easypaperless.resources

Resource Classes

The following resource classes are _internal classes. Methods can be accessed via the instance of easypaperless.PaperlessClient or easypaperless.SyncPaperlessClient

Example:

async with PaperlessClient(url="http://localhost:8000", api_token="abc") as client: docs = await client.documents.list(max_results=10)

 1"""Resource Classes
 2
 3The following resource classes are _internal classes. Methods can be accessed via the instance of
 4`easypaperless.PaperlessClient` or `easypaperless.SyncPaperlessClient`
 5
 6Example:
 7    async with PaperlessClient(url="http://localhost:8000", api_token="abc") as client:
 8        docs = await client.documents.list(max_results=10)
 9
10"""
11
12# internal comment: the doc string above is also rendered in the pdoc documentation.
13#
14# original was:
15#
16# Public resource classes — for type annotations and IDE support.
17#
18# Re-exports all async and sync resource classes from the internal modules
19# so that pdoc can document them as a full page with all methods.
20#
21# Example:
22#    from easypaperless.resources import DocumentsResource
23
24from easypaperless._internal.resources.correspondents import CorrespondentsResource
25from easypaperless._internal.resources.custom_fields import CustomFieldsResource
26from easypaperless._internal.resources.document_types import DocumentTypesResource
27from easypaperless._internal.resources.documents import DocumentsResource, NotesResource
28from easypaperless._internal.resources.storage_paths import StoragePathsResource
29from easypaperless._internal.resources.tags import TagsResource
30from easypaperless._internal.resources.trash import TrashResource
31from easypaperless._internal.resources.users import UsersResource
32from easypaperless._internal.sync_resources.correspondents import SyncCorrespondentsResource
33from easypaperless._internal.sync_resources.custom_fields import SyncCustomFieldsResource
34from easypaperless._internal.sync_resources.document_types import SyncDocumentTypesResource
35from easypaperless._internal.sync_resources.documents import (
36    SyncDocumentsResource,
37    SyncNotesResource,
38)
39from easypaperless._internal.sync_resources.storage_paths import SyncStoragePathsResource
40from easypaperless._internal.sync_resources.tags import SyncTagsResource
41from easypaperless._internal.sync_resources.trash import SyncTrashResource
42from easypaperless._internal.sync_resources.users import SyncUsersResource
43
44__all__ = [
45    "CorrespondentsResource",
46    "CustomFieldsResource",
47    "DocumentTypesResource",
48    "DocumentsResource",
49    "NotesResource",
50    "StoragePathsResource",
51    "TagsResource",
52    "SyncCorrespondentsResource",
53    "SyncCustomFieldsResource",
54    "SyncDocumentTypesResource",
55    "SyncDocumentsResource",
56    "SyncNotesResource",
57    "SyncStoragePathsResource",
58    "SyncTagsResource",
59    "UsersResource",
60    "SyncUsersResource",
61    "TrashResource",
62    "SyncTrashResource",
63]
class CorrespondentsResource:
 21class CorrespondentsResource:
 22    """Accessor for correspondents: ``client.correspondents``."""
 23
 24    def __init__(self, core: _ClientCore) -> None:
 25        self._core = core
 26
 27    async def list(
 28        self,
 29        *,
 30        ids: List[int] | None = None,
 31        name_contains: str | None = None,
 32        name_exact: str | None = None,
 33        page: int | None = None,
 34        page_size: int | None = None,
 35        ordering: str | None = None,
 36        descending: bool = False,
 37    ) -> PagedResult[Correspondent]:
 38        """Return correspondents defined in paperless-ngx.
 39
 40        When ``page`` is ``None`` (the default), all pages are fetched
 41        automatically and ``next`` / ``previous`` in the result are always
 42        ``None``.  When ``page`` is set, only that page is fetched and
 43        ``next`` / ``previous`` reflect the raw API values.
 44
 45        Args:
 46            ids: Return only correspondents whose ID is in this list.
 47            name_contains: Case-insensitive substring filter on name.
 48            name_exact: Case-insensitive exact match on name.
 49            page: Return only this specific page (1-based).
 50            page_size: Number of results per page.
 51            ordering: Field to sort by.
 52            descending: When ``True``, reverses the sort direction.
 53
 54        Returns:
 55            :class:`~easypaperless.models.paged_result.PagedResult` of
 56            :class:`~easypaperless.models.correspondents.Correspondent` objects.
 57        """
 58        logger.info("Listing correspondents")
 59        params: dict[str, Any] = {}
 60        if ids is not None:
 61            params["id__in"] = ",".join(str(i) for i in ids)
 62        if name_contains is not None:
 63            params["name__icontains"] = name_contains
 64        if name_exact is not None:
 65            params["name__iexact"] = name_exact
 66        if page is not None:
 67            params["page"] = page
 68        if page_size is not None:
 69            params["page_size"] = page_size
 70        if ordering is not None:
 71            params["ordering"] = f"-{ordering}" if descending else ordering
 72        return cast(
 73            PagedResult[Correspondent],
 74            await self._core._list_resource("correspondents", Correspondent, params or None),
 75        )
 76
 77    async def get(self, id: int) -> Correspondent:
 78        """Fetch a single correspondent by its ID.
 79
 80        Args:
 81            id: Numeric correspondent ID.
 82
 83        Returns:
 84            The :class:`~easypaperless.models.correspondents.Correspondent` with the given ID.
 85
 86        Raises:
 87            ~easypaperless.exceptions.NotFoundError: If no correspondent exists with that ID.
 88        """
 89        logger.info("Getting correspondent id=%d", id)
 90        return cast(
 91            Correspondent, await self._core._get_resource("correspondents", id, Correspondent)
 92        )
 93
 94    async def create(
 95        self,
 96        *,
 97        name: str,
 98        match: str | Unset = UNSET,
 99        matching_algorithm: MatchingAlgorithm | Unset = UNSET,
100        is_insensitive: bool = True,
101        owner: int | None | Unset = UNSET,
102        set_permissions: SetPermissions | None | Unset = UNSET,
103    ) -> Correspondent:
104        """Create a new correspondent.
105
106        Args:
107            name: Correspondent name. Must be unique.
108            match: Auto-matching pattern.
109            matching_algorithm: Controls how ``match`` is applied.
110                E.g. ``matching_algorithm=MatchingAlgorithm.REGEX`` for
111                regular-expression matching.
112            is_insensitive: When ``True``, ``match`` is case-insensitive.
113                Defaults to ``True``, matching the paperless-ngx API default.
114            owner: Numeric user ID to assign as owner.
115            set_permissions: Explicit view/change permission sets.
116                Pass ``None`` to create with empty permissions.
117
118        Returns:
119            The newly created :class:`~easypaperless.models.correspondents.Correspondent`.
120        """
121        logger.info("Creating correspondent name=%r", name)
122        return cast(
123            Correspondent,
124            await self._core._create_resource(
125                "correspondents",
126                Correspondent,
127                owner=owner,
128                set_permissions=set_permissions,
129                name=name,
130                match=match,
131                matching_algorithm=matching_algorithm,
132                is_insensitive=is_insensitive,
133            ),
134        )
135
136    async def update(
137        self,
138        id: int,
139        *,
140        name: str | Unset = UNSET,
141        match: str | Unset = UNSET,
142        matching_algorithm: MatchingAlgorithm | Unset = UNSET,
143        is_insensitive: bool | Unset = UNSET,
144        owner: int | None | Unset = UNSET,
145        set_permissions: SetPermissions | None | Unset = UNSET,
146    ) -> Correspondent:
147        """Partially update a correspondent (PATCH semantics).
148
149        Args:
150            id: Numeric ID of the correspondent to update.
151            name: Correspondent name.
152            match: Auto-matching pattern.
153            matching_algorithm: Controls how ``match`` is applied.
154                E.g. ``matching_algorithm=MatchingAlgorithm.REGEX`` for
155                regular-expression matching.
156            is_insensitive: When ``True``, ``match`` is case-insensitive.
157            owner: Numeric user ID to assign as owner.
158                Pass ``None`` to clear the owner.
159                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
160            set_permissions: Explicit view/change permission sets.
161                Pass ``None`` to clear all permissions (overwrite with empty).
162                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
163
164        Returns:
165            The updated :class:`~easypaperless.models.correspondents.Correspondent`.
166        """
167        logger.info("Updating correspondent id=%d", id)
168        return cast(
169            Correspondent,
170            await self._core._update_resource(
171                "correspondents",
172                id,
173                Correspondent,
174                name=name,
175                match=match,
176                matching_algorithm=matching_algorithm,
177                is_insensitive=is_insensitive,
178                owner=owner,
179                set_permissions=set_permissions,
180            ),
181        )
182
183    async def delete(self, id: int) -> None:
184        """Delete a correspondent.
185
186        Args:
187            id: Numeric ID of the correspondent to delete.
188
189        Raises:
190            ~easypaperless.exceptions.NotFoundError: If no correspondent exists with that ID.
191        """
192        logger.info("Deleting correspondent id=%d", id)
193        await self._core._delete_resource("correspondents", id)
194
195    async def bulk_delete(self, ids: List[int]) -> None:
196        """Permanently delete multiple correspondents in a single request.
197
198        Args:
199            ids: List of correspondent IDs to delete.
200        """
201        logger.info("Bulk deleting %d correspondents", len(ids))
202        await self._core._bulk_edit_objects("correspondents", ids, "delete")
203
204    async def bulk_set_permissions(
205        self,
206        ids: List[int],
207        *,
208        set_permissions: SetPermissions | Unset = UNSET,
209        owner: int | None | Unset = UNSET,
210        merge: bool = False,
211    ) -> None:
212        """Set permissions and/or owner on multiple correspondents.
213
214        Args:
215            ids: List of correspondent IDs to modify.
216            set_permissions: Explicit view/change permission sets.
217                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
218            owner: Numeric user ID to assign as owner.
219                Pass ``None`` to clear the owner.
220                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
221            merge: When ``True``, new permissions are merged with existing ones.
222        """
223        logger.info("Bulk setting permissions on %d correspondents", len(ids))
224        params: dict[str, Any] = {"merge": merge}
225        if not isinstance(set_permissions, Unset):
226            params["permissions"] = set_permissions.model_dump()
227        if not isinstance(owner, Unset):
228            params["owner"] = owner
229        await self._core._bulk_edit_objects("correspondents", ids, "set_permissions", **params)

Accessor for correspondents: client.correspondents.

CorrespondentsResource(core: easypaperless.client._ClientCore)
24    def __init__(self, core: _ClientCore) -> None:
25        self._core = core
async def list( self, *, ids: Optional[List[int]] = None, name_contains: str | None = None, name_exact: str | None = None, page: int | None = None, page_size: int | None = None, ordering: str | None = None, descending: bool = False) -> easypaperless.PagedResult[Correspondent]:
27    async def list(
28        self,
29        *,
30        ids: List[int] | None = None,
31        name_contains: str | None = None,
32        name_exact: str | None = None,
33        page: int | None = None,
34        page_size: int | None = None,
35        ordering: str | None = None,
36        descending: bool = False,
37    ) -> PagedResult[Correspondent]:
38        """Return correspondents defined in paperless-ngx.
39
40        When ``page`` is ``None`` (the default), all pages are fetched
41        automatically and ``next`` / ``previous`` in the result are always
42        ``None``.  When ``page`` is set, only that page is fetched and
43        ``next`` / ``previous`` reflect the raw API values.
44
45        Args:
46            ids: Return only correspondents whose ID is in this list.
47            name_contains: Case-insensitive substring filter on name.
48            name_exact: Case-insensitive exact match on name.
49            page: Return only this specific page (1-based).
50            page_size: Number of results per page.
51            ordering: Field to sort by.
52            descending: When ``True``, reverses the sort direction.
53
54        Returns:
55            :class:`~easypaperless.models.paged_result.PagedResult` of
56            :class:`~easypaperless.models.correspondents.Correspondent` objects.
57        """
58        logger.info("Listing correspondents")
59        params: dict[str, Any] = {}
60        if ids is not None:
61            params["id__in"] = ",".join(str(i) for i in ids)
62        if name_contains is not None:
63            params["name__icontains"] = name_contains
64        if name_exact is not None:
65            params["name__iexact"] = name_exact
66        if page is not None:
67            params["page"] = page
68        if page_size is not None:
69            params["page_size"] = page_size
70        if ordering is not None:
71            params["ordering"] = f"-{ordering}" if descending else ordering
72        return cast(
73            PagedResult[Correspondent],
74            await self._core._list_resource("correspondents", Correspondent, params or None),
75        )

Return correspondents defined in paperless-ngx.

When page is None (the default), all pages are fetched automatically and next / previous in the result are always None. When page is set, only that page is fetched and next / previous reflect the raw API values.

Arguments:
  • ids: Return only correspondents whose ID is in this list.
  • name_contains: Case-insensitive substring filter on name.
  • name_exact: Case-insensitive exact match on name.
  • page: Return only this specific page (1-based).
  • page_size: Number of results per page.
  • ordering: Field to sort by.
  • descending: When True, reverses the sort direction.
Returns:

~easypaperless.models.paged_result.PagedResult of ~easypaperless.models.correspondents.Correspondent objects.

async def get(self, id: int) -> easypaperless.Correspondent:
77    async def get(self, id: int) -> Correspondent:
78        """Fetch a single correspondent by its ID.
79
80        Args:
81            id: Numeric correspondent ID.
82
83        Returns:
84            The :class:`~easypaperless.models.correspondents.Correspondent` with the given ID.
85
86        Raises:
87            ~easypaperless.exceptions.NotFoundError: If no correspondent exists with that ID.
88        """
89        logger.info("Getting correspondent id=%d", id)
90        return cast(
91            Correspondent, await self._core._get_resource("correspondents", id, Correspondent)
92        )

Fetch a single correspondent by its ID.

Arguments:
  • id: Numeric correspondent ID.
Returns:

The ~easypaperless.models.correspondents.Correspondent with the given ID.

Raises:
async def create( self, *, name: str, match: str | easypaperless.Unset = UNSET, matching_algorithm: easypaperless.MatchingAlgorithm | easypaperless.Unset = UNSET, is_insensitive: bool = True, owner: int | None | easypaperless.Unset = UNSET, set_permissions: easypaperless.SetPermissions | None | easypaperless.Unset = UNSET) -> easypaperless.Correspondent:
 94    async def create(
 95        self,
 96        *,
 97        name: str,
 98        match: str | Unset = UNSET,
 99        matching_algorithm: MatchingAlgorithm | Unset = UNSET,
100        is_insensitive: bool = True,
101        owner: int | None | Unset = UNSET,
102        set_permissions: SetPermissions | None | Unset = UNSET,
103    ) -> Correspondent:
104        """Create a new correspondent.
105
106        Args:
107            name: Correspondent name. Must be unique.
108            match: Auto-matching pattern.
109            matching_algorithm: Controls how ``match`` is applied.
110                E.g. ``matching_algorithm=MatchingAlgorithm.REGEX`` for
111                regular-expression matching.
112            is_insensitive: When ``True``, ``match`` is case-insensitive.
113                Defaults to ``True``, matching the paperless-ngx API default.
114            owner: Numeric user ID to assign as owner.
115            set_permissions: Explicit view/change permission sets.
116                Pass ``None`` to create with empty permissions.
117
118        Returns:
119            The newly created :class:`~easypaperless.models.correspondents.Correspondent`.
120        """
121        logger.info("Creating correspondent name=%r", name)
122        return cast(
123            Correspondent,
124            await self._core._create_resource(
125                "correspondents",
126                Correspondent,
127                owner=owner,
128                set_permissions=set_permissions,
129                name=name,
130                match=match,
131                matching_algorithm=matching_algorithm,
132                is_insensitive=is_insensitive,
133            ),
134        )

Create a new correspondent.

Arguments:
  • name: Correspondent name. Must be unique.
  • match: Auto-matching pattern.
  • matching_algorithm: Controls how match is applied. E.g. matching_algorithm=MatchingAlgorithm.REGEX for regular-expression matching.
  • is_insensitive: When True, match is case-insensitive. Defaults to True, matching the paperless-ngx API default.
  • owner: Numeric user ID to assign as owner.
  • set_permissions: Explicit view/change permission sets. Pass None to create with empty permissions.
Returns:

The newly created ~easypaperless.models.correspondents.Correspondent.

async def update( self, id: int, *, name: str | easypaperless.Unset = UNSET, match: str | easypaperless.Unset = UNSET, matching_algorithm: easypaperless.MatchingAlgorithm | easypaperless.Unset = UNSET, is_insensitive: bool | easypaperless.Unset = UNSET, owner: int | None | easypaperless.Unset = UNSET, set_permissions: easypaperless.SetPermissions | None | easypaperless.Unset = UNSET) -> easypaperless.Correspondent:
136    async def update(
137        self,
138        id: int,
139        *,
140        name: str | Unset = UNSET,
141        match: str | Unset = UNSET,
142        matching_algorithm: MatchingAlgorithm | Unset = UNSET,
143        is_insensitive: bool | Unset = UNSET,
144        owner: int | None | Unset = UNSET,
145        set_permissions: SetPermissions | None | Unset = UNSET,
146    ) -> Correspondent:
147        """Partially update a correspondent (PATCH semantics).
148
149        Args:
150            id: Numeric ID of the correspondent to update.
151            name: Correspondent name.
152            match: Auto-matching pattern.
153            matching_algorithm: Controls how ``match`` is applied.
154                E.g. ``matching_algorithm=MatchingAlgorithm.REGEX`` for
155                regular-expression matching.
156            is_insensitive: When ``True``, ``match`` is case-insensitive.
157            owner: Numeric user ID to assign as owner.
158                Pass ``None`` to clear the owner.
159                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
160            set_permissions: Explicit view/change permission sets.
161                Pass ``None`` to clear all permissions (overwrite with empty).
162                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
163
164        Returns:
165            The updated :class:`~easypaperless.models.correspondents.Correspondent`.
166        """
167        logger.info("Updating correspondent id=%d", id)
168        return cast(
169            Correspondent,
170            await self._core._update_resource(
171                "correspondents",
172                id,
173                Correspondent,
174                name=name,
175                match=match,
176                matching_algorithm=matching_algorithm,
177                is_insensitive=is_insensitive,
178                owner=owner,
179                set_permissions=set_permissions,
180            ),
181        )

Partially update a correspondent (PATCH semantics).

Arguments:
  • id: Numeric ID of the correspondent to update.
  • name: Correspondent name.
  • match: Auto-matching pattern.
  • matching_algorithm: Controls how match is applied. E.g. matching_algorithm=MatchingAlgorithm.REGEX for regular-expression matching.
  • is_insensitive: When True, match is case-insensitive.
  • owner: Numeric user ID to assign as owner. Pass None to clear the owner. Omit (or pass ~easypaperless.UNSET) to leave unchanged.
  • set_permissions: Explicit view/change permission sets. Pass None to clear all permissions (overwrite with empty). Omit (or pass ~easypaperless.UNSET) to leave unchanged.
Returns:

The updated ~easypaperless.models.correspondents.Correspondent.

async def delete(self, id: int) -> None:
183    async def delete(self, id: int) -> None:
184        """Delete a correspondent.
185
186        Args:
187            id: Numeric ID of the correspondent to delete.
188
189        Raises:
190            ~easypaperless.exceptions.NotFoundError: If no correspondent exists with that ID.
191        """
192        logger.info("Deleting correspondent id=%d", id)
193        await self._core._delete_resource("correspondents", id)

Delete a correspondent.

Arguments:
  • id: Numeric ID of the correspondent to delete.
Raises:
async def bulk_delete(self, ids: List[int]) -> None:
195    async def bulk_delete(self, ids: List[int]) -> None:
196        """Permanently delete multiple correspondents in a single request.
197
198        Args:
199            ids: List of correspondent IDs to delete.
200        """
201        logger.info("Bulk deleting %d correspondents", len(ids))
202        await self._core._bulk_edit_objects("correspondents", ids, "delete")

Permanently delete multiple correspondents in a single request.

Arguments:
  • ids: List of correspondent IDs to delete.
async def bulk_set_permissions( self, ids: List[int], *, set_permissions: easypaperless.SetPermissions | easypaperless.Unset = UNSET, owner: int | None | easypaperless.Unset = UNSET, merge: bool = False) -> None:
204    async def bulk_set_permissions(
205        self,
206        ids: List[int],
207        *,
208        set_permissions: SetPermissions | Unset = UNSET,
209        owner: int | None | Unset = UNSET,
210        merge: bool = False,
211    ) -> None:
212        """Set permissions and/or owner on multiple correspondents.
213
214        Args:
215            ids: List of correspondent IDs to modify.
216            set_permissions: Explicit view/change permission sets.
217                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
218            owner: Numeric user ID to assign as owner.
219                Pass ``None`` to clear the owner.
220                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
221            merge: When ``True``, new permissions are merged with existing ones.
222        """
223        logger.info("Bulk setting permissions on %d correspondents", len(ids))
224        params: dict[str, Any] = {"merge": merge}
225        if not isinstance(set_permissions, Unset):
226            params["permissions"] = set_permissions.model_dump()
227        if not isinstance(owner, Unset):
228            params["owner"] = owner
229        await self._core._bulk_edit_objects("correspondents", ids, "set_permissions", **params)

Set permissions and/or owner on multiple correspondents.

Arguments:
  • ids: List of correspondent IDs to modify.
  • set_permissions: Explicit view/change permission sets. Omit (or pass ~easypaperless.UNSET) to leave unchanged.
  • owner: Numeric user ID to assign as owner. Pass None to clear the owner. Omit (or pass ~easypaperless.UNSET) to leave unchanged.
  • merge: When True, new permissions are merged with existing ones.
class CustomFieldsResource:
 20class CustomFieldsResource:
 21    """Accessor for custom fields: ``client.custom_fields``."""
 22
 23    def __init__(self, core: _ClientCore) -> None:
 24        self._core = core
 25
 26    async def list(
 27        self,
 28        *,
 29        name_contains: str | None = None,
 30        name_exact: str | None = None,
 31        page: int | None = None,
 32        page_size: int | None = None,
 33        ordering: str | None = None,
 34        descending: bool = False,
 35    ) -> PagedResult[CustomField]:
 36        """Return all custom fields defined in paperless-ngx.
 37
 38        When ``page`` is ``None`` (the default), all pages are fetched
 39        automatically and ``next`` / ``previous`` in the result are always
 40        ``None``.  When ``page`` is set, only that page is fetched and
 41        ``next`` / ``previous`` reflect the raw API values.
 42
 43        Args:
 44            name_contains: Case-insensitive substring filter on name.
 45            name_exact: Case-insensitive exact match on name.
 46            page: Return only this specific page (1-based).
 47            page_size: Number of results per page.
 48            ordering: Field to sort by.
 49            descending: When ``True``, reverses the sort direction.
 50
 51        Returns:
 52            :class:`~easypaperless.models.paged_result.PagedResult` of
 53            :class:`~easypaperless.models.custom_fields.CustomField` objects.
 54        """
 55        logger.info("Listing custom fields")
 56        params: dict[str, Any] = {}
 57        if name_contains is not None:
 58            params["name__icontains"] = name_contains
 59        if name_exact is not None:
 60            params["name__iexact"] = name_exact
 61        if page is not None:
 62            params["page"] = page
 63        if page_size is not None:
 64            params["page_size"] = page_size
 65        if ordering is not None:
 66            params["ordering"] = f"-{ordering}" if descending else ordering
 67        return cast(
 68            PagedResult[CustomField],
 69            await self._core._list_resource("custom_fields", CustomField, params or None),
 70        )
 71
 72    async def get(self, id: int) -> CustomField:
 73        """Fetch a single custom field by its ID.
 74
 75        Args:
 76            id: Numeric custom-field ID.
 77
 78        Returns:
 79            The :class:`~easypaperless.models.custom_fields.CustomField` with the given ID.
 80
 81        Raises:
 82            ~easypaperless.exceptions.NotFoundError: If no custom field exists with that ID.
 83        """
 84        logger.info("Getting custom field id=%d", id)
 85        return cast(CustomField, await self._core._get_resource("custom_fields", id, CustomField))
 86
 87    async def create(
 88        self,
 89        *,
 90        name: str,
 91        data_type: str,
 92        extra_data: Any | None = None,
 93        owner: int | None | Unset = UNSET,
 94        set_permissions: SetPermissions | None | Unset = UNSET,
 95    ) -> CustomField:
 96        """Create a new custom field.
 97
 98        Args:
 99            name: Field name shown in the UI. Must be unique.
100            data_type: Value type. One of ``"string"``, ``"boolean"``,
101                ``"integer"``, ``"float"``, ``"monetary"``, ``"date"``,
102                ``"url"``, ``"documentlink"``, ``"select"``.
103            extra_data: Additional configuration for the field type.
104            owner: Numeric user ID to assign as owner.
105            set_permissions: Explicit view/change permission sets.
106                Pass ``None`` to create with empty permissions.
107
108        Returns:
109            The newly created :class:`~easypaperless.models.custom_fields.CustomField`.
110        """
111        logger.info("Creating custom field name=%r data_type=%r", name, data_type)
112        return cast(
113            CustomField,
114            await self._core._create_resource(
115                "custom_fields",
116                CustomField,
117                owner=owner,
118                set_permissions=set_permissions,
119                name=name,
120                data_type=data_type,
121                extra_data=extra_data,
122            ),
123        )
124
125    async def update(
126        self,
127        id: int,
128        *,
129        name: str | Unset = UNSET,
130        data_type: str | Unset = UNSET,
131        extra_data: Any | None | Unset = UNSET,
132        owner: int | None | Unset = UNSET,
133        set_permissions: SetPermissions | None | Unset = UNSET,
134    ) -> CustomField:
135        """Partially update a custom field (PATCH semantics).
136
137        Args:
138            id: Numeric ID of the custom field to update.
139            name: Field name shown in the UI.
140            data_type: Value type (e.g. ``"string"``, ``"boolean"``, ``"integer"``).
141                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
142            extra_data: Additional configuration for the field type.
143            owner: Numeric user ID to assign as owner.
144                Pass ``None`` to clear the owner.
145                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
146            set_permissions: Explicit view/change permission sets.
147                Pass ``None`` to clear all permissions (overwrite with empty).
148                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
149
150        Returns:
151            The updated :class:`~easypaperless.models.custom_fields.CustomField`.
152        """
153        logger.info("Updating custom field id=%d", id)
154        return cast(
155            CustomField,
156            await self._core._update_resource(
157                "custom_fields",
158                id,
159                CustomField,
160                name=name,
161                data_type=data_type,
162                extra_data=extra_data,
163                owner=owner,
164                set_permissions=set_permissions,
165            ),
166        )
167
168    async def delete(self, id: int) -> None:
169        """Delete a custom field.
170
171        Args:
172            id: Numeric ID of the custom field to delete.
173
174        Raises:
175            ~easypaperless.exceptions.NotFoundError: If no custom field exists with that ID.
176        """
177        logger.info("Deleting custom field id=%d", id)
178        await self._core._delete_resource("custom_fields", id)

Accessor for custom fields: client.custom_fields.

CustomFieldsResource(core: easypaperless.client._ClientCore)
23    def __init__(self, core: _ClientCore) -> None:
24        self._core = core
async def list( self, *, name_contains: str | None = None, name_exact: str | None = None, page: int | None = None, page_size: int | None = None, ordering: str | None = None, descending: bool = False) -> easypaperless.PagedResult[CustomField]:
26    async def list(
27        self,
28        *,
29        name_contains: str | None = None,
30        name_exact: str | None = None,
31        page: int | None = None,
32        page_size: int | None = None,
33        ordering: str | None = None,
34        descending: bool = False,
35    ) -> PagedResult[CustomField]:
36        """Return all custom fields defined in paperless-ngx.
37
38        When ``page`` is ``None`` (the default), all pages are fetched
39        automatically and ``next`` / ``previous`` in the result are always
40        ``None``.  When ``page`` is set, only that page is fetched and
41        ``next`` / ``previous`` reflect the raw API values.
42
43        Args:
44            name_contains: Case-insensitive substring filter on name.
45            name_exact: Case-insensitive exact match on name.
46            page: Return only this specific page (1-based).
47            page_size: Number of results per page.
48            ordering: Field to sort by.
49            descending: When ``True``, reverses the sort direction.
50
51        Returns:
52            :class:`~easypaperless.models.paged_result.PagedResult` of
53            :class:`~easypaperless.models.custom_fields.CustomField` objects.
54        """
55        logger.info("Listing custom fields")
56        params: dict[str, Any] = {}
57        if name_contains is not None:
58            params["name__icontains"] = name_contains
59        if name_exact is not None:
60            params["name__iexact"] = name_exact
61        if page is not None:
62            params["page"] = page
63        if page_size is not None:
64            params["page_size"] = page_size
65        if ordering is not None:
66            params["ordering"] = f"-{ordering}" if descending else ordering
67        return cast(
68            PagedResult[CustomField],
69            await self._core._list_resource("custom_fields", CustomField, params or None),
70        )

Return all custom fields defined in paperless-ngx.

When page is None (the default), all pages are fetched automatically and next / previous in the result are always None. When page is set, only that page is fetched and next / previous reflect the raw API values.

Arguments:
  • name_contains: Case-insensitive substring filter on name.
  • name_exact: Case-insensitive exact match on name.
  • page: Return only this specific page (1-based).
  • page_size: Number of results per page.
  • ordering: Field to sort by.
  • descending: When True, reverses the sort direction.
Returns:

~easypaperless.models.paged_result.PagedResult of ~easypaperless.models.custom_fields.CustomField objects.

async def get(self, id: int) -> easypaperless.CustomField:
72    async def get(self, id: int) -> CustomField:
73        """Fetch a single custom field by its ID.
74
75        Args:
76            id: Numeric custom-field ID.
77
78        Returns:
79            The :class:`~easypaperless.models.custom_fields.CustomField` with the given ID.
80
81        Raises:
82            ~easypaperless.exceptions.NotFoundError: If no custom field exists with that ID.
83        """
84        logger.info("Getting custom field id=%d", id)
85        return cast(CustomField, await self._core._get_resource("custom_fields", id, CustomField))

Fetch a single custom field by its ID.

Arguments:
  • id: Numeric custom-field ID.
Returns:

The ~easypaperless.models.custom_fields.CustomField with the given ID.

Raises:
async def create( self, *, name: str, data_type: str, extra_data: typing.Any | None = None, owner: int | None | easypaperless.Unset = UNSET, set_permissions: easypaperless.SetPermissions | None | easypaperless.Unset = UNSET) -> easypaperless.CustomField:
 87    async def create(
 88        self,
 89        *,
 90        name: str,
 91        data_type: str,
 92        extra_data: Any | None = None,
 93        owner: int | None | Unset = UNSET,
 94        set_permissions: SetPermissions | None | Unset = UNSET,
 95    ) -> CustomField:
 96        """Create a new custom field.
 97
 98        Args:
 99            name: Field name shown in the UI. Must be unique.
100            data_type: Value type. One of ``"string"``, ``"boolean"``,
101                ``"integer"``, ``"float"``, ``"monetary"``, ``"date"``,
102                ``"url"``, ``"documentlink"``, ``"select"``.
103            extra_data: Additional configuration for the field type.
104            owner: Numeric user ID to assign as owner.
105            set_permissions: Explicit view/change permission sets.
106                Pass ``None`` to create with empty permissions.
107
108        Returns:
109            The newly created :class:`~easypaperless.models.custom_fields.CustomField`.
110        """
111        logger.info("Creating custom field name=%r data_type=%r", name, data_type)
112        return cast(
113            CustomField,
114            await self._core._create_resource(
115                "custom_fields",
116                CustomField,
117                owner=owner,
118                set_permissions=set_permissions,
119                name=name,
120                data_type=data_type,
121                extra_data=extra_data,
122            ),
123        )

Create a new custom field.

Arguments:
  • name: Field name shown in the UI. Must be unique.
  • data_type: Value type. One of "string", "boolean", "integer", "float", "monetary", "date", "url", "documentlink", "select".
  • extra_data: Additional configuration for the field type.
  • owner: Numeric user ID to assign as owner.
  • set_permissions: Explicit view/change permission sets. Pass None to create with empty permissions.
Returns:

The newly created ~easypaperless.models.custom_fields.CustomField.

async def update( self, id: int, *, name: str | easypaperless.Unset = UNSET, data_type: str | easypaperless.Unset = UNSET, extra_data: typing.Any | None | easypaperless.Unset = UNSET, owner: int | None | easypaperless.Unset = UNSET, set_permissions: easypaperless.SetPermissions | None | easypaperless.Unset = UNSET) -> easypaperless.CustomField:
125    async def update(
126        self,
127        id: int,
128        *,
129        name: str | Unset = UNSET,
130        data_type: str | Unset = UNSET,
131        extra_data: Any | None | Unset = UNSET,
132        owner: int | None | Unset = UNSET,
133        set_permissions: SetPermissions | None | Unset = UNSET,
134    ) -> CustomField:
135        """Partially update a custom field (PATCH semantics).
136
137        Args:
138            id: Numeric ID of the custom field to update.
139            name: Field name shown in the UI.
140            data_type: Value type (e.g. ``"string"``, ``"boolean"``, ``"integer"``).
141                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
142            extra_data: Additional configuration for the field type.
143            owner: Numeric user ID to assign as owner.
144                Pass ``None`` to clear the owner.
145                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
146            set_permissions: Explicit view/change permission sets.
147                Pass ``None`` to clear all permissions (overwrite with empty).
148                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
149
150        Returns:
151            The updated :class:`~easypaperless.models.custom_fields.CustomField`.
152        """
153        logger.info("Updating custom field id=%d", id)
154        return cast(
155            CustomField,
156            await self._core._update_resource(
157                "custom_fields",
158                id,
159                CustomField,
160                name=name,
161                data_type=data_type,
162                extra_data=extra_data,
163                owner=owner,
164                set_permissions=set_permissions,
165            ),
166        )

Partially update a custom field (PATCH semantics).

Arguments:
  • id: Numeric ID of the custom field to update.
  • name: Field name shown in the UI.
  • data_type: Value type (e.g. "string", "boolean", "integer"). Omit (or pass ~easypaperless.UNSET) to leave unchanged.
  • extra_data: Additional configuration for the field type.
  • owner: Numeric user ID to assign as owner. Pass None to clear the owner. Omit (or pass ~easypaperless.UNSET) to leave unchanged.
  • set_permissions: Explicit view/change permission sets. Pass None to clear all permissions (overwrite with empty). Omit (or pass ~easypaperless.UNSET) to leave unchanged.
Returns:

The updated ~easypaperless.models.custom_fields.CustomField.

async def delete(self, id: int) -> None:
168    async def delete(self, id: int) -> None:
169        """Delete a custom field.
170
171        Args:
172            id: Numeric ID of the custom field to delete.
173
174        Raises:
175            ~easypaperless.exceptions.NotFoundError: If no custom field exists with that ID.
176        """
177        logger.info("Deleting custom field id=%d", id)
178        await self._core._delete_resource("custom_fields", id)

Delete a custom field.

Arguments:
  • id: Numeric ID of the custom field to delete.
Raises:
class DocumentTypesResource:
 21class DocumentTypesResource:
 22    """Accessor for document types: ``client.document_types``."""
 23
 24    def __init__(self, core: _ClientCore) -> None:
 25        self._core = core
 26
 27    async def list(
 28        self,
 29        *,
 30        ids: List[int] | None = None,
 31        name_contains: str | None = None,
 32        name_exact: str | None = None,
 33        page: int | None = None,
 34        page_size: int | None = None,
 35        ordering: str | None = None,
 36        descending: bool = False,
 37    ) -> PagedResult[DocumentType]:
 38        """Return document types defined in paperless-ngx.
 39
 40        When ``page`` is ``None`` (the default), all pages are fetched
 41        automatically and ``next`` / ``previous`` in the result are always
 42        ``None``.  When ``page`` is set, only that page is fetched and
 43        ``next`` / ``previous`` reflect the raw API values.
 44
 45        Args:
 46            ids: Return only document types whose ID is in this list.
 47            name_contains: Case-insensitive substring filter on name.
 48            name_exact: Case-insensitive exact match on name.
 49            page: Return only this specific page (1-based).
 50            page_size: Number of results per page.
 51            ordering: Field to sort by.
 52            descending: When ``True``, reverses the sort direction.
 53
 54        Returns:
 55            :class:`~easypaperless.models.paged_result.PagedResult` of
 56            :class:`~easypaperless.models.document_types.DocumentType` objects.
 57        """
 58        logger.info("Listing document types")
 59        params: dict[str, Any] = {}
 60        if ids is not None:
 61            params["id__in"] = ",".join(str(i) for i in ids)
 62        if name_contains is not None:
 63            params["name__icontains"] = name_contains
 64        if name_exact is not None:
 65            params["name__iexact"] = name_exact
 66        if page is not None:
 67            params["page"] = page
 68        if page_size is not None:
 69            params["page_size"] = page_size
 70        if ordering is not None:
 71            params["ordering"] = f"-{ordering}" if descending else ordering
 72        return cast(
 73            PagedResult[DocumentType],
 74            await self._core._list_resource("document_types", DocumentType, params or None),
 75        )
 76
 77    async def get(self, id: int) -> DocumentType:
 78        """Fetch a single document type by its ID.
 79
 80        Args:
 81            id: Numeric document-type ID.
 82
 83        Returns:
 84            The :class:`~easypaperless.models.document_types.DocumentType` with the given ID.
 85
 86        Raises:
 87            ~easypaperless.exceptions.NotFoundError: If no document type exists with that ID.
 88        """
 89        logger.info("Getting document type id=%d", id)
 90        return cast(
 91            DocumentType, await self._core._get_resource("document_types", id, DocumentType)
 92        )
 93
 94    async def create(
 95        self,
 96        *,
 97        name: str,
 98        match: str | Unset = UNSET,
 99        matching_algorithm: MatchingAlgorithm | Unset = UNSET,
100        is_insensitive: bool = True,
101        owner: int | None | Unset = UNSET,
102        set_permissions: SetPermissions | None | Unset = UNSET,
103    ) -> DocumentType:
104        """Create a new document type.
105
106        Args:
107            name: Document-type name. Must be unique.
108            match: Auto-matching pattern.
109            matching_algorithm: Controls how ``match`` is applied.
110                E.g. ``matching_algorithm=MatchingAlgorithm.REGEX`` for
111                regular-expression matching.
112            is_insensitive: When ``True``, ``match`` is case-insensitive.
113                Defaults to ``True``, matching the paperless-ngx API default.
114            owner: Numeric user ID to assign as owner.
115            set_permissions: Explicit view/change permission sets.
116                Pass ``None`` to create with empty permissions.
117
118        Returns:
119            The newly created :class:`~easypaperless.models.document_types.DocumentType`.
120        """
121        logger.info("Creating document type name=%r", name)
122        return cast(
123            DocumentType,
124            await self._core._create_resource(
125                "document_types",
126                DocumentType,
127                owner=owner,
128                set_permissions=set_permissions,
129                name=name,
130                match=match,
131                matching_algorithm=matching_algorithm,
132                is_insensitive=is_insensitive,
133            ),
134        )
135
136    async def update(
137        self,
138        id: int,
139        *,
140        name: str | Unset = UNSET,
141        match: str | Unset = UNSET,
142        matching_algorithm: MatchingAlgorithm | Unset = UNSET,
143        is_insensitive: bool | Unset = UNSET,
144        owner: int | None | Unset = UNSET,
145        set_permissions: SetPermissions | None | Unset = UNSET,
146    ) -> DocumentType:
147        """Partially update a document type (PATCH semantics).
148
149        Args:
150            id: Numeric ID of the document type to update.
151            name: Document-type name.
152            match: Auto-matching pattern.
153            matching_algorithm: Controls how ``match`` is applied.
154                E.g. ``matching_algorithm=MatchingAlgorithm.REGEX`` for
155                regular-expression matching.
156            is_insensitive: When ``True``, ``match`` is case-insensitive.
157            owner: Numeric user ID to assign as owner.
158                Pass ``None`` to clear the owner.
159                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
160            set_permissions: Explicit view/change permission sets.
161                Pass ``None`` to clear all permissions (overwrite with empty).
162                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
163
164        Returns:
165            The updated :class:`~easypaperless.models.document_types.DocumentType`.
166        """
167        logger.info("Updating document type id=%d", id)
168        return cast(
169            DocumentType,
170            await self._core._update_resource(
171                "document_types",
172                id,
173                DocumentType,
174                name=name,
175                match=match,
176                matching_algorithm=matching_algorithm,
177                is_insensitive=is_insensitive,
178                owner=owner,
179                set_permissions=set_permissions,
180            ),
181        )
182
183    async def delete(self, id: int) -> None:
184        """Delete a document type.
185
186        Args:
187            id: Numeric ID of the document type to delete.
188
189        Raises:
190            ~easypaperless.exceptions.NotFoundError: If no document type exists with that ID.
191        """
192        logger.info("Deleting document type id=%d", id)
193        await self._core._delete_resource("document_types", id)
194
195    async def bulk_delete(self, ids: List[int]) -> None:
196        """Permanently delete multiple document types in a single request.
197
198        Args:
199            ids: List of document type IDs to delete.
200        """
201        logger.info("Bulk deleting %d document types", len(ids))
202        await self._core._bulk_edit_objects("document_types", ids, "delete")
203
204    async def bulk_set_permissions(
205        self,
206        ids: List[int],
207        *,
208        set_permissions: SetPermissions | Unset = UNSET,
209        owner: int | None | Unset = UNSET,
210        merge: bool = False,
211    ) -> None:
212        """Set permissions and/or owner on multiple document types.
213
214        Args:
215            ids: List of document type IDs to modify.
216            set_permissions: Explicit view/change permission sets.
217                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
218            owner: Numeric user ID to assign as owner.
219                Pass ``None`` to clear the owner.
220                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
221            merge: When ``True``, new permissions are merged with existing ones.
222        """
223        logger.info("Bulk setting permissions on %d document types", len(ids))
224        params: dict[str, Any] = {"merge": merge}
225        if not isinstance(set_permissions, Unset):
226            params["permissions"] = set_permissions.model_dump()
227        if not isinstance(owner, Unset):
228            params["owner"] = owner
229        await self._core._bulk_edit_objects("document_types", ids, "set_permissions", **params)

Accessor for document types: client.document_types.

DocumentTypesResource(core: easypaperless.client._ClientCore)
24    def __init__(self, core: _ClientCore) -> None:
25        self._core = core
async def list( self, *, ids: Optional[List[int]] = None, name_contains: str | None = None, name_exact: str | None = None, page: int | None = None, page_size: int | None = None, ordering: str | None = None, descending: bool = False) -> easypaperless.PagedResult[DocumentType]:
27    async def list(
28        self,
29        *,
30        ids: List[int] | None = None,
31        name_contains: str | None = None,
32        name_exact: str | None = None,
33        page: int | None = None,
34        page_size: int | None = None,
35        ordering: str | None = None,
36        descending: bool = False,
37    ) -> PagedResult[DocumentType]:
38        """Return document types defined in paperless-ngx.
39
40        When ``page`` is ``None`` (the default), all pages are fetched
41        automatically and ``next`` / ``previous`` in the result are always
42        ``None``.  When ``page`` is set, only that page is fetched and
43        ``next`` / ``previous`` reflect the raw API values.
44
45        Args:
46            ids: Return only document types whose ID is in this list.
47            name_contains: Case-insensitive substring filter on name.
48            name_exact: Case-insensitive exact match on name.
49            page: Return only this specific page (1-based).
50            page_size: Number of results per page.
51            ordering: Field to sort by.
52            descending: When ``True``, reverses the sort direction.
53
54        Returns:
55            :class:`~easypaperless.models.paged_result.PagedResult` of
56            :class:`~easypaperless.models.document_types.DocumentType` objects.
57        """
58        logger.info("Listing document types")
59        params: dict[str, Any] = {}
60        if ids is not None:
61            params["id__in"] = ",".join(str(i) for i in ids)
62        if name_contains is not None:
63            params["name__icontains"] = name_contains
64        if name_exact is not None:
65            params["name__iexact"] = name_exact
66        if page is not None:
67            params["page"] = page
68        if page_size is not None:
69            params["page_size"] = page_size
70        if ordering is not None:
71            params["ordering"] = f"-{ordering}" if descending else ordering
72        return cast(
73            PagedResult[DocumentType],
74            await self._core._list_resource("document_types", DocumentType, params or None),
75        )

Return document types defined in paperless-ngx.

When page is None (the default), all pages are fetched automatically and next / previous in the result are always None. When page is set, only that page is fetched and next / previous reflect the raw API values.

Arguments:
  • ids: Return only document types whose ID is in this list.
  • name_contains: Case-insensitive substring filter on name.
  • name_exact: Case-insensitive exact match on name.
  • page: Return only this specific page (1-based).
  • page_size: Number of results per page.
  • ordering: Field to sort by.
  • descending: When True, reverses the sort direction.
Returns:

~easypaperless.models.paged_result.PagedResult of ~easypaperless.models.document_types.DocumentType objects.

async def get(self, id: int) -> easypaperless.DocumentType:
77    async def get(self, id: int) -> DocumentType:
78        """Fetch a single document type by its ID.
79
80        Args:
81            id: Numeric document-type ID.
82
83        Returns:
84            The :class:`~easypaperless.models.document_types.DocumentType` with the given ID.
85
86        Raises:
87            ~easypaperless.exceptions.NotFoundError: If no document type exists with that ID.
88        """
89        logger.info("Getting document type id=%d", id)
90        return cast(
91            DocumentType, await self._core._get_resource("document_types", id, DocumentType)
92        )

Fetch a single document type by its ID.

Arguments:
  • id: Numeric document-type ID.
Returns:

The ~easypaperless.models.document_types.DocumentType with the given ID.

Raises:
async def create( self, *, name: str, match: str | easypaperless.Unset = UNSET, matching_algorithm: easypaperless.MatchingAlgorithm | easypaperless.Unset = UNSET, is_insensitive: bool = True, owner: int | None | easypaperless.Unset = UNSET, set_permissions: easypaperless.SetPermissions | None | easypaperless.Unset = UNSET) -> easypaperless.DocumentType:
 94    async def create(
 95        self,
 96        *,
 97        name: str,
 98        match: str | Unset = UNSET,
 99        matching_algorithm: MatchingAlgorithm | Unset = UNSET,
100        is_insensitive: bool = True,
101        owner: int | None | Unset = UNSET,
102        set_permissions: SetPermissions | None | Unset = UNSET,
103    ) -> DocumentType:
104        """Create a new document type.
105
106        Args:
107            name: Document-type name. Must be unique.
108            match: Auto-matching pattern.
109            matching_algorithm: Controls how ``match`` is applied.
110                E.g. ``matching_algorithm=MatchingAlgorithm.REGEX`` for
111                regular-expression matching.
112            is_insensitive: When ``True``, ``match`` is case-insensitive.
113                Defaults to ``True``, matching the paperless-ngx API default.
114            owner: Numeric user ID to assign as owner.
115            set_permissions: Explicit view/change permission sets.
116                Pass ``None`` to create with empty permissions.
117
118        Returns:
119            The newly created :class:`~easypaperless.models.document_types.DocumentType`.
120        """
121        logger.info("Creating document type name=%r", name)
122        return cast(
123            DocumentType,
124            await self._core._create_resource(
125                "document_types",
126                DocumentType,
127                owner=owner,
128                set_permissions=set_permissions,
129                name=name,
130                match=match,
131                matching_algorithm=matching_algorithm,
132                is_insensitive=is_insensitive,
133            ),
134        )

Create a new document type.

Arguments:
  • name: Document-type name. Must be unique.
  • match: Auto-matching pattern.
  • matching_algorithm: Controls how match is applied. E.g. matching_algorithm=MatchingAlgorithm.REGEX for regular-expression matching.
  • is_insensitive: When True, match is case-insensitive. Defaults to True, matching the paperless-ngx API default.
  • owner: Numeric user ID to assign as owner.
  • set_permissions: Explicit view/change permission sets. Pass None to create with empty permissions.
Returns:

The newly created ~easypaperless.models.document_types.DocumentType.

async def update( self, id: int, *, name: str | easypaperless.Unset = UNSET, match: str | easypaperless.Unset = UNSET, matching_algorithm: easypaperless.MatchingAlgorithm | easypaperless.Unset = UNSET, is_insensitive: bool | easypaperless.Unset = UNSET, owner: int | None | easypaperless.Unset = UNSET, set_permissions: easypaperless.SetPermissions | None | easypaperless.Unset = UNSET) -> easypaperless.DocumentType:
136    async def update(
137        self,
138        id: int,
139        *,
140        name: str | Unset = UNSET,
141        match: str | Unset = UNSET,
142        matching_algorithm: MatchingAlgorithm | Unset = UNSET,
143        is_insensitive: bool | Unset = UNSET,
144        owner: int | None | Unset = UNSET,
145        set_permissions: SetPermissions | None | Unset = UNSET,
146    ) -> DocumentType:
147        """Partially update a document type (PATCH semantics).
148
149        Args:
150            id: Numeric ID of the document type to update.
151            name: Document-type name.
152            match: Auto-matching pattern.
153            matching_algorithm: Controls how ``match`` is applied.
154                E.g. ``matching_algorithm=MatchingAlgorithm.REGEX`` for
155                regular-expression matching.
156            is_insensitive: When ``True``, ``match`` is case-insensitive.
157            owner: Numeric user ID to assign as owner.
158                Pass ``None`` to clear the owner.
159                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
160            set_permissions: Explicit view/change permission sets.
161                Pass ``None`` to clear all permissions (overwrite with empty).
162                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
163
164        Returns:
165            The updated :class:`~easypaperless.models.document_types.DocumentType`.
166        """
167        logger.info("Updating document type id=%d", id)
168        return cast(
169            DocumentType,
170            await self._core._update_resource(
171                "document_types",
172                id,
173                DocumentType,
174                name=name,
175                match=match,
176                matching_algorithm=matching_algorithm,
177                is_insensitive=is_insensitive,
178                owner=owner,
179                set_permissions=set_permissions,
180            ),
181        )

Partially update a document type (PATCH semantics).

Arguments:
  • id: Numeric ID of the document type to update.
  • name: Document-type name.
  • match: Auto-matching pattern.
  • matching_algorithm: Controls how match is applied. E.g. matching_algorithm=MatchingAlgorithm.REGEX for regular-expression matching.
  • is_insensitive: When True, match is case-insensitive.
  • owner: Numeric user ID to assign as owner. Pass None to clear the owner. Omit (or pass ~easypaperless.UNSET) to leave unchanged.
  • set_permissions: Explicit view/change permission sets. Pass None to clear all permissions (overwrite with empty). Omit (or pass ~easypaperless.UNSET) to leave unchanged.
Returns:

The updated ~easypaperless.models.document_types.DocumentType.

async def delete(self, id: int) -> None:
183    async def delete(self, id: int) -> None:
184        """Delete a document type.
185
186        Args:
187            id: Numeric ID of the document type to delete.
188
189        Raises:
190            ~easypaperless.exceptions.NotFoundError: If no document type exists with that ID.
191        """
192        logger.info("Deleting document type id=%d", id)
193        await self._core._delete_resource("document_types", id)

Delete a document type.

Arguments:
  • id: Numeric ID of the document type to delete.
Raises:
async def bulk_delete(self, ids: List[int]) -> None:
195    async def bulk_delete(self, ids: List[int]) -> None:
196        """Permanently delete multiple document types in a single request.
197
198        Args:
199            ids: List of document type IDs to delete.
200        """
201        logger.info("Bulk deleting %d document types", len(ids))
202        await self._core._bulk_edit_objects("document_types", ids, "delete")

Permanently delete multiple document types in a single request.

Arguments:
  • ids: List of document type IDs to delete.
async def bulk_set_permissions( self, ids: List[int], *, set_permissions: easypaperless.SetPermissions | easypaperless.Unset = UNSET, owner: int | None | easypaperless.Unset = UNSET, merge: bool = False) -> None:
204    async def bulk_set_permissions(
205        self,
206        ids: List[int],
207        *,
208        set_permissions: SetPermissions | Unset = UNSET,
209        owner: int | None | Unset = UNSET,
210        merge: bool = False,
211    ) -> None:
212        """Set permissions and/or owner on multiple document types.
213
214        Args:
215            ids: List of document type IDs to modify.
216            set_permissions: Explicit view/change permission sets.
217                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
218            owner: Numeric user ID to assign as owner.
219                Pass ``None`` to clear the owner.
220                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
221            merge: When ``True``, new permissions are merged with existing ones.
222        """
223        logger.info("Bulk setting permissions on %d document types", len(ids))
224        params: dict[str, Any] = {"merge": merge}
225        if not isinstance(set_permissions, Unset):
226            params["permissions"] = set_permissions.model_dump()
227        if not isinstance(owner, Unset):
228            params["owner"] = owner
229        await self._core._bulk_edit_objects("document_types", ids, "set_permissions", **params)

Set permissions and/or owner on multiple document types.

Arguments:
  • ids: List of document type IDs to modify.
  • set_permissions: Explicit view/change permission sets. Omit (or pass ~easypaperless.UNSET) to leave unchanged.
  • owner: Numeric user ID to assign as owner. Pass None to clear the owner. Omit (or pass ~easypaperless.UNSET) to leave unchanged.
  • merge: When True, new permissions are merged with existing ones.
class DocumentsResource:
175class DocumentsResource:
176    """Accessor for documents: ``client.documents``."""
177
178    def __init__(self, core: _ClientCore) -> None:
179        self._core = core
180        self.notes = NotesResource(core)
181
182    @staticmethod
183    def _format_date_value(value: date | datetime | str) -> str:
184        if isinstance(value, datetime):
185            return value.isoformat()
186        if isinstance(value, date):
187            return value.isoformat()
188        return value
189
190    @staticmethod
191    def _is_datetime(value: date | datetime | str) -> bool:
192        if isinstance(value, datetime):
193            return True
194        if isinstance(value, str):
195            return bool(_DATETIME_STR_RE.match(value))
196        return False
197
198    async def get(self, id: int, *, include_metadata: bool = False) -> Document:
199        """Fetch a single document by its ID.
200
201        Args:
202            id: Numeric paperless-ngx document ID.
203            include_metadata: When ``True``, the extended file-level metadata
204                is fetched concurrently and attached to the document.
205                Default: ``False``.
206
207        Returns:
208            The :class:`~easypaperless.models.documents.Document` with the
209            given ID.
210
211        Raises:
212            ~easypaperless.exceptions.NotFoundError: If no document exists
213                with that ID.
214        """
215        logger.info("Getting document id=%d", id)
216        if include_metadata:
217            doc_resp, meta_resp = await asyncio.gather(
218                self._core._session.get(f"/documents/{id}/"),
219                self._core._session.get(f"/documents/{id}/metadata/"),
220            )
221            data = doc_resp.json()
222            data["metadata"] = meta_resp.json()
223        else:
224            resp = await self._core._session.get(f"/documents/{id}/")
225            data = resp.json()
226        return Document.model_validate(data)
227
228    async def get_metadata(self, id: int) -> DocumentMetadata:
229        """Fetch the extended file-level metadata for a document.
230
231        Args:
232            id: Numeric paperless-ngx document ID.
233
234        Returns:
235            A :class:`~easypaperless.models.documents.DocumentMetadata` instance.
236
237        Raises:
238            ~easypaperless.exceptions.NotFoundError: If no document exists
239                with that ID.
240        """
241        logger.info("Getting metadata for document id=%d", id)
242        resp = await self._core._session.get(f"/documents/{id}/metadata/")
243        return DocumentMetadata.model_validate(resp.json())
244
245    async def list(
246        self,
247        *,
248        search: str | None = None,
249        search_mode: str = "title_or_content",
250        ids: List[int] | None = None,
251        tags: List[int | str] | None = None,
252        any_tags: List[int | str] | None = None,
253        exclude_tags: List[int | str] | None = None,
254        correspondent: int | str | None | Unset = UNSET,
255        any_correspondent: List[int | str] | None = None,
256        exclude_correspondents: List[int | str] | None = None,
257        document_type: int | str | None | Unset = UNSET,
258        document_type_name_contains: str | None = None,
259        document_type_name_exact: str | None = None,
260        any_document_type: List[int | str] | None = None,
261        exclude_document_types: List[int | str] | None = None,
262        storage_path: int | str | None | Unset = UNSET,
263        any_storage_paths: List[int | str] | None = None,
264        exclude_storage_paths: List[int | str] | None = None,
265        owner: int | None | Unset = UNSET,
266        exclude_owners: List[int] | None = None,
267        custom_fields: List[int | str] | None = None,
268        any_custom_fields: List[int | str] | None = None,
269        exclude_custom_fields: List[int | str] | None = None,
270        custom_field_query: List[Any] | None = None,
271        archive_serial_number: int | None | Unset = UNSET,
272        archive_serial_number_from: int | None = None,
273        archive_serial_number_till: int | None = None,
274        created_after: date | str | None = None,
275        created_before: date | str | None = None,
276        added_after: date | datetime | str | None = None,
277        added_from: date | datetime | str | None = None,
278        added_before: date | datetime | str | None = None,
279        added_until: date | datetime | str | None = None,
280        modified_after: date | datetime | str | None = None,
281        modified_from: date | datetime | str | None = None,
282        modified_before: date | datetime | str | None = None,
283        modified_until: date | datetime | str | None = None,
284        checksum: str | None = None,
285        page_size: int = 25,
286        page: int | None = None,
287        ordering: str | None = None,
288        descending: bool = False,
289        max_results: int | None = None,
290        on_page: Callable[[int, int | None], None] | None = None,
291    ) -> PagedResult[Document]:
292        """Return a filtered list of documents.
293
294        All tag, correspondent, document-type, storage-path, and custom-field
295        parameters accept either integer IDs or string names.
296
297        When ``page`` is ``None`` (the default), all pages are fetched
298        automatically and ``next`` / ``previous`` in the returned
299        :class:`~easypaperless.models.paged_result.PagedResult` are always
300        ``None`` — even if ``max_results`` truncates the final result set.
301        ``count`` always reflects the server total, not the truncated length.
302        When ``page`` is set to a specific integer, only that one page is
303        fetched and ``next`` / ``previous`` contain the raw API values.
304
305        Args:
306            search: Search string.  Behaviour depends on ``search_mode``.
307            search_mode: How ``search`` is applied.  One of:
308                ``"title_or_content"`` *(default)*, ``"title"``, ``"query"``,
309                ``"original_filename"``.
310            ids: Return only documents whose ID is in this list.
311            tags: Documents must have **all** of these tags (AND semantics).
312            any_tags: Documents must have **at least one** of these tags.
313            exclude_tags: Documents must have **none** of these tags.
314            correspondent: Filter to documents assigned to this correspondent.
315                Pass ``None`` to return only documents with no correspondent set.
316            any_correspondent: Filter to documents assigned to any of these.
317            exclude_correspondents: Exclude documents assigned to any of these.
318            document_type: Filter to documents of exactly this type.
319                Pass ``None`` to return only documents with no document type set.
320            document_type_name_contains: Case-insensitive substring filter on document type name.
321            document_type_name_exact: Case-insensitive exact match on document type name.
322            any_document_type: Filter to documents whose type is any of these.
323            exclude_document_types: Exclude documents whose type is any of these.
324            storage_path: Filter to documents assigned to this storage path.
325                Pass ``None`` to return only documents with no storage path set.
326            any_storage_paths: Filter to documents assigned to any of these paths.
327            exclude_storage_paths: Exclude documents assigned to any of these paths.
328            owner: Filter to documents owned by this user ID.
329                Pass ``None`` to return only documents with no owner set.
330            exclude_owners: Exclude documents owned by any of these user IDs.
331            custom_fields: Documents must have **all** of these custom fields set.
332            any_custom_fields: Documents must have **at least one** of these fields.
333            exclude_custom_fields: Documents must have **none** of these fields.
334            custom_field_query: Filter documents by custom field values using a nested
335                query structure. See the `paperless-ngx API docs
336                <https://docs.paperless-ngx.com/api/#filtering-by-custom-fields>`_ for
337                the query format.
338            archive_serial_number: Filter by exact archive serial number.
339                Pass ``None`` to return only documents with no ASN set.
340            archive_serial_number_from: Filter by ASN >= this value.
341            archive_serial_number_till: Filter by ASN <= this value.
342            created_after: Only documents created after this date.
343                String input must be ISO-8601: ``"YYYY-MM-DD"``.
344            created_before: Only documents created before this date.
345                String input must be ISO-8601: ``"YYYY-MM-DD"``.
346            added_after: Only documents added after this date/time.
347                String input must be ISO-8601: ``"YYYY-MM-DD"`` for date precision or
348                ``"YYYY-MM-DDTHH:MM:SS"`` for datetime precision.
349            added_from: Only documents added on or after this date/time.
350                String input must be ISO-8601: ``"YYYY-MM-DD"`` or ``"YYYY-MM-DDTHH:MM:SS"``.
351            added_before: Only documents added before this date/time.
352                String input must be ISO-8601: ``"YYYY-MM-DD"`` or ``"YYYY-MM-DDTHH:MM:SS"``.
353            added_until: Only documents added on or before this date/time.
354                String input must be ISO-8601: ``"YYYY-MM-DD"`` or ``"YYYY-MM-DDTHH:MM:SS"``.
355            modified_after: Only documents modified after this date/time.
356                String input must be ISO-8601: ``"YYYY-MM-DD"`` or ``"YYYY-MM-DDTHH:MM:SS"``.
357            modified_from: Only documents modified on or after this date/time.
358                String input must be ISO-8601: ``"YYYY-MM-DD"`` or ``"YYYY-MM-DDTHH:MM:SS"``.
359            modified_before: Only documents modified before this date/time.
360                String input must be ISO-8601: ``"YYYY-MM-DD"`` or ``"YYYY-MM-DDTHH:MM:SS"``.
361            modified_until: Only documents modified on or before this date/time.
362                String input must be ISO-8601: ``"YYYY-MM-DD"`` or ``"YYYY-MM-DDTHH:MM:SS"``.
363            checksum: MD5 checksum of the original file (exact match).
364            page_size: Number of results per API page.  Default: ``25``.
365            page: Return only this specific page (1-based).
366            ordering: Field name to sort by.
367            descending: When ``True``, reverses the sort direction.
368            max_results: Stop after collecting this many documents.
369            on_page: Callback invoked after each page fetch.
370
371        Returns:
372            :class:`~easypaperless.models.paged_result.PagedResult` of
373            :class:`~easypaperless.models.documents.Document` objects.
374        """
375        logger.info("Listing documents")
376        resolver = self._core._resolver
377        params: dict[str, Any] = {"page_size": page_size}
378
379        if search is not None:
380            api_param = _SEARCH_MODE_MAP.get(search_mode, "search")
381            params[api_param] = search
382
383        if ids is not None:
384            params["id__in"] = ",".join(str(i) for i in ids)
385
386        if tags is not None:
387            resolved = await resolver.resolve_list("tags", tags)
388            params["tags__id__all"] = ",".join(str(t) for t in resolved)
389
390        if any_tags is not None:
391            resolved = await resolver.resolve_list("tags", any_tags)
392            params["tags__id__in"] = ",".join(str(t) for t in resolved)
393
394        if exclude_tags is not None:
395            resolved = await resolver.resolve_list("tags", exclude_tags)
396            params["tags__id__none"] = ",".join(str(t) for t in resolved)
397
398        if any_correspondent is not None:
399            resolved = await resolver.resolve_list("correspondents", any_correspondent)
400            params["correspondent__id__in"] = ",".join(str(c) for c in resolved)
401        elif not isinstance(correspondent, Unset):
402            if correspondent is None:
403                params["correspondent__isnull"] = "true"
404            else:
405                resolved_id = await resolver.resolve("correspondents", correspondent)
406                params["correspondent__id__in"] = resolved_id
407
408        if exclude_correspondents is not None:
409            resolved = await resolver.resolve_list("correspondents", exclude_correspondents)
410            params["correspondent__id__none"] = ",".join(str(c) for c in resolved)
411
412        if document_type_name_contains is not None:
413            params["document_type__name__icontains"] = document_type_name_contains
414        if document_type_name_exact is not None:
415            params["document_type__name__iexact"] = document_type_name_exact
416
417        if any_document_type is not None:
418            resolved = await resolver.resolve_list("document_types", any_document_type)
419            params["document_type__id__in"] = ",".join(str(d) for d in resolved)
420        elif not isinstance(document_type, Unset):
421            if document_type is None:
422                params["document_type__isnull"] = "true"
423            else:
424                resolved_id = await resolver.resolve("document_types", document_type)
425                params["document_type"] = resolved_id
426
427        if exclude_document_types is not None:
428            resolved = await resolver.resolve_list("document_types", exclude_document_types)
429            params["document_type__id__none"] = ",".join(str(d) for d in resolved)
430
431        if any_storage_paths is not None:
432            resolved = await resolver.resolve_list("storage_paths", any_storage_paths)
433            params["storage_path__id__in"] = ",".join(str(s) for s in resolved)
434        elif not isinstance(storage_path, Unset):
435            if storage_path is None:
436                params["storage_path__isnull"] = "true"
437            else:
438                resolved_id = await resolver.resolve("storage_paths", storage_path)
439                params["storage_path__id__in"] = resolved_id
440
441        if exclude_storage_paths is not None:
442            resolved = await resolver.resolve_list("storage_paths", exclude_storage_paths)
443            params["storage_path__id__none"] = ",".join(str(s) for s in resolved)
444
445        if not isinstance(owner, Unset):
446            if owner is None:
447                params["owner__isnull"] = "true"
448            else:
449                params["owner__id__in"] = owner
450
451        if exclude_owners is not None:
452            params["owner__id__none"] = ",".join(str(o) for o in exclude_owners)
453
454        if custom_fields is not None:
455            resolved = await resolver.resolve_list("custom_fields", custom_fields)
456            params["custom_fields__id__all"] = ",".join(str(f) for f in resolved)
457
458        if any_custom_fields is not None:
459            resolved = await resolver.resolve_list("custom_fields", any_custom_fields)
460            params["custom_fields__id__in"] = ",".join(str(f) for f in resolved)
461
462        if exclude_custom_fields is not None:
463            resolved = await resolver.resolve_list("custom_fields", exclude_custom_fields)
464            params["custom_fields__id__none"] = ",".join(str(f) for f in resolved)
465
466        if custom_field_query is not None:
467            params["custom_field_query"] = json.dumps(custom_field_query)
468
469        if not isinstance(archive_serial_number, Unset):
470            if archive_serial_number is None:
471                params["archive_serial_number__isnull"] = "true"
472            else:
473                params["archive_serial_number"] = archive_serial_number
474
475        if archive_serial_number_from is not None:
476            params["archive_serial_number__gte"] = archive_serial_number_from
477
478        if archive_serial_number_till is not None:
479            params["archive_serial_number__lte"] = archive_serial_number_till
480
481        if created_after is not None:
482            params["created__date__gt"] = self._format_date_value(created_after)
483
484        if created_before is not None:
485            params["created__date__lt"] = self._format_date_value(created_before)
486
487        if added_after is not None:
488            key = "added__gt" if self._is_datetime(added_after) else "added__date__gt"
489            params[key] = self._format_date_value(added_after)
490
491        if added_from is not None:
492            key = "added__gte" if self._is_datetime(added_from) else "added__date__gte"
493            params[key] = self._format_date_value(added_from)
494
495        if added_before is not None:
496            key = "added__lt" if self._is_datetime(added_before) else "added__date__lt"
497            params[key] = self._format_date_value(added_before)
498
499        if added_until is not None:
500            key = "added__lte" if self._is_datetime(added_until) else "added__date__lte"
501            params[key] = self._format_date_value(added_until)
502
503        if modified_after is not None:
504            key = "modified__gt" if self._is_datetime(modified_after) else "modified__date__gt"
505            params[key] = self._format_date_value(modified_after)
506
507        if modified_from is not None:
508            key = "modified__gte" if self._is_datetime(modified_from) else "modified__date__gte"
509            params[key] = self._format_date_value(modified_from)
510
511        if modified_before is not None:
512            key = "modified__lt" if self._is_datetime(modified_before) else "modified__date__lt"
513            params[key] = self._format_date_value(modified_before)
514
515        if modified_until is not None:
516            key = "modified__lte" if self._is_datetime(modified_until) else "modified__date__lte"
517            params[key] = self._format_date_value(modified_until)
518
519        if checksum is not None:
520            params["checksum__iexact"] = checksum
521
522        if ordering is not None:
523            params["ordering"] = f"-{ordering}" if descending else ordering
524
525        if page is not None:
526            params["page"] = page
527            raw = await self._core._session.get_page("/documents/", params=params)
528            items = raw.items
529            if max_results is not None:
530                items = items[:max_results]
531            return PagedResult(
532                count=raw.count,
533                next=raw.next,
534                previous=raw.previous,
535                all=raw.all_ids,
536                results=[Document.model_validate(item) for item in items],
537            )
538
539        raw = await self._core._session.get_all_pages_paged(
540            "/documents/", params, max_results=max_results, on_page=on_page
541        )
542        return PagedResult(
543            count=raw.count,
544            next=raw.next,
545            previous=raw.previous,
546            all=raw.all_ids,
547            results=[Document.model_validate(item) for item in raw.items],
548        )
549
550    async def update(
551        self,
552        id: int,
553        *,
554        title: str | Unset = UNSET,
555        content: str | Unset = UNSET,
556        created: date | str | None | Unset = UNSET,
557        correspondent: int | str | None | Unset = UNSET,
558        document_type: int | str | None | Unset = UNSET,
559        storage_path: int | str | None | Unset = UNSET,
560        tags: List[int | str] | None | Unset = UNSET,
561        archive_serial_number: int | None | Unset = UNSET,
562        custom_fields: List[dict[str, Any]] | None | Unset = UNSET,
563        owner: int | None | Unset = UNSET,
564        set_permissions: SetPermissions | None | Unset = UNSET,
565        remove_inbox_tags: bool | None | Unset = UNSET,
566    ) -> Document:
567        """Partially update a document (PATCH semantics).
568
569        Args:
570            id: Numeric ID of the document to update.
571            title: New document title.
572            content: OCR text content of the document.
573            created: Creation date as an ISO-8601 string (``"YYYY-MM-DD"``) or a
574                :class:`~datetime.date` object.
575            correspondent: Correspondent to assign, as an ID or name.
576                Pass ``None`` to clear the correspondent.
577            document_type: Document type to assign, as an ID or name.
578                Pass ``None`` to clear the document type.
579            storage_path: Storage path to assign, as an ID or name.
580                Pass ``None`` to clear the storage path.
581            tags: Full replacement list of tags (IDs or names).
582            archive_serial_number: Archive serial number to assign.
583                Pass ``None`` to clear the archive serial number.
584            custom_fields: List of ``{"field": <field_id>, "value": ...}`` dicts.
585            owner: Numeric user ID to assign as document owner.
586                Pass ``None`` to clear the owner.
587            set_permissions: Explicit view/change permission sets.
588                Pass ``None`` to clear all permissions (overwrite with empty).
589                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
590            remove_inbox_tags: When ``True``, removes all inbox tags from the document.
591
592        Returns:
593            The updated :class:`~easypaperless.models.documents.Document`.
594        """
595        logger.info("Updating document id=%d", id)
596        resolver = self._core._resolver
597        payload: dict[str, Any] = {}
598
599        if not isinstance(title, Unset):
600            payload["title"] = title
601        if not isinstance(content, Unset):
602            payload["content"] = content
603        if not isinstance(created, Unset):
604            payload["created"] = self._format_date_value(created) if created is not None else None
605        if not isinstance(correspondent, Unset):
606            payload["correspondent"] = (
607                None
608                if correspondent is None
609                else await resolver.resolve("correspondents", correspondent)
610            )
611        if not isinstance(document_type, Unset):
612            payload["document_type"] = (
613                None
614                if document_type is None
615                else await resolver.resolve("document_types", document_type)
616            )
617        if not isinstance(storage_path, Unset):
618            payload["storage_path"] = (
619                None
620                if storage_path is None
621                else await resolver.resolve("storage_paths", storage_path)
622            )
623        if not isinstance(tags, Unset):
624            payload["tags"] = await resolver.resolve_list("tags", tags or [])
625        if not isinstance(archive_serial_number, Unset):
626            payload["archive_serial_number"] = archive_serial_number
627        if not isinstance(custom_fields, Unset):
628            payload["custom_fields"] = custom_fields
629        if not isinstance(owner, Unset):
630            payload["owner"] = owner
631        if not isinstance(set_permissions, Unset):
632            payload["set_permissions"] = (
633                SetPermissions().model_dump()
634                if set_permissions is None
635                else set_permissions.model_dump()
636            )
637        if not isinstance(remove_inbox_tags, Unset):
638            payload["remove_inbox_tags"] = remove_inbox_tags
639
640        resp = await self._core._session.patch(f"/documents/{id}/", json=payload)
641        return Document.model_validate(resp.json())
642
643    async def delete(self, id: int) -> None:
644        """Permanently delete a document.
645
646        Args:
647            id: Numeric ID of the document to delete.
648
649        Raises:
650            ~easypaperless.exceptions.NotFoundError: If no document exists
651                with that ID.
652        """
653        logger.info("Deleting document id=%d", id)
654        await self._core._session.delete(f"/documents/{id}/")
655
656    async def download(self, id: int, *, original: bool = False) -> bytes:
657        """Download the binary content of a document.
658
659        Args:
660            id: Numeric ID of the document to download.
661            original: If ``False`` *(default)*, returns the archived PDF
662                (``GET /documents/{id}/download/``).
663                If ``True``, returns the original uploaded file
664                (``GET /documents/{id}/download/?original=true``).
665
666        Returns:
667            Raw file bytes.
668        """
669        logger.info("Downloading document id=%d (original=%s)", id, original)
670        path = f"/documents/{id}/download/"
671        if original:
672            path += "?original=true"
673        resp = await self._core._session.get_download(path)
674        content_type = resp.headers.get("content-type", "")
675        if "text/html" in content_type or resp.content[:9].lower().startswith(b"<!doctype"):
676            raise ServerError(
677                f"Download returned an HTML page (content-type: {content_type!r}). "
678                "The server redirected to a login page even after re-attaching auth.",
679                status_code=None,
680            )
681        return resp.content
682
683    async def upload(
684        self,
685        file: str | Path,
686        *,
687        title: str | Unset = UNSET,
688        created: date | str | None = None,
689        correspondent: int | str | None | Unset = UNSET,
690        document_type: int | str | None | Unset = UNSET,
691        storage_path: int | str | None | Unset = UNSET,
692        tags: List[int | str] | None = None,
693        archive_serial_number: int | None | Unset = UNSET,
694        custom_fields: List[dict[str, Any]] | None = None,
695        wait: bool = False,
696        poll_interval: float | None = None,
697        poll_timeout: float | None = None,
698    ) -> str | Document:
699        """Upload a document to paperless-ngx.
700
701        Args:
702            file: Path to the file to upload.
703            title: Title to assign to the document.
704            created: Creation date as an ISO-8601 string (``"YYYY-MM-DD"``) or a
705                :class:`~datetime.date` object.
706            correspondent: Correspondent to assign, as an ID or name.
707            document_type: Document type to assign, as an ID or name.
708            storage_path: Storage path to assign, as an ID or name.
709            tags: Tags to assign, as IDs or names.
710            archive_serial_number: Archive serial number to assign.
711            custom_fields: List of ``{"field": <field_id>, "value": ...}`` dicts.
712            wait: If ``False`` *(default)*, returns immediately with the task ID.
713                If ``True``, polls until processing completes.
714            poll_interval: Seconds between task-status checks while waiting for
715                processing to complete (requires ``wait=True``). Overrides the
716                client-level default. When omitted, falls back to the client-level
717                ``poll_interval`` (``2.0`` s unless changed at construction).
718            poll_timeout: Maximum seconds to wait before raising
719                :exc:`~easypaperless.exceptions.TaskTimeoutError` (requires
720                ``wait=True``). Overrides the client-level default. When omitted,
721                falls back to the client-level ``poll_timeout`` (``60.0`` s unless
722                changed at construction).
723
724        Returns:
725            The Celery task ID string when ``wait=False``, or the fully
726            processed :class:`~easypaperless.models.documents.Document`
727            when ``wait=True``.
728
729        Raises:
730            ~easypaperless.exceptions.UploadError: If processing fails.
731            ~easypaperless.exceptions.TaskTimeoutError: If timeout is exceeded.
732        """
733        resolver = self._core._resolver
734        file_path = Path(file)
735        file_bytes = file_path.read_bytes()
736        logger.info("Uploading %r (%d bytes)", file_path.name, len(file_bytes))
737
738        data: dict[str, Any] = {}
739        if not isinstance(title, Unset):
740            data["title"] = title
741        if created is not None:
742            data["created"] = self._format_date_value(created)
743        if not isinstance(correspondent, Unset) and correspondent is not None:
744            data["correspondent"] = await resolver.resolve("correspondents", correspondent)
745        if not isinstance(document_type, Unset) and document_type is not None:
746            data["document_type"] = await resolver.resolve("document_types", document_type)
747        if not isinstance(storage_path, Unset) and storage_path is not None:
748            data["storage_path"] = await resolver.resolve("storage_paths", storage_path)
749        if tags is not None:
750            resolved = await resolver.resolve_list("tags", tags)
751            data["tags"] = resolved
752        if not isinstance(archive_serial_number, Unset) and archive_serial_number is not None:
753            data["archive_serial_number"] = archive_serial_number
754        if custom_fields is not None:
755            data["custom_fields"] = json.dumps(custom_fields)
756
757        files = {"document": (file_path.name, file_bytes)}
758        resp = await self._core._session.post("/documents/post_document/", data=data, files=files)
759        task_id: str = resp.text.strip('"')
760        logger.debug("Upload accepted, task_id=%r", task_id)
761
762        if not wait:
763            return task_id
764
765        interval = poll_interval if poll_interval is not None else self._core._poll_interval
766        timeout = poll_timeout if poll_timeout is not None else self._core._poll_timeout
767        return await self._poll_task(task_id, poll_interval=interval, poll_timeout=timeout)
768
769    async def _poll_task(
770        self, task_id: str, *, poll_interval: float, poll_timeout: float
771    ) -> Document:
772        start = time.monotonic()
773        deadline = start + poll_timeout
774        while time.monotonic() < deadline:
775            resp = await self._core._session.get("/tasks/", params={"task_id": task_id})
776            tasks = resp.json()
777            if not tasks:
778                await asyncio.sleep(poll_interval)
779                continue
780
781            task = Task.model_validate(tasks[0])
782            elapsed = time.monotonic() - start
783            logger.debug(
784                "Polling task %r (status=%s, elapsed=%.1fs)",
785                task_id,
786                task.status.value if task.status is not None else "unknown",
787                elapsed,
788            )
789            if task.status == TaskStatus.SUCCESS:
790                if task.related_document is None:
791                    raise UploadError(f"Task {task_id!r} succeeded but returned no document ID")
792                doc_id = int(task.related_document)
793                logger.info("Task %r succeeded, document_id=%d", task_id, doc_id)
794                return await self.get(doc_id)
795            elif task.status == TaskStatus.FAILURE:
796                logger.warning("Task %r failed: %s", task_id, task.result)
797                raise UploadError(f"Document processing failed: {task.result}")
798            elif task.status == TaskStatus.REVOKED:
799                logger.warning("Task %r was revoked", task_id)
800                raise UploadError(f"Task {task_id!r} was revoked")
801            await asyncio.sleep(poll_interval)
802
803        elapsed = time.monotonic() - start
804        logger.warning("Task %r timed out after %.1fs", task_id, elapsed)
805        raise TaskTimeoutError(f"Task {task_id!r} did not complete within {poll_timeout}s")
806
807    # -------------------------------------------------------------------------
808    # Document bulk operations
809    # -------------------------------------------------------------------------
810
811    async def _bulk_edit(self, document_ids: List[int], method: str, **parameters: Any) -> None:
812        """Execute a bulk-edit operation on a list of documents.
813
814        Args:
815            document_ids: List of document IDs to operate on.
816            method: Bulk-edit method name (e.g. ``"add_tag"``, ``"delete"``).
817            **parameters: Additional keyword arguments forwarded to the API.
818        """
819        payload = {"documents": document_ids, "method": method, "parameters": parameters}
820        await self._core._session.post("/documents/bulk_edit/", json=payload, timeout=120.0)
821
822    async def bulk_add_tag(self, document_ids: List[int], tag: int | str) -> None:
823        """Add a tag to multiple documents in a single request.
824
825        Args:
826            document_ids: List of document IDs to tag.
827            tag: Tag to add, as an ID or name.
828        """
829        logger.info("Bulk adding tag %r to %d documents", tag, len(document_ids))
830        tag_id = await self._core._resolver.resolve("tags", tag)
831        await self._bulk_edit(document_ids, "add_tag", tag=tag_id)
832
833    async def bulk_remove_tag(self, document_ids: List[int], tag: int | str) -> None:
834        """Remove a tag from multiple documents in a single request.
835
836        Args:
837            document_ids: List of document IDs to un-tag.
838            tag: Tag to remove, as an ID or name.
839        """
840        logger.info("Bulk removing tag %r from %d documents", tag, len(document_ids))
841        tag_id = await self._core._resolver.resolve("tags", tag)
842        await self._bulk_edit(document_ids, "remove_tag", tag=tag_id)
843
844    async def bulk_modify_tags(
845        self,
846        document_ids: List[int],
847        *,
848        add_tags: List[int | str] | None = None,
849        remove_tags: List[int | str] | None = None,
850    ) -> None:
851        """Add and/or remove tags on multiple documents atomically.
852
853        Args:
854            document_ids: List of document IDs to modify.
855            add_tags: Tags to add, as IDs or names.
856            remove_tags: Tags to remove, as IDs or names.
857        """
858        logger.info("Bulk modifying tags on %d documents", len(document_ids))
859        resolver = self._core._resolver
860        add_ids = await resolver.resolve_list("tags", add_tags or [])
861        remove_ids = await resolver.resolve_list("tags", remove_tags or [])
862        await self._bulk_edit(document_ids, "modify_tags", add_tags=add_ids, remove_tags=remove_ids)
863
864    async def bulk_delete(self, document_ids: List[int]) -> None:
865        """Permanently delete multiple documents in a single request.
866
867        Args:
868            document_ids: List of document IDs to delete.
869        """
870        logger.info("Bulk deleting %d documents", len(document_ids))
871        await self._bulk_edit(document_ids, "delete")
872
873    async def bulk_set_correspondent(
874        self, document_ids: List[int], correspondent: int | str | None
875    ) -> None:
876        """Assign a correspondent to multiple documents in a single request.
877
878        Args:
879            document_ids: List of document IDs to modify.
880            correspondent: Correspondent to assign, as an ID or name.
881                Pass ``None`` to clear.
882        """
883        logger.info(
884            "Bulk setting correspondent %r on %d documents", correspondent, len(document_ids)
885        )
886        cor_id: int | None = None
887        if correspondent is not None:
888            cor_id = await self._core._resolver.resolve("correspondents", correspondent)
889        await self._bulk_edit(document_ids, "set_correspondent", correspondent=cor_id)
890
891    async def bulk_set_document_type(
892        self, document_ids: List[int], document_type: int | str | None
893    ) -> None:
894        """Assign a document type to multiple documents in a single request.
895
896        Args:
897            document_ids: List of document IDs to modify.
898            document_type: Document type to assign, as an ID or name.
899                Pass ``None`` to clear.
900        """
901        logger.info(
902            "Bulk setting document type %r on %d documents", document_type, len(document_ids)
903        )
904        dt_id: int | None = None
905        if document_type is not None:
906            dt_id = await self._core._resolver.resolve("document_types", document_type)
907        await self._bulk_edit(document_ids, "set_document_type", document_type=dt_id)
908
909    async def bulk_set_storage_path(
910        self, document_ids: List[int], storage_path: int | str | None
911    ) -> None:
912        """Assign a storage path to multiple documents in a single request.
913
914        Args:
915            document_ids: List of document IDs to modify.
916            storage_path: Storage path to assign, as an ID or name.
917                Pass ``None`` to clear.
918        """
919        logger.info("Bulk setting storage path %r on %d documents", storage_path, len(document_ids))
920        sp_id: int | None = None
921        if storage_path is not None:
922            sp_id = await self._core._resolver.resolve("storage_paths", storage_path)
923        await self._bulk_edit(document_ids, "set_storage_path", storage_path=sp_id)
924
925    async def bulk_modify_custom_fields(
926        self,
927        document_ids: List[int],
928        *,
929        add_fields: List[dict[str, Any]] | None = None,
930        remove_fields: List[int] | None = None,
931    ) -> None:
932        """Add and/or remove custom field values on multiple documents.
933
934        Args:
935            document_ids: List of document IDs to modify.
936            add_fields: Custom-field value dicts to add.
937            remove_fields: Custom-field IDs whose values should be removed.
938        """
939        logger.info("Bulk modifying custom fields on %d documents", len(document_ids))
940        await self._bulk_edit(
941            document_ids,
942            "modify_custom_fields",
943            add_custom_fields=add_fields or [],
944            remove_custom_fields=remove_fields or [],
945        )
946
947    async def bulk_set_permissions(
948        self,
949        document_ids: List[int],
950        *,
951        set_permissions: SetPermissions | Unset = UNSET,
952        owner: int | None | Unset = UNSET,
953        merge: bool = False,
954    ) -> None:
955        """Set permissions and/or owner on multiple documents.
956
957        Args:
958            document_ids: List of document IDs to modify.
959            set_permissions: Explicit view/change permission sets.
960                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
961            owner: Numeric user ID to assign as document owner.
962                Pass ``None`` to clear the owner.
963                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
964            merge: When ``True``, new permissions are merged with existing ones.
965        """
966        logger.info("Bulk setting permissions on %d documents", len(document_ids))
967        params: dict[str, Any] = {"merge": merge}
968        if not isinstance(set_permissions, Unset):
969            params["set_permissions"] = set_permissions.model_dump()
970        if not isinstance(owner, Unset):
971            params["owner"] = owner
972        await self._bulk_edit(document_ids, "set_permissions", **params)

Accessor for documents: client.documents.

DocumentsResource(core: easypaperless.client._ClientCore)
178    def __init__(self, core: _ClientCore) -> None:
179        self._core = core
180        self.notes = NotesResource(core)
notes
async def get( self, id: int, *, include_metadata: bool = False) -> easypaperless.Document:
198    async def get(self, id: int, *, include_metadata: bool = False) -> Document:
199        """Fetch a single document by its ID.
200
201        Args:
202            id: Numeric paperless-ngx document ID.
203            include_metadata: When ``True``, the extended file-level metadata
204                is fetched concurrently and attached to the document.
205                Default: ``False``.
206
207        Returns:
208            The :class:`~easypaperless.models.documents.Document` with the
209            given ID.
210
211        Raises:
212            ~easypaperless.exceptions.NotFoundError: If no document exists
213                with that ID.
214        """
215        logger.info("Getting document id=%d", id)
216        if include_metadata:
217            doc_resp, meta_resp = await asyncio.gather(
218                self._core._session.get(f"/documents/{id}/"),
219                self._core._session.get(f"/documents/{id}/metadata/"),
220            )
221            data = doc_resp.json()
222            data["metadata"] = meta_resp.json()
223        else:
224            resp = await self._core._session.get(f"/documents/{id}/")
225            data = resp.json()
226        return Document.model_validate(data)

Fetch a single document by its ID.

Arguments:
  • id: Numeric paperless-ngx document ID.
  • include_metadata: When True, the extended file-level metadata is fetched concurrently and attached to the document. Default: False.
Returns:

The ~easypaperless.models.documents.Document with the given ID.

Raises:
async def get_metadata(self, id: int) -> easypaperless.DocumentMetadata:
228    async def get_metadata(self, id: int) -> DocumentMetadata:
229        """Fetch the extended file-level metadata for a document.
230
231        Args:
232            id: Numeric paperless-ngx document ID.
233
234        Returns:
235            A :class:`~easypaperless.models.documents.DocumentMetadata` instance.
236
237        Raises:
238            ~easypaperless.exceptions.NotFoundError: If no document exists
239                with that ID.
240        """
241        logger.info("Getting metadata for document id=%d", id)
242        resp = await self._core._session.get(f"/documents/{id}/metadata/")
243        return DocumentMetadata.model_validate(resp.json())

Fetch the extended file-level metadata for a document.

Arguments:
  • id: Numeric paperless-ngx document ID.
Returns:

A ~easypaperless.models.documents.DocumentMetadata instance.

Raises:
async def list( self, *, search: str | None = None, search_mode: str = 'title_or_content', ids: Optional[List[int]] = None, tags: Optional[List[Union[str, int]]] = None, any_tags: Optional[List[Union[str, int]]] = None, exclude_tags: Optional[List[Union[str, int]]] = None, correspondent: int | str | None | easypaperless.Unset = UNSET, any_correspondent: Optional[List[Union[str, int]]] = None, exclude_correspondents: Optional[List[Union[str, int]]] = None, document_type: int | str | None | easypaperless.Unset = UNSET, document_type_name_contains: str | None = None, document_type_name_exact: str | None = None, any_document_type: Optional[List[Union[str, int]]] = None, exclude_document_types: Optional[List[Union[str, int]]] = None, storage_path: int | str | None | easypaperless.Unset = UNSET, any_storage_paths: Optional[List[Union[str, int]]] = None, exclude_storage_paths: Optional[List[Union[str, int]]] = None, owner: int | None | easypaperless.Unset = UNSET, exclude_owners: Optional[List[int]] = None, custom_fields: Optional[List[Union[str, int]]] = None, any_custom_fields: Optional[List[Union[str, int]]] = None, exclude_custom_fields: Optional[List[Union[str, int]]] = None, custom_field_query: Optional[List[Any]] = None, archive_serial_number: int | None | easypaperless.Unset = UNSET, archive_serial_number_from: int | None = None, archive_serial_number_till: int | None = None, created_after: datetime.date | str | None = None, created_before: datetime.date | str | None = None, added_after: datetime.date | datetime.datetime | str | None = None, added_from: datetime.date | datetime.datetime | str | None = None, added_before: datetime.date | datetime.datetime | str | None = None, added_until: datetime.date | datetime.datetime | str | None = None, modified_after: datetime.date | datetime.datetime | str | None = None, modified_from: datetime.date | datetime.datetime | str | None = None, modified_before: datetime.date | datetime.datetime | str | None = None, modified_until: datetime.date | datetime.datetime | str | None = None, checksum: str | None = None, page_size: int = 25, page: int | None = None, ordering: str | None = None, descending: bool = False, max_results: int | None = None, on_page: Callable[[int, int | None], None] | None = None) -> easypaperless.PagedResult[Document]:
245    async def list(
246        self,
247        *,
248        search: str | None = None,
249        search_mode: str = "title_or_content",
250        ids: List[int] | None = None,
251        tags: List[int | str] | None = None,
252        any_tags: List[int | str] | None = None,
253        exclude_tags: List[int | str] | None = None,
254        correspondent: int | str | None | Unset = UNSET,
255        any_correspondent: List[int | str] | None = None,
256        exclude_correspondents: List[int | str] | None = None,
257        document_type: int | str | None | Unset = UNSET,
258        document_type_name_contains: str | None = None,
259        document_type_name_exact: str | None = None,
260        any_document_type: List[int | str] | None = None,
261        exclude_document_types: List[int | str] | None = None,
262        storage_path: int | str | None | Unset = UNSET,
263        any_storage_paths: List[int | str] | None = None,
264        exclude_storage_paths: List[int | str] | None = None,
265        owner: int | None | Unset = UNSET,
266        exclude_owners: List[int] | None = None,
267        custom_fields: List[int | str] | None = None,
268        any_custom_fields: List[int | str] | None = None,
269        exclude_custom_fields: List[int | str] | None = None,
270        custom_field_query: List[Any] | None = None,
271        archive_serial_number: int | None | Unset = UNSET,
272        archive_serial_number_from: int | None = None,
273        archive_serial_number_till: int | None = None,
274        created_after: date | str | None = None,
275        created_before: date | str | None = None,
276        added_after: date | datetime | str | None = None,
277        added_from: date | datetime | str | None = None,
278        added_before: date | datetime | str | None = None,
279        added_until: date | datetime | str | None = None,
280        modified_after: date | datetime | str | None = None,
281        modified_from: date | datetime | str | None = None,
282        modified_before: date | datetime | str | None = None,
283        modified_until: date | datetime | str | None = None,
284        checksum: str | None = None,
285        page_size: int = 25,
286        page: int | None = None,
287        ordering: str | None = None,
288        descending: bool = False,
289        max_results: int | None = None,
290        on_page: Callable[[int, int | None], None] | None = None,
291    ) -> PagedResult[Document]:
292        """Return a filtered list of documents.
293
294        All tag, correspondent, document-type, storage-path, and custom-field
295        parameters accept either integer IDs or string names.
296
297        When ``page`` is ``None`` (the default), all pages are fetched
298        automatically and ``next`` / ``previous`` in the returned
299        :class:`~easypaperless.models.paged_result.PagedResult` are always
300        ``None`` — even if ``max_results`` truncates the final result set.
301        ``count`` always reflects the server total, not the truncated length.
302        When ``page`` is set to a specific integer, only that one page is
303        fetched and ``next`` / ``previous`` contain the raw API values.
304
305        Args:
306            search: Search string.  Behaviour depends on ``search_mode``.
307            search_mode: How ``search`` is applied.  One of:
308                ``"title_or_content"`` *(default)*, ``"title"``, ``"query"``,
309                ``"original_filename"``.
310            ids: Return only documents whose ID is in this list.
311            tags: Documents must have **all** of these tags (AND semantics).
312            any_tags: Documents must have **at least one** of these tags.
313            exclude_tags: Documents must have **none** of these tags.
314            correspondent: Filter to documents assigned to this correspondent.
315                Pass ``None`` to return only documents with no correspondent set.
316            any_correspondent: Filter to documents assigned to any of these.
317            exclude_correspondents: Exclude documents assigned to any of these.
318            document_type: Filter to documents of exactly this type.
319                Pass ``None`` to return only documents with no document type set.
320            document_type_name_contains: Case-insensitive substring filter on document type name.
321            document_type_name_exact: Case-insensitive exact match on document type name.
322            any_document_type: Filter to documents whose type is any of these.
323            exclude_document_types: Exclude documents whose type is any of these.
324            storage_path: Filter to documents assigned to this storage path.
325                Pass ``None`` to return only documents with no storage path set.
326            any_storage_paths: Filter to documents assigned to any of these paths.
327            exclude_storage_paths: Exclude documents assigned to any of these paths.
328            owner: Filter to documents owned by this user ID.
329                Pass ``None`` to return only documents with no owner set.
330            exclude_owners: Exclude documents owned by any of these user IDs.
331            custom_fields: Documents must have **all** of these custom fields set.
332            any_custom_fields: Documents must have **at least one** of these fields.
333            exclude_custom_fields: Documents must have **none** of these fields.
334            custom_field_query: Filter documents by custom field values using a nested
335                query structure. See the `paperless-ngx API docs
336                <https://docs.paperless-ngx.com/api/#filtering-by-custom-fields>`_ for
337                the query format.
338            archive_serial_number: Filter by exact archive serial number.
339                Pass ``None`` to return only documents with no ASN set.
340            archive_serial_number_from: Filter by ASN >= this value.
341            archive_serial_number_till: Filter by ASN <= this value.
342            created_after: Only documents created after this date.
343                String input must be ISO-8601: ``"YYYY-MM-DD"``.
344            created_before: Only documents created before this date.
345                String input must be ISO-8601: ``"YYYY-MM-DD"``.
346            added_after: Only documents added after this date/time.
347                String input must be ISO-8601: ``"YYYY-MM-DD"`` for date precision or
348                ``"YYYY-MM-DDTHH:MM:SS"`` for datetime precision.
349            added_from: Only documents added on or after this date/time.
350                String input must be ISO-8601: ``"YYYY-MM-DD"`` or ``"YYYY-MM-DDTHH:MM:SS"``.
351            added_before: Only documents added before this date/time.
352                String input must be ISO-8601: ``"YYYY-MM-DD"`` or ``"YYYY-MM-DDTHH:MM:SS"``.
353            added_until: Only documents added on or before this date/time.
354                String input must be ISO-8601: ``"YYYY-MM-DD"`` or ``"YYYY-MM-DDTHH:MM:SS"``.
355            modified_after: Only documents modified after this date/time.
356                String input must be ISO-8601: ``"YYYY-MM-DD"`` or ``"YYYY-MM-DDTHH:MM:SS"``.
357            modified_from: Only documents modified on or after this date/time.
358                String input must be ISO-8601: ``"YYYY-MM-DD"`` or ``"YYYY-MM-DDTHH:MM:SS"``.
359            modified_before: Only documents modified before this date/time.
360                String input must be ISO-8601: ``"YYYY-MM-DD"`` or ``"YYYY-MM-DDTHH:MM:SS"``.
361            modified_until: Only documents modified on or before this date/time.
362                String input must be ISO-8601: ``"YYYY-MM-DD"`` or ``"YYYY-MM-DDTHH:MM:SS"``.
363            checksum: MD5 checksum of the original file (exact match).
364            page_size: Number of results per API page.  Default: ``25``.
365            page: Return only this specific page (1-based).
366            ordering: Field name to sort by.
367            descending: When ``True``, reverses the sort direction.
368            max_results: Stop after collecting this many documents.
369            on_page: Callback invoked after each page fetch.
370
371        Returns:
372            :class:`~easypaperless.models.paged_result.PagedResult` of
373            :class:`~easypaperless.models.documents.Document` objects.
374        """
375        logger.info("Listing documents")
376        resolver = self._core._resolver
377        params: dict[str, Any] = {"page_size": page_size}
378
379        if search is not None:
380            api_param = _SEARCH_MODE_MAP.get(search_mode, "search")
381            params[api_param] = search
382
383        if ids is not None:
384            params["id__in"] = ",".join(str(i) for i in ids)
385
386        if tags is not None:
387            resolved = await resolver.resolve_list("tags", tags)
388            params["tags__id__all"] = ",".join(str(t) for t in resolved)
389
390        if any_tags is not None:
391            resolved = await resolver.resolve_list("tags", any_tags)
392            params["tags__id__in"] = ",".join(str(t) for t in resolved)
393
394        if exclude_tags is not None:
395            resolved = await resolver.resolve_list("tags", exclude_tags)
396            params["tags__id__none"] = ",".join(str(t) for t in resolved)
397
398        if any_correspondent is not None:
399            resolved = await resolver.resolve_list("correspondents", any_correspondent)
400            params["correspondent__id__in"] = ",".join(str(c) for c in resolved)
401        elif not isinstance(correspondent, Unset):
402            if correspondent is None:
403                params["correspondent__isnull"] = "true"
404            else:
405                resolved_id = await resolver.resolve("correspondents", correspondent)
406                params["correspondent__id__in"] = resolved_id
407
408        if exclude_correspondents is not None:
409            resolved = await resolver.resolve_list("correspondents", exclude_correspondents)
410            params["correspondent__id__none"] = ",".join(str(c) for c in resolved)
411
412        if document_type_name_contains is not None:
413            params["document_type__name__icontains"] = document_type_name_contains
414        if document_type_name_exact is not None:
415            params["document_type__name__iexact"] = document_type_name_exact
416
417        if any_document_type is not None:
418            resolved = await resolver.resolve_list("document_types", any_document_type)
419            params["document_type__id__in"] = ",".join(str(d) for d in resolved)
420        elif not isinstance(document_type, Unset):
421            if document_type is None:
422                params["document_type__isnull"] = "true"
423            else:
424                resolved_id = await resolver.resolve("document_types", document_type)
425                params["document_type"] = resolved_id
426
427        if exclude_document_types is not None:
428            resolved = await resolver.resolve_list("document_types", exclude_document_types)
429            params["document_type__id__none"] = ",".join(str(d) for d in resolved)
430
431        if any_storage_paths is not None:
432            resolved = await resolver.resolve_list("storage_paths", any_storage_paths)
433            params["storage_path__id__in"] = ",".join(str(s) for s in resolved)
434        elif not isinstance(storage_path, Unset):
435            if storage_path is None:
436                params["storage_path__isnull"] = "true"
437            else:
438                resolved_id = await resolver.resolve("storage_paths", storage_path)
439                params["storage_path__id__in"] = resolved_id
440
441        if exclude_storage_paths is not None:
442            resolved = await resolver.resolve_list("storage_paths", exclude_storage_paths)
443            params["storage_path__id__none"] = ",".join(str(s) for s in resolved)
444
445        if not isinstance(owner, Unset):
446            if owner is None:
447                params["owner__isnull"] = "true"
448            else:
449                params["owner__id__in"] = owner
450
451        if exclude_owners is not None:
452            params["owner__id__none"] = ",".join(str(o) for o in exclude_owners)
453
454        if custom_fields is not None:
455            resolved = await resolver.resolve_list("custom_fields", custom_fields)
456            params["custom_fields__id__all"] = ",".join(str(f) for f in resolved)
457
458        if any_custom_fields is not None:
459            resolved = await resolver.resolve_list("custom_fields", any_custom_fields)
460            params["custom_fields__id__in"] = ",".join(str(f) for f in resolved)
461
462        if exclude_custom_fields is not None:
463            resolved = await resolver.resolve_list("custom_fields", exclude_custom_fields)
464            params["custom_fields__id__none"] = ",".join(str(f) for f in resolved)
465
466        if custom_field_query is not None:
467            params["custom_field_query"] = json.dumps(custom_field_query)
468
469        if not isinstance(archive_serial_number, Unset):
470            if archive_serial_number is None:
471                params["archive_serial_number__isnull"] = "true"
472            else:
473                params["archive_serial_number"] = archive_serial_number
474
475        if archive_serial_number_from is not None:
476            params["archive_serial_number__gte"] = archive_serial_number_from
477
478        if archive_serial_number_till is not None:
479            params["archive_serial_number__lte"] = archive_serial_number_till
480
481        if created_after is not None:
482            params["created__date__gt"] = self._format_date_value(created_after)
483
484        if created_before is not None:
485            params["created__date__lt"] = self._format_date_value(created_before)
486
487        if added_after is not None:
488            key = "added__gt" if self._is_datetime(added_after) else "added__date__gt"
489            params[key] = self._format_date_value(added_after)
490
491        if added_from is not None:
492            key = "added__gte" if self._is_datetime(added_from) else "added__date__gte"
493            params[key] = self._format_date_value(added_from)
494
495        if added_before is not None:
496            key = "added__lt" if self._is_datetime(added_before) else "added__date__lt"
497            params[key] = self._format_date_value(added_before)
498
499        if added_until is not None:
500            key = "added__lte" if self._is_datetime(added_until) else "added__date__lte"
501            params[key] = self._format_date_value(added_until)
502
503        if modified_after is not None:
504            key = "modified__gt" if self._is_datetime(modified_after) else "modified__date__gt"
505            params[key] = self._format_date_value(modified_after)
506
507        if modified_from is not None:
508            key = "modified__gte" if self._is_datetime(modified_from) else "modified__date__gte"
509            params[key] = self._format_date_value(modified_from)
510
511        if modified_before is not None:
512            key = "modified__lt" if self._is_datetime(modified_before) else "modified__date__lt"
513            params[key] = self._format_date_value(modified_before)
514
515        if modified_until is not None:
516            key = "modified__lte" if self._is_datetime(modified_until) else "modified__date__lte"
517            params[key] = self._format_date_value(modified_until)
518
519        if checksum is not None:
520            params["checksum__iexact"] = checksum
521
522        if ordering is not None:
523            params["ordering"] = f"-{ordering}" if descending else ordering
524
525        if page is not None:
526            params["page"] = page
527            raw = await self._core._session.get_page("/documents/", params=params)
528            items = raw.items
529            if max_results is not None:
530                items = items[:max_results]
531            return PagedResult(
532                count=raw.count,
533                next=raw.next,
534                previous=raw.previous,
535                all=raw.all_ids,
536                results=[Document.model_validate(item) for item in items],
537            )
538
539        raw = await self._core._session.get_all_pages_paged(
540            "/documents/", params, max_results=max_results, on_page=on_page
541        )
542        return PagedResult(
543            count=raw.count,
544            next=raw.next,
545            previous=raw.previous,
546            all=raw.all_ids,
547            results=[Document.model_validate(item) for item in raw.items],
548        )

Return a filtered list of documents.

All tag, correspondent, document-type, storage-path, and custom-field parameters accept either integer IDs or string names.

When page is None (the default), all pages are fetched automatically and next / previous in the returned ~easypaperless.models.paged_result.PagedResult are always None — even if max_results truncates the final result set. count always reflects the server total, not the truncated length. When page is set to a specific integer, only that one page is fetched and next / previous contain the raw API values.

Arguments:
  • search: Search string. Behaviour depends on search_mode.
  • search_mode: How search is applied. One of: "title_or_content" (default), "title", "query", "original_filename".
  • ids: Return only documents whose ID is in this list.
  • tags: Documents must have all of these tags (AND semantics).
  • any_tags: Documents must have at least one of these tags.
  • exclude_tags: Documents must have none of these tags.
  • correspondent: Filter to documents assigned to this correspondent. Pass None to return only documents with no correspondent set.
  • any_correspondent: Filter to documents assigned to any of these.
  • exclude_correspondents: Exclude documents assigned to any of these.
  • document_type: Filter to documents of exactly this type. Pass None to return only documents with no document type set.
  • document_type_name_contains: Case-insensitive substring filter on document type name.
  • document_type_name_exact: Case-insensitive exact match on document type name.
  • any_document_type: Filter to documents whose type is any of these.
  • exclude_document_types: Exclude documents whose type is any of these.
  • storage_path: Filter to documents assigned to this storage path. Pass None to return only documents with no storage path set.
  • any_storage_paths: Filter to documents assigned to any of these paths.
  • exclude_storage_paths: Exclude documents assigned to any of these paths.
  • owner: Filter to documents owned by this user ID. Pass None to return only documents with no owner set.
  • exclude_owners: Exclude documents owned by any of these user IDs.
  • custom_fields: Documents must have all of these custom fields set.
  • any_custom_fields: Documents must have at least one of these fields.
  • exclude_custom_fields: Documents must have none of these fields.
  • custom_field_query: Filter documents by custom field values using a nested query structure. See the paperless-ngx API docs for the query format.
  • archive_serial_number: Filter by exact archive serial number. Pass None to return only documents with no ASN set.
  • archive_serial_number_from: Filter by ASN >= this value.
  • archive_serial_number_till: Filter by ASN <= this value.
  • created_after: Only documents created after this date. String input must be ISO-8601: "YYYY-MM-DD".
  • created_before: Only documents created before this date. String input must be ISO-8601: "YYYY-MM-DD".
  • added_after: Only documents added after this date/time. String input must be ISO-8601: "YYYY-MM-DD" for date precision or "YYYY-MM-DDTHH:MM:SS" for datetime precision.
  • added_from: Only documents added on or after this date/time. String input must be ISO-8601: "YYYY-MM-DD" or "YYYY-MM-DDTHH:MM:SS".
  • added_before: Only documents added before this date/time. String input must be ISO-8601: "YYYY-MM-DD" or "YYYY-MM-DDTHH:MM:SS".
  • added_until: Only documents added on or before this date/time. String input must be ISO-8601: "YYYY-MM-DD" or "YYYY-MM-DDTHH:MM:SS".
  • modified_after: Only documents modified after this date/time. String input must be ISO-8601: "YYYY-MM-DD" or "YYYY-MM-DDTHH:MM:SS".
  • modified_from: Only documents modified on or after this date/time. String input must be ISO-8601: "YYYY-MM-DD" or "YYYY-MM-DDTHH:MM:SS".
  • modified_before: Only documents modified before this date/time. String input must be ISO-8601: "YYYY-MM-DD" or "YYYY-MM-DDTHH:MM:SS".
  • modified_until: Only documents modified on or before this date/time. String input must be ISO-8601: "YYYY-MM-DD" or "YYYY-MM-DDTHH:MM:SS".
  • checksum: MD5 checksum of the original file (exact match).
  • page_size: Number of results per API page. Default: 25.
  • page: Return only this specific page (1-based).
  • ordering: Field name to sort by.
  • descending: When True, reverses the sort direction.
  • max_results: Stop after collecting this many documents.
  • on_page: Callback invoked after each page fetch.
Returns:

~easypaperless.models.paged_result.PagedResult of ~easypaperless.models.documents.Document objects.

async def update( self, id: int, *, title: str | easypaperless.Unset = UNSET, content: str | easypaperless.Unset = UNSET, created: datetime.date | str | None | easypaperless.Unset = UNSET, correspondent: int | str | None | easypaperless.Unset = UNSET, document_type: int | str | None | easypaperless.Unset = UNSET, storage_path: int | str | None | easypaperless.Unset = UNSET, tags: Union[List[Union[str, int]], NoneType, easypaperless.Unset] = UNSET, archive_serial_number: int | None | easypaperless.Unset = UNSET, custom_fields: Union[List[dict[str, Any]], NoneType, easypaperless.Unset] = UNSET, owner: int | None | easypaperless.Unset = UNSET, set_permissions: easypaperless.SetPermissions | None | easypaperless.Unset = UNSET, remove_inbox_tags: bool | None | easypaperless.Unset = UNSET) -> easypaperless.Document:
550    async def update(
551        self,
552        id: int,
553        *,
554        title: str | Unset = UNSET,
555        content: str | Unset = UNSET,
556        created: date | str | None | Unset = UNSET,
557        correspondent: int | str | None | Unset = UNSET,
558        document_type: int | str | None | Unset = UNSET,
559        storage_path: int | str | None | Unset = UNSET,
560        tags: List[int | str] | None | Unset = UNSET,
561        archive_serial_number: int | None | Unset = UNSET,
562        custom_fields: List[dict[str, Any]] | None | Unset = UNSET,
563        owner: int | None | Unset = UNSET,
564        set_permissions: SetPermissions | None | Unset = UNSET,
565        remove_inbox_tags: bool | None | Unset = UNSET,
566    ) -> Document:
567        """Partially update a document (PATCH semantics).
568
569        Args:
570            id: Numeric ID of the document to update.
571            title: New document title.
572            content: OCR text content of the document.
573            created: Creation date as an ISO-8601 string (``"YYYY-MM-DD"``) or a
574                :class:`~datetime.date` object.
575            correspondent: Correspondent to assign, as an ID or name.
576                Pass ``None`` to clear the correspondent.
577            document_type: Document type to assign, as an ID or name.
578                Pass ``None`` to clear the document type.
579            storage_path: Storage path to assign, as an ID or name.
580                Pass ``None`` to clear the storage path.
581            tags: Full replacement list of tags (IDs or names).
582            archive_serial_number: Archive serial number to assign.
583                Pass ``None`` to clear the archive serial number.
584            custom_fields: List of ``{"field": <field_id>, "value": ...}`` dicts.
585            owner: Numeric user ID to assign as document owner.
586                Pass ``None`` to clear the owner.
587            set_permissions: Explicit view/change permission sets.
588                Pass ``None`` to clear all permissions (overwrite with empty).
589                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
590            remove_inbox_tags: When ``True``, removes all inbox tags from the document.
591
592        Returns:
593            The updated :class:`~easypaperless.models.documents.Document`.
594        """
595        logger.info("Updating document id=%d", id)
596        resolver = self._core._resolver
597        payload: dict[str, Any] = {}
598
599        if not isinstance(title, Unset):
600            payload["title"] = title
601        if not isinstance(content, Unset):
602            payload["content"] = content
603        if not isinstance(created, Unset):
604            payload["created"] = self._format_date_value(created) if created is not None else None
605        if not isinstance(correspondent, Unset):
606            payload["correspondent"] = (
607                None
608                if correspondent is None
609                else await resolver.resolve("correspondents", correspondent)
610            )
611        if not isinstance(document_type, Unset):
612            payload["document_type"] = (
613                None
614                if document_type is None
615                else await resolver.resolve("document_types", document_type)
616            )
617        if not isinstance(storage_path, Unset):
618            payload["storage_path"] = (
619                None
620                if storage_path is None
621                else await resolver.resolve("storage_paths", storage_path)
622            )
623        if not isinstance(tags, Unset):
624            payload["tags"] = await resolver.resolve_list("tags", tags or [])
625        if not isinstance(archive_serial_number, Unset):
626            payload["archive_serial_number"] = archive_serial_number
627        if not isinstance(custom_fields, Unset):
628            payload["custom_fields"] = custom_fields
629        if not isinstance(owner, Unset):
630            payload["owner"] = owner
631        if not isinstance(set_permissions, Unset):
632            payload["set_permissions"] = (
633                SetPermissions().model_dump()
634                if set_permissions is None
635                else set_permissions.model_dump()
636            )
637        if not isinstance(remove_inbox_tags, Unset):
638            payload["remove_inbox_tags"] = remove_inbox_tags
639
640        resp = await self._core._session.patch(f"/documents/{id}/", json=payload)
641        return Document.model_validate(resp.json())

Partially update a document (PATCH semantics).

Arguments:
  • id: Numeric ID of the document to update.
  • title: New document title.
  • content: OCR text content of the document.
  • created: Creation date as an ISO-8601 string ("YYYY-MM-DD") or a ~datetime.date object.
  • correspondent: Correspondent to assign, as an ID or name. Pass None to clear the correspondent.
  • document_type: Document type to assign, as an ID or name. Pass None to clear the document type.
  • storage_path: Storage path to assign, as an ID or name. Pass None to clear the storage path.
  • tags: Full replacement list of tags (IDs or names).
  • archive_serial_number: Archive serial number to assign. Pass None to clear the archive serial number.
  • custom_fields: List of {"field": <field_id>, "value": ...} dicts.
  • owner: Numeric user ID to assign as document owner. Pass None to clear the owner.
  • set_permissions: Explicit view/change permission sets. Pass None to clear all permissions (overwrite with empty). Omit (or pass ~easypaperless.UNSET) to leave unchanged.
  • remove_inbox_tags: When True, removes all inbox tags from the document.
Returns:

The updated ~easypaperless.models.documents.Document.

async def delete(self, id: int) -> None:
643    async def delete(self, id: int) -> None:
644        """Permanently delete a document.
645
646        Args:
647            id: Numeric ID of the document to delete.
648
649        Raises:
650            ~easypaperless.exceptions.NotFoundError: If no document exists
651                with that ID.
652        """
653        logger.info("Deleting document id=%d", id)
654        await self._core._session.delete(f"/documents/{id}/")

Permanently delete a document.

Arguments:
  • id: Numeric ID of the document to delete.
Raises:
async def download(self, id: int, *, original: bool = False) -> bytes:
656    async def download(self, id: int, *, original: bool = False) -> bytes:
657        """Download the binary content of a document.
658
659        Args:
660            id: Numeric ID of the document to download.
661            original: If ``False`` *(default)*, returns the archived PDF
662                (``GET /documents/{id}/download/``).
663                If ``True``, returns the original uploaded file
664                (``GET /documents/{id}/download/?original=true``).
665
666        Returns:
667            Raw file bytes.
668        """
669        logger.info("Downloading document id=%d (original=%s)", id, original)
670        path = f"/documents/{id}/download/"
671        if original:
672            path += "?original=true"
673        resp = await self._core._session.get_download(path)
674        content_type = resp.headers.get("content-type", "")
675        if "text/html" in content_type or resp.content[:9].lower().startswith(b"<!doctype"):
676            raise ServerError(
677                f"Download returned an HTML page (content-type: {content_type!r}). "
678                "The server redirected to a login page even after re-attaching auth.",
679                status_code=None,
680            )
681        return resp.content

Download the binary content of a document.

Arguments:
  • id: Numeric ID of the document to download.
  • original: If False (default), returns the archived PDF (GET /documents/{id}/download/). If True, returns the original uploaded file (GET /documents/{id}/download/?original=true).
Returns:

Raw file bytes.

async def upload( self, file: str | pathlib._local.Path, *, title: str | easypaperless.Unset = UNSET, created: datetime.date | str | None = None, correspondent: int | str | None | easypaperless.Unset = UNSET, document_type: int | str | None | easypaperless.Unset = UNSET, storage_path: int | str | None | easypaperless.Unset = UNSET, tags: Optional[List[Union[str, int]]] = None, archive_serial_number: int | None | easypaperless.Unset = UNSET, custom_fields: Optional[List[dict[str, Any]]] = None, wait: bool = False, poll_interval: float | None = None, poll_timeout: float | None = None) -> str | easypaperless.Document:
683    async def upload(
684        self,
685        file: str | Path,
686        *,
687        title: str | Unset = UNSET,
688        created: date | str | None = None,
689        correspondent: int | str | None | Unset = UNSET,
690        document_type: int | str | None | Unset = UNSET,
691        storage_path: int | str | None | Unset = UNSET,
692        tags: List[int | str] | None = None,
693        archive_serial_number: int | None | Unset = UNSET,
694        custom_fields: List[dict[str, Any]] | None = None,
695        wait: bool = False,
696        poll_interval: float | None = None,
697        poll_timeout: float | None = None,
698    ) -> str | Document:
699        """Upload a document to paperless-ngx.
700
701        Args:
702            file: Path to the file to upload.
703            title: Title to assign to the document.
704            created: Creation date as an ISO-8601 string (``"YYYY-MM-DD"``) or a
705                :class:`~datetime.date` object.
706            correspondent: Correspondent to assign, as an ID or name.
707            document_type: Document type to assign, as an ID or name.
708            storage_path: Storage path to assign, as an ID or name.
709            tags: Tags to assign, as IDs or names.
710            archive_serial_number: Archive serial number to assign.
711            custom_fields: List of ``{"field": <field_id>, "value": ...}`` dicts.
712            wait: If ``False`` *(default)*, returns immediately with the task ID.
713                If ``True``, polls until processing completes.
714            poll_interval: Seconds between task-status checks while waiting for
715                processing to complete (requires ``wait=True``). Overrides the
716                client-level default. When omitted, falls back to the client-level
717                ``poll_interval`` (``2.0`` s unless changed at construction).
718            poll_timeout: Maximum seconds to wait before raising
719                :exc:`~easypaperless.exceptions.TaskTimeoutError` (requires
720                ``wait=True``). Overrides the client-level default. When omitted,
721                falls back to the client-level ``poll_timeout`` (``60.0`` s unless
722                changed at construction).
723
724        Returns:
725            The Celery task ID string when ``wait=False``, or the fully
726            processed :class:`~easypaperless.models.documents.Document`
727            when ``wait=True``.
728
729        Raises:
730            ~easypaperless.exceptions.UploadError: If processing fails.
731            ~easypaperless.exceptions.TaskTimeoutError: If timeout is exceeded.
732        """
733        resolver = self._core._resolver
734        file_path = Path(file)
735        file_bytes = file_path.read_bytes()
736        logger.info("Uploading %r (%d bytes)", file_path.name, len(file_bytes))
737
738        data: dict[str, Any] = {}
739        if not isinstance(title, Unset):
740            data["title"] = title
741        if created is not None:
742            data["created"] = self._format_date_value(created)
743        if not isinstance(correspondent, Unset) and correspondent is not None:
744            data["correspondent"] = await resolver.resolve("correspondents", correspondent)
745        if not isinstance(document_type, Unset) and document_type is not None:
746            data["document_type"] = await resolver.resolve("document_types", document_type)
747        if not isinstance(storage_path, Unset) and storage_path is not None:
748            data["storage_path"] = await resolver.resolve("storage_paths", storage_path)
749        if tags is not None:
750            resolved = await resolver.resolve_list("tags", tags)
751            data["tags"] = resolved
752        if not isinstance(archive_serial_number, Unset) and archive_serial_number is not None:
753            data["archive_serial_number"] = archive_serial_number
754        if custom_fields is not None:
755            data["custom_fields"] = json.dumps(custom_fields)
756
757        files = {"document": (file_path.name, file_bytes)}
758        resp = await self._core._session.post("/documents/post_document/", data=data, files=files)
759        task_id: str = resp.text.strip('"')
760        logger.debug("Upload accepted, task_id=%r", task_id)
761
762        if not wait:
763            return task_id
764
765        interval = poll_interval if poll_interval is not None else self._core._poll_interval
766        timeout = poll_timeout if poll_timeout is not None else self._core._poll_timeout
767        return await self._poll_task(task_id, poll_interval=interval, poll_timeout=timeout)

Upload a document to paperless-ngx.

Arguments:
  • file: Path to the file to upload.
  • title: Title to assign to the document.
  • created: Creation date as an ISO-8601 string ("YYYY-MM-DD") or a ~datetime.date object.
  • correspondent: Correspondent to assign, as an ID or name.
  • document_type: Document type to assign, as an ID or name.
  • storage_path: Storage path to assign, as an ID or name.
  • tags: Tags to assign, as IDs or names.
  • archive_serial_number: Archive serial number to assign.
  • custom_fields: List of {"field": <field_id>, "value": ...} dicts.
  • wait: If False (default), returns immediately with the task ID. If True, polls until processing completes.
  • poll_interval: Seconds between task-status checks while waiting for processing to complete (requires wait=True). Overrides the client-level default. When omitted, falls back to the client-level poll_interval (2.0 s unless changed at construction).
  • poll_timeout: Maximum seconds to wait before raising ~easypaperless.exceptions.TaskTimeoutError (requires wait=True). Overrides the client-level default. When omitted, falls back to the client-level poll_timeout (60.0 s unless changed at construction).
Returns:

The Celery task ID string when wait=False, or the fully processed ~easypaperless.models.documents.Document when wait=True.

Raises:
async def bulk_add_tag(self, document_ids: List[int], tag: int | str) -> None:
822    async def bulk_add_tag(self, document_ids: List[int], tag: int | str) -> None:
823        """Add a tag to multiple documents in a single request.
824
825        Args:
826            document_ids: List of document IDs to tag.
827            tag: Tag to add, as an ID or name.
828        """
829        logger.info("Bulk adding tag %r to %d documents", tag, len(document_ids))
830        tag_id = await self._core._resolver.resolve("tags", tag)
831        await self._bulk_edit(document_ids, "add_tag", tag=tag_id)

Add a tag to multiple documents in a single request.

Arguments:
  • document_ids: List of document IDs to tag.
  • tag: Tag to add, as an ID or name.
async def bulk_remove_tag(self, document_ids: List[int], tag: int | str) -> None:
833    async def bulk_remove_tag(self, document_ids: List[int], tag: int | str) -> None:
834        """Remove a tag from multiple documents in a single request.
835
836        Args:
837            document_ids: List of document IDs to un-tag.
838            tag: Tag to remove, as an ID or name.
839        """
840        logger.info("Bulk removing tag %r from %d documents", tag, len(document_ids))
841        tag_id = await self._core._resolver.resolve("tags", tag)
842        await self._bulk_edit(document_ids, "remove_tag", tag=tag_id)

Remove a tag from multiple documents in a single request.

Arguments:
  • document_ids: List of document IDs to un-tag.
  • tag: Tag to remove, as an ID or name.
async def bulk_modify_tags( self, document_ids: List[int], *, add_tags: Optional[List[Union[str, int]]] = None, remove_tags: Optional[List[Union[str, int]]] = None) -> None:
844    async def bulk_modify_tags(
845        self,
846        document_ids: List[int],
847        *,
848        add_tags: List[int | str] | None = None,
849        remove_tags: List[int | str] | None = None,
850    ) -> None:
851        """Add and/or remove tags on multiple documents atomically.
852
853        Args:
854            document_ids: List of document IDs to modify.
855            add_tags: Tags to add, as IDs or names.
856            remove_tags: Tags to remove, as IDs or names.
857        """
858        logger.info("Bulk modifying tags on %d documents", len(document_ids))
859        resolver = self._core._resolver
860        add_ids = await resolver.resolve_list("tags", add_tags or [])
861        remove_ids = await resolver.resolve_list("tags", remove_tags or [])
862        await self._bulk_edit(document_ids, "modify_tags", add_tags=add_ids, remove_tags=remove_ids)

Add and/or remove tags on multiple documents atomically.

Arguments:
  • document_ids: List of document IDs to modify.
  • add_tags: Tags to add, as IDs or names.
  • remove_tags: Tags to remove, as IDs or names.
async def bulk_delete(self, document_ids: List[int]) -> None:
864    async def bulk_delete(self, document_ids: List[int]) -> None:
865        """Permanently delete multiple documents in a single request.
866
867        Args:
868            document_ids: List of document IDs to delete.
869        """
870        logger.info("Bulk deleting %d documents", len(document_ids))
871        await self._bulk_edit(document_ids, "delete")

Permanently delete multiple documents in a single request.

Arguments:
  • document_ids: List of document IDs to delete.
async def bulk_set_correspondent(self, document_ids: List[int], correspondent: int | str | None) -> None:
873    async def bulk_set_correspondent(
874        self, document_ids: List[int], correspondent: int | str | None
875    ) -> None:
876        """Assign a correspondent to multiple documents in a single request.
877
878        Args:
879            document_ids: List of document IDs to modify.
880            correspondent: Correspondent to assign, as an ID or name.
881                Pass ``None`` to clear.
882        """
883        logger.info(
884            "Bulk setting correspondent %r on %d documents", correspondent, len(document_ids)
885        )
886        cor_id: int | None = None
887        if correspondent is not None:
888            cor_id = await self._core._resolver.resolve("correspondents", correspondent)
889        await self._bulk_edit(document_ids, "set_correspondent", correspondent=cor_id)

Assign a correspondent to multiple documents in a single request.

Arguments:
  • document_ids: List of document IDs to modify.
  • correspondent: Correspondent to assign, as an ID or name. Pass None to clear.
async def bulk_set_document_type(self, document_ids: List[int], document_type: int | str | None) -> None:
891    async def bulk_set_document_type(
892        self, document_ids: List[int], document_type: int | str | None
893    ) -> None:
894        """Assign a document type to multiple documents in a single request.
895
896        Args:
897            document_ids: List of document IDs to modify.
898            document_type: Document type to assign, as an ID or name.
899                Pass ``None`` to clear.
900        """
901        logger.info(
902            "Bulk setting document type %r on %d documents", document_type, len(document_ids)
903        )
904        dt_id: int | None = None
905        if document_type is not None:
906            dt_id = await self._core._resolver.resolve("document_types", document_type)
907        await self._bulk_edit(document_ids, "set_document_type", document_type=dt_id)

Assign a document type to multiple documents in a single request.

Arguments:
  • document_ids: List of document IDs to modify.
  • document_type: Document type to assign, as an ID or name. Pass None to clear.
async def bulk_set_storage_path(self, document_ids: List[int], storage_path: int | str | None) -> None:
909    async def bulk_set_storage_path(
910        self, document_ids: List[int], storage_path: int | str | None
911    ) -> None:
912        """Assign a storage path to multiple documents in a single request.
913
914        Args:
915            document_ids: List of document IDs to modify.
916            storage_path: Storage path to assign, as an ID or name.
917                Pass ``None`` to clear.
918        """
919        logger.info("Bulk setting storage path %r on %d documents", storage_path, len(document_ids))
920        sp_id: int | None = None
921        if storage_path is not None:
922            sp_id = await self._core._resolver.resolve("storage_paths", storage_path)
923        await self._bulk_edit(document_ids, "set_storage_path", storage_path=sp_id)

Assign a storage path to multiple documents in a single request.

Arguments:
  • document_ids: List of document IDs to modify.
  • storage_path: Storage path to assign, as an ID or name. Pass None to clear.
async def bulk_modify_custom_fields( self, document_ids: List[int], *, add_fields: Optional[List[dict[str, Any]]] = None, remove_fields: Optional[List[int]] = None) -> None:
925    async def bulk_modify_custom_fields(
926        self,
927        document_ids: List[int],
928        *,
929        add_fields: List[dict[str, Any]] | None = None,
930        remove_fields: List[int] | None = None,
931    ) -> None:
932        """Add and/or remove custom field values on multiple documents.
933
934        Args:
935            document_ids: List of document IDs to modify.
936            add_fields: Custom-field value dicts to add.
937            remove_fields: Custom-field IDs whose values should be removed.
938        """
939        logger.info("Bulk modifying custom fields on %d documents", len(document_ids))
940        await self._bulk_edit(
941            document_ids,
942            "modify_custom_fields",
943            add_custom_fields=add_fields or [],
944            remove_custom_fields=remove_fields or [],
945        )

Add and/or remove custom field values on multiple documents.

Arguments:
  • document_ids: List of document IDs to modify.
  • add_fields: Custom-field value dicts to add.
  • remove_fields: Custom-field IDs whose values should be removed.
async def bulk_set_permissions( self, document_ids: List[int], *, set_permissions: easypaperless.SetPermissions | easypaperless.Unset = UNSET, owner: int | None | easypaperless.Unset = UNSET, merge: bool = False) -> None:
947    async def bulk_set_permissions(
948        self,
949        document_ids: List[int],
950        *,
951        set_permissions: SetPermissions | Unset = UNSET,
952        owner: int | None | Unset = UNSET,
953        merge: bool = False,
954    ) -> None:
955        """Set permissions and/or owner on multiple documents.
956
957        Args:
958            document_ids: List of document IDs to modify.
959            set_permissions: Explicit view/change permission sets.
960                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
961            owner: Numeric user ID to assign as document owner.
962                Pass ``None`` to clear the owner.
963                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
964            merge: When ``True``, new permissions are merged with existing ones.
965        """
966        logger.info("Bulk setting permissions on %d documents", len(document_ids))
967        params: dict[str, Any] = {"merge": merge}
968        if not isinstance(set_permissions, Unset):
969            params["set_permissions"] = set_permissions.model_dump()
970        if not isinstance(owner, Unset):
971            params["owner"] = owner
972        await self._bulk_edit(document_ids, "set_permissions", **params)

Set permissions and/or owner on multiple documents.

Arguments:
  • document_ids: List of document IDs to modify.
  • set_permissions: Explicit view/change permission sets. Omit (or pass ~easypaperless.UNSET) to leave unchanged.
  • owner: Numeric user ID to assign as document owner. Pass None to clear the owner. Omit (or pass ~easypaperless.UNSET) to leave unchanged.
  • merge: When True, new permissions are merged with existing ones.
class NotesResource:
 43class NotesResource:
 44    """Accessor for document notes: ``client.documents.notes``."""
 45
 46    def __init__(self, core: _ClientCore) -> None:
 47        self._core = core
 48
 49    async def list(
 50        self,
 51        document_id: int,
 52        *,
 53        page: int | None = None,
 54        page_size: int | None = None,
 55    ) -> PagedResult[DocumentNote]:
 56        """Fetch notes attached to a document.
 57
 58        When ``page`` is ``None`` (the default), all pages are fetched
 59        automatically and ``next`` / ``previous`` in the returned
 60        :class:`~easypaperless.models.paged_result.PagedResult` are always
 61        ``None``.  When ``page`` is set to a specific integer, only that one
 62        page is fetched and ``next`` / ``previous`` contain the raw API values.
 63
 64        Args:
 65            document_id: Numeric ID of the document whose notes to retrieve.
 66            page: Return only this specific page (1-based).
 67            page_size: Number of results per page.
 68
 69        Returns:
 70            :class:`~easypaperless.models.paged_result.PagedResult` of
 71            :class:`~easypaperless.models.documents.DocumentNote` objects,
 72            ordered by creation time.
 73
 74        Raises:
 75            ~easypaperless.exceptions.NotFoundError: If no document exists
 76                with that ID.
 77        """
 78        logger.info("Listing notes for document id=%d", document_id)
 79        path = f"/documents/{document_id}/notes/"
 80        params: dict[str, Any] = {}
 81        if page_size is not None:
 82            params["page_size"] = page_size
 83        if page is not None:
 84            params["page"] = page
 85
 86        resp = await self._core._session.get(path, params=params or None)
 87        data = resp.json()
 88
 89        if isinstance(data, list):
 90            # The paperless-ngx notes endpoint returns a plain JSON array rather
 91            # than a paginated envelope.  Build a synthetic PagedResult so callers
 92            # always receive a consistent return type regardless of API version.
 93            notes = [DocumentNote.model_validate(item) for item in data]
 94            note_ids = [n.id for n in notes if n.id is not None]
 95            all_ids: list[int] | None = note_ids if note_ids else None
 96            return PagedResult(
 97                count=len(notes),
 98                next=None,
 99                previous=None,
100                all=all_ids,
101                results=notes,
102            )
103
104        # Paginated dict envelope — forward-compatible with potential future API changes.
105        items: list[Any] = list(data.get("results", []))
106        count: int = data.get("count", 0)
107        page_all_ids: list[int] | None = data.get("all")
108
109        if page is None:
110            next_url: str | None = data.get("next")
111            while next_url:
112                next_url = self._core._session._normalise_next_url(next_url)
113                page_resp = await self._core._session.get(next_url)
114                page_data = page_resp.json()
115                items.extend(page_data.get("results", []))
116                next_url = page_data.get("next")
117            return PagedResult(
118                count=count,
119                next=None,
120                previous=None,
121                all=page_all_ids,
122                results=[DocumentNote.model_validate(item) for item in items],
123            )
124
125        return cast(
126            PagedResult[DocumentNote],
127            PagedResult(
128                count=count,
129                next=data.get("next"),
130                previous=data.get("previous"),
131                all=page_all_ids,
132                results=[DocumentNote.model_validate(item) for item in items],
133            ),
134        )
135
136    async def create(self, document_id: int, *, note: str) -> DocumentNote:
137        """Create a new note on a document.
138
139        Args:
140            document_id: Numeric ID of the document to annotate.
141            note: Text content of the note.
142
143        Returns:
144            The newly created :class:`~easypaperless.models.documents.DocumentNote`.
145
146        Raises:
147            ~easypaperless.exceptions.NotFoundError: If no document exists
148                with that ID.
149        """
150        logger.info("Creating note for document id=%d", document_id)
151        resp = await self._core._session.post(
152            f"/documents/{document_id}/notes/",
153            json={"note": note},
154        )
155        data = resp.json()
156        if isinstance(data, list):
157            return DocumentNote.model_validate(data[-1])
158        return DocumentNote.model_validate(data)
159
160    async def delete(self, document_id: int, note_id: int) -> None:
161        """Delete a note from a document.
162
163        Args:
164            document_id: Numeric ID of the document that owns the note.
165            note_id: Numeric ID of the note to delete.
166
167        Raises:
168            ~easypaperless.exceptions.NotFoundError: If no document or note
169                exists with the given IDs.
170        """
171        logger.info("Deleting note id=%d from document id=%d", note_id, document_id)
172        await self._core._session.delete(f"/documents/{document_id}/notes/", params={"id": note_id})

Accessor for document notes: client.documents.notes.

NotesResource(core: easypaperless.client._ClientCore)
46    def __init__(self, core: _ClientCore) -> None:
47        self._core = core
async def list( self, document_id: int, *, page: int | None = None, page_size: int | None = None) -> easypaperless.PagedResult[DocumentNote]:
 49    async def list(
 50        self,
 51        document_id: int,
 52        *,
 53        page: int | None = None,
 54        page_size: int | None = None,
 55    ) -> PagedResult[DocumentNote]:
 56        """Fetch notes attached to a document.
 57
 58        When ``page`` is ``None`` (the default), all pages are fetched
 59        automatically and ``next`` / ``previous`` in the returned
 60        :class:`~easypaperless.models.paged_result.PagedResult` are always
 61        ``None``.  When ``page`` is set to a specific integer, only that one
 62        page is fetched and ``next`` / ``previous`` contain the raw API values.
 63
 64        Args:
 65            document_id: Numeric ID of the document whose notes to retrieve.
 66            page: Return only this specific page (1-based).
 67            page_size: Number of results per page.
 68
 69        Returns:
 70            :class:`~easypaperless.models.paged_result.PagedResult` of
 71            :class:`~easypaperless.models.documents.DocumentNote` objects,
 72            ordered by creation time.
 73
 74        Raises:
 75            ~easypaperless.exceptions.NotFoundError: If no document exists
 76                with that ID.
 77        """
 78        logger.info("Listing notes for document id=%d", document_id)
 79        path = f"/documents/{document_id}/notes/"
 80        params: dict[str, Any] = {}
 81        if page_size is not None:
 82            params["page_size"] = page_size
 83        if page is not None:
 84            params["page"] = page
 85
 86        resp = await self._core._session.get(path, params=params or None)
 87        data = resp.json()
 88
 89        if isinstance(data, list):
 90            # The paperless-ngx notes endpoint returns a plain JSON array rather
 91            # than a paginated envelope.  Build a synthetic PagedResult so callers
 92            # always receive a consistent return type regardless of API version.
 93            notes = [DocumentNote.model_validate(item) for item in data]
 94            note_ids = [n.id for n in notes if n.id is not None]
 95            all_ids: list[int] | None = note_ids if note_ids else None
 96            return PagedResult(
 97                count=len(notes),
 98                next=None,
 99                previous=None,
100                all=all_ids,
101                results=notes,
102            )
103
104        # Paginated dict envelope — forward-compatible with potential future API changes.
105        items: list[Any] = list(data.get("results", []))
106        count: int = data.get("count", 0)
107        page_all_ids: list[int] | None = data.get("all")
108
109        if page is None:
110            next_url: str | None = data.get("next")
111            while next_url:
112                next_url = self._core._session._normalise_next_url(next_url)
113                page_resp = await self._core._session.get(next_url)
114                page_data = page_resp.json()
115                items.extend(page_data.get("results", []))
116                next_url = page_data.get("next")
117            return PagedResult(
118                count=count,
119                next=None,
120                previous=None,
121                all=page_all_ids,
122                results=[DocumentNote.model_validate(item) for item in items],
123            )
124
125        return cast(
126            PagedResult[DocumentNote],
127            PagedResult(
128                count=count,
129                next=data.get("next"),
130                previous=data.get("previous"),
131                all=page_all_ids,
132                results=[DocumentNote.model_validate(item) for item in items],
133            ),
134        )

Fetch notes attached to a document.

When page is None (the default), all pages are fetched automatically and next / previous in the returned ~easypaperless.models.paged_result.PagedResult are always None. When page is set to a specific integer, only that one page is fetched and next / previous contain the raw API values.

Arguments:
  • document_id: Numeric ID of the document whose notes to retrieve.
  • page: Return only this specific page (1-based).
  • page_size: Number of results per page.
Returns:

~easypaperless.models.paged_result.PagedResult of ~easypaperless.models.documents.DocumentNote objects, ordered by creation time.

Raises:
async def create( self, document_id: int, *, note: str) -> easypaperless.DocumentNote:
136    async def create(self, document_id: int, *, note: str) -> DocumentNote:
137        """Create a new note on a document.
138
139        Args:
140            document_id: Numeric ID of the document to annotate.
141            note: Text content of the note.
142
143        Returns:
144            The newly created :class:`~easypaperless.models.documents.DocumentNote`.
145
146        Raises:
147            ~easypaperless.exceptions.NotFoundError: If no document exists
148                with that ID.
149        """
150        logger.info("Creating note for document id=%d", document_id)
151        resp = await self._core._session.post(
152            f"/documents/{document_id}/notes/",
153            json={"note": note},
154        )
155        data = resp.json()
156        if isinstance(data, list):
157            return DocumentNote.model_validate(data[-1])
158        return DocumentNote.model_validate(data)

Create a new note on a document.

Arguments:
  • document_id: Numeric ID of the document to annotate.
  • note: Text content of the note.
Returns:

The newly created ~easypaperless.models.documents.DocumentNote.

Raises:
async def delete(self, document_id: int, note_id: int) -> None:
160    async def delete(self, document_id: int, note_id: int) -> None:
161        """Delete a note from a document.
162
163        Args:
164            document_id: Numeric ID of the document that owns the note.
165            note_id: Numeric ID of the note to delete.
166
167        Raises:
168            ~easypaperless.exceptions.NotFoundError: If no document or note
169                exists with the given IDs.
170        """
171        logger.info("Deleting note id=%d from document id=%d", note_id, document_id)
172        await self._core._session.delete(f"/documents/{document_id}/notes/", params={"id": note_id})

Delete a note from a document.

Arguments:
  • document_id: Numeric ID of the document that owns the note.
  • note_id: Numeric ID of the note to delete.
Raises:
class StoragePathsResource:
 21class StoragePathsResource:
 22    """Accessor for storage paths: ``client.storage_paths``."""
 23
 24    def __init__(self, core: _ClientCore) -> None:
 25        self._core = core
 26
 27    async def list(
 28        self,
 29        *,
 30        ids: List[int] | None = None,
 31        name_contains: str | None = None,
 32        name_exact: str | None = None,
 33        path_contains: str | None = None,
 34        path_exact: str | None = None,
 35        page: int | None = None,
 36        page_size: int | None = None,
 37        ordering: str | None = None,
 38        descending: bool = False,
 39    ) -> PagedResult[StoragePath]:
 40        """Return storage paths defined in paperless-ngx.
 41
 42        When ``page`` is ``None`` (the default), all pages are fetched
 43        automatically and ``next`` / ``previous`` in the result are always
 44        ``None``.  When ``page`` is set, only that page is fetched and
 45        ``next`` / ``previous`` reflect the raw API values.
 46
 47        Args:
 48            ids: Return only storage paths whose ID is in this list.
 49            name_contains: Case-insensitive substring filter on name.
 50            name_exact: Case-insensitive exact match on name.
 51            path_contains: Case-insensitive substring filter on path template.
 52            path_exact: Case-insensitive exact match on path template.
 53            page: Return only this specific page (1-based).
 54            page_size: Number of results per page.
 55            ordering: Field to sort by.
 56            descending: When ``True``, reverses the sort direction.
 57
 58        Returns:
 59            :class:`~easypaperless.models.paged_result.PagedResult` of
 60            :class:`~easypaperless.models.storage_paths.StoragePath` objects.
 61        """
 62        logger.info("Listing storage paths")
 63        params: dict[str, Any] = {}
 64        if ids is not None:
 65            params["id__in"] = ",".join(str(i) for i in ids)
 66        if name_contains is not None:
 67            params["name__icontains"] = name_contains
 68        if name_exact is not None:
 69            params["name__iexact"] = name_exact
 70        if path_contains is not None:
 71            params["path__icontains"] = path_contains
 72        if path_exact is not None:
 73            params["path__iexact"] = path_exact
 74        if page is not None:
 75            params["page"] = page
 76        if page_size is not None:
 77            params["page_size"] = page_size
 78        if ordering is not None:
 79            params["ordering"] = f"-{ordering}" if descending else ordering
 80        return cast(
 81            PagedResult[StoragePath],
 82            await self._core._list_resource("storage_paths", StoragePath, params or None),
 83        )
 84
 85    async def get(self, id: int) -> StoragePath:
 86        """Fetch a single storage path by its ID.
 87
 88        Args:
 89            id: Numeric storage-path ID.
 90
 91        Returns:
 92            The :class:`~easypaperless.models.storage_paths.StoragePath` with the given ID.
 93
 94        Raises:
 95            ~easypaperless.exceptions.NotFoundError: If no storage path exists with that ID.
 96        """
 97        logger.info("Getting storage path id=%d", id)
 98        return cast(StoragePath, await self._core._get_resource("storage_paths", id, StoragePath))
 99
100    async def create(
101        self,
102        *,
103        name: str,
104        path: str | Unset = UNSET,
105        match: str | Unset = UNSET,
106        matching_algorithm: MatchingAlgorithm | Unset = UNSET,
107        is_insensitive: bool = True,
108        owner: int | None | Unset = UNSET,
109        set_permissions: SetPermissions | None | Unset = UNSET,
110    ) -> StoragePath:
111        """Create a new storage path.
112
113        Args:
114            name: Storage-path name. Must be unique.
115            path: Template string for the archive file path.
116            match: Auto-matching pattern.
117            matching_algorithm: Controls how ``match`` is applied.
118                E.g. ``matching_algorithm=MatchingAlgorithm.REGEX`` for
119                regular-expression matching.
120            is_insensitive: When ``True``, ``match`` is case-insensitive.
121                Defaults to ``True``, matching the paperless-ngx API default.
122            owner: Numeric user ID to assign as owner.
123            set_permissions: Explicit view/change permission sets.
124                Pass ``None`` to create with empty permissions.
125
126        Returns:
127            The newly created :class:`~easypaperless.models.storage_paths.StoragePath`.
128        """
129        logger.info("Creating storage path name=%r", name)
130        return cast(
131            StoragePath,
132            await self._core._create_resource(
133                "storage_paths",
134                StoragePath,
135                owner=owner,
136                set_permissions=set_permissions,
137                name=name,
138                path=path,
139                match=match,
140                matching_algorithm=matching_algorithm,
141                is_insensitive=is_insensitive,
142            ),
143        )
144
145    async def update(
146        self,
147        id: int,
148        *,
149        name: str | Unset = UNSET,
150        path: str | Unset = UNSET,
151        match: str | Unset = UNSET,
152        matching_algorithm: MatchingAlgorithm | Unset = UNSET,
153        is_insensitive: bool | Unset = UNSET,
154        owner: int | None | Unset = UNSET,
155        set_permissions: SetPermissions | None | Unset = UNSET,
156    ) -> StoragePath:
157        """Partially update a storage path (PATCH semantics).
158
159        Args:
160            id: Numeric ID of the storage path to update.
161            name: Storage-path name.
162            path: Template string for the archive file path.
163            match: Auto-matching pattern.
164            matching_algorithm: Controls how ``match`` is applied.
165                E.g. ``matching_algorithm=MatchingAlgorithm.REGEX`` for
166                regular-expression matching.
167            is_insensitive: When ``True``, ``match`` is case-insensitive.
168            owner: Numeric user ID to assign as owner.
169                Pass ``None`` to clear the owner.
170                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
171            set_permissions: Explicit view/change permission sets.
172                Pass ``None`` to clear all permissions (overwrite with empty).
173                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
174
175        Returns:
176            The updated :class:`~easypaperless.models.storage_paths.StoragePath`.
177        """
178        logger.info("Updating storage path id=%d", id)
179        return cast(
180            StoragePath,
181            await self._core._update_resource(
182                "storage_paths",
183                id,
184                StoragePath,
185                name=name,
186                path=path,
187                match=match,
188                matching_algorithm=matching_algorithm,
189                is_insensitive=is_insensitive,
190                owner=owner,
191                set_permissions=set_permissions,
192            ),
193        )
194
195    async def delete(self, id: int) -> None:
196        """Delete a storage path.
197
198        Args:
199            id: Numeric ID of the storage path to delete.
200
201        Raises:
202            ~easypaperless.exceptions.NotFoundError: If no storage path exists with that ID.
203        """
204        logger.info("Deleting storage path id=%d", id)
205        await self._core._delete_resource("storage_paths", id)
206
207    async def bulk_delete(self, ids: List[int]) -> None:
208        """Permanently delete multiple storage paths in a single request.
209
210        Args:
211            ids: List of storage path IDs to delete.
212        """
213        logger.info("Bulk deleting %d storage paths", len(ids))
214        await self._core._bulk_edit_objects("storage_paths", ids, "delete")
215
216    async def bulk_set_permissions(
217        self,
218        ids: List[int],
219        *,
220        set_permissions: SetPermissions | Unset = UNSET,
221        owner: int | None | Unset = UNSET,
222        merge: bool = False,
223    ) -> None:
224        """Set permissions and/or owner on multiple storage paths.
225
226        Args:
227            ids: List of storage path IDs to modify.
228            set_permissions: Explicit view/change permission sets.
229                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
230            owner: Numeric user ID to assign as owner.
231                Pass ``None`` to clear the owner.
232                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
233            merge: When ``True``, new permissions are merged with existing ones.
234        """
235        logger.info("Bulk setting permissions on %d storage paths", len(ids))
236        params: dict[str, Any] = {"merge": merge}
237        if not isinstance(set_permissions, Unset):
238            params["permissions"] = set_permissions.model_dump()
239        if not isinstance(owner, Unset):
240            params["owner"] = owner
241        await self._core._bulk_edit_objects("storage_paths", ids, "set_permissions", **params)

Accessor for storage paths: client.storage_paths.

StoragePathsResource(core: easypaperless.client._ClientCore)
24    def __init__(self, core: _ClientCore) -> None:
25        self._core = core
async def list( self, *, ids: Optional[List[int]] = None, name_contains: str | None = None, name_exact: str | None = None, path_contains: str | None = None, path_exact: str | None = None, page: int | None = None, page_size: int | None = None, ordering: str | None = None, descending: bool = False) -> easypaperless.PagedResult[StoragePath]:
27    async def list(
28        self,
29        *,
30        ids: List[int] | None = None,
31        name_contains: str | None = None,
32        name_exact: str | None = None,
33        path_contains: str | None = None,
34        path_exact: str | None = None,
35        page: int | None = None,
36        page_size: int | None = None,
37        ordering: str | None = None,
38        descending: bool = False,
39    ) -> PagedResult[StoragePath]:
40        """Return storage paths defined in paperless-ngx.
41
42        When ``page`` is ``None`` (the default), all pages are fetched
43        automatically and ``next`` / ``previous`` in the result are always
44        ``None``.  When ``page`` is set, only that page is fetched and
45        ``next`` / ``previous`` reflect the raw API values.
46
47        Args:
48            ids: Return only storage paths whose ID is in this list.
49            name_contains: Case-insensitive substring filter on name.
50            name_exact: Case-insensitive exact match on name.
51            path_contains: Case-insensitive substring filter on path template.
52            path_exact: Case-insensitive exact match on path template.
53            page: Return only this specific page (1-based).
54            page_size: Number of results per page.
55            ordering: Field to sort by.
56            descending: When ``True``, reverses the sort direction.
57
58        Returns:
59            :class:`~easypaperless.models.paged_result.PagedResult` of
60            :class:`~easypaperless.models.storage_paths.StoragePath` objects.
61        """
62        logger.info("Listing storage paths")
63        params: dict[str, Any] = {}
64        if ids is not None:
65            params["id__in"] = ",".join(str(i) for i in ids)
66        if name_contains is not None:
67            params["name__icontains"] = name_contains
68        if name_exact is not None:
69            params["name__iexact"] = name_exact
70        if path_contains is not None:
71            params["path__icontains"] = path_contains
72        if path_exact is not None:
73            params["path__iexact"] = path_exact
74        if page is not None:
75            params["page"] = page
76        if page_size is not None:
77            params["page_size"] = page_size
78        if ordering is not None:
79            params["ordering"] = f"-{ordering}" if descending else ordering
80        return cast(
81            PagedResult[StoragePath],
82            await self._core._list_resource("storage_paths", StoragePath, params or None),
83        )

Return storage paths defined in paperless-ngx.

When page is None (the default), all pages are fetched automatically and next / previous in the result are always None. When page is set, only that page is fetched and next / previous reflect the raw API values.

Arguments:
  • ids: Return only storage paths whose ID is in this list.
  • name_contains: Case-insensitive substring filter on name.
  • name_exact: Case-insensitive exact match on name.
  • path_contains: Case-insensitive substring filter on path template.
  • path_exact: Case-insensitive exact match on path template.
  • page: Return only this specific page (1-based).
  • page_size: Number of results per page.
  • ordering: Field to sort by.
  • descending: When True, reverses the sort direction.
Returns:

~easypaperless.models.paged_result.PagedResult of ~easypaperless.models.storage_paths.StoragePath objects.

async def get(self, id: int) -> easypaperless.StoragePath:
85    async def get(self, id: int) -> StoragePath:
86        """Fetch a single storage path by its ID.
87
88        Args:
89            id: Numeric storage-path ID.
90
91        Returns:
92            The :class:`~easypaperless.models.storage_paths.StoragePath` with the given ID.
93
94        Raises:
95            ~easypaperless.exceptions.NotFoundError: If no storage path exists with that ID.
96        """
97        logger.info("Getting storage path id=%d", id)
98        return cast(StoragePath, await self._core._get_resource("storage_paths", id, StoragePath))

Fetch a single storage path by its ID.

Arguments:
  • id: Numeric storage-path ID.
Returns:

The ~easypaperless.models.storage_paths.StoragePath with the given ID.

Raises:
async def create( self, *, name: str, path: str | easypaperless.Unset = UNSET, match: str | easypaperless.Unset = UNSET, matching_algorithm: easypaperless.MatchingAlgorithm | easypaperless.Unset = UNSET, is_insensitive: bool = True, owner: int | None | easypaperless.Unset = UNSET, set_permissions: easypaperless.SetPermissions | None | easypaperless.Unset = UNSET) -> easypaperless.StoragePath:
100    async def create(
101        self,
102        *,
103        name: str,
104        path: str | Unset = UNSET,
105        match: str | Unset = UNSET,
106        matching_algorithm: MatchingAlgorithm | Unset = UNSET,
107        is_insensitive: bool = True,
108        owner: int | None | Unset = UNSET,
109        set_permissions: SetPermissions | None | Unset = UNSET,
110    ) -> StoragePath:
111        """Create a new storage path.
112
113        Args:
114            name: Storage-path name. Must be unique.
115            path: Template string for the archive file path.
116            match: Auto-matching pattern.
117            matching_algorithm: Controls how ``match`` is applied.
118                E.g. ``matching_algorithm=MatchingAlgorithm.REGEX`` for
119                regular-expression matching.
120            is_insensitive: When ``True``, ``match`` is case-insensitive.
121                Defaults to ``True``, matching the paperless-ngx API default.
122            owner: Numeric user ID to assign as owner.
123            set_permissions: Explicit view/change permission sets.
124                Pass ``None`` to create with empty permissions.
125
126        Returns:
127            The newly created :class:`~easypaperless.models.storage_paths.StoragePath`.
128        """
129        logger.info("Creating storage path name=%r", name)
130        return cast(
131            StoragePath,
132            await self._core._create_resource(
133                "storage_paths",
134                StoragePath,
135                owner=owner,
136                set_permissions=set_permissions,
137                name=name,
138                path=path,
139                match=match,
140                matching_algorithm=matching_algorithm,
141                is_insensitive=is_insensitive,
142            ),
143        )

Create a new storage path.

Arguments:
  • name: Storage-path name. Must be unique.
  • path: Template string for the archive file path.
  • match: Auto-matching pattern.
  • matching_algorithm: Controls how match is applied. E.g. matching_algorithm=MatchingAlgorithm.REGEX for regular-expression matching.
  • is_insensitive: When True, match is case-insensitive. Defaults to True, matching the paperless-ngx API default.
  • owner: Numeric user ID to assign as owner.
  • set_permissions: Explicit view/change permission sets. Pass None to create with empty permissions.
Returns:

The newly created ~easypaperless.models.storage_paths.StoragePath.

async def update( self, id: int, *, name: str | easypaperless.Unset = UNSET, path: str | easypaperless.Unset = UNSET, match: str | easypaperless.Unset = UNSET, matching_algorithm: easypaperless.MatchingAlgorithm | easypaperless.Unset = UNSET, is_insensitive: bool | easypaperless.Unset = UNSET, owner: int | None | easypaperless.Unset = UNSET, set_permissions: easypaperless.SetPermissions | None | easypaperless.Unset = UNSET) -> easypaperless.StoragePath:
145    async def update(
146        self,
147        id: int,
148        *,
149        name: str | Unset = UNSET,
150        path: str | Unset = UNSET,
151        match: str | Unset = UNSET,
152        matching_algorithm: MatchingAlgorithm | Unset = UNSET,
153        is_insensitive: bool | Unset = UNSET,
154        owner: int | None | Unset = UNSET,
155        set_permissions: SetPermissions | None | Unset = UNSET,
156    ) -> StoragePath:
157        """Partially update a storage path (PATCH semantics).
158
159        Args:
160            id: Numeric ID of the storage path to update.
161            name: Storage-path name.
162            path: Template string for the archive file path.
163            match: Auto-matching pattern.
164            matching_algorithm: Controls how ``match`` is applied.
165                E.g. ``matching_algorithm=MatchingAlgorithm.REGEX`` for
166                regular-expression matching.
167            is_insensitive: When ``True``, ``match`` is case-insensitive.
168            owner: Numeric user ID to assign as owner.
169                Pass ``None`` to clear the owner.
170                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
171            set_permissions: Explicit view/change permission sets.
172                Pass ``None`` to clear all permissions (overwrite with empty).
173                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
174
175        Returns:
176            The updated :class:`~easypaperless.models.storage_paths.StoragePath`.
177        """
178        logger.info("Updating storage path id=%d", id)
179        return cast(
180            StoragePath,
181            await self._core._update_resource(
182                "storage_paths",
183                id,
184                StoragePath,
185                name=name,
186                path=path,
187                match=match,
188                matching_algorithm=matching_algorithm,
189                is_insensitive=is_insensitive,
190                owner=owner,
191                set_permissions=set_permissions,
192            ),
193        )

Partially update a storage path (PATCH semantics).

Arguments:
  • id: Numeric ID of the storage path to update.
  • name: Storage-path name.
  • path: Template string for the archive file path.
  • match: Auto-matching pattern.
  • matching_algorithm: Controls how match is applied. E.g. matching_algorithm=MatchingAlgorithm.REGEX for regular-expression matching.
  • is_insensitive: When True, match is case-insensitive.
  • owner: Numeric user ID to assign as owner. Pass None to clear the owner. Omit (or pass ~easypaperless.UNSET) to leave unchanged.
  • set_permissions: Explicit view/change permission sets. Pass None to clear all permissions (overwrite with empty). Omit (or pass ~easypaperless.UNSET) to leave unchanged.
Returns:

The updated ~easypaperless.models.storage_paths.StoragePath.

async def delete(self, id: int) -> None:
195    async def delete(self, id: int) -> None:
196        """Delete a storage path.
197
198        Args:
199            id: Numeric ID of the storage path to delete.
200
201        Raises:
202            ~easypaperless.exceptions.NotFoundError: If no storage path exists with that ID.
203        """
204        logger.info("Deleting storage path id=%d", id)
205        await self._core._delete_resource("storage_paths", id)

Delete a storage path.

Arguments:
  • id: Numeric ID of the storage path to delete.
Raises:
async def bulk_delete(self, ids: List[int]) -> None:
207    async def bulk_delete(self, ids: List[int]) -> None:
208        """Permanently delete multiple storage paths in a single request.
209
210        Args:
211            ids: List of storage path IDs to delete.
212        """
213        logger.info("Bulk deleting %d storage paths", len(ids))
214        await self._core._bulk_edit_objects("storage_paths", ids, "delete")

Permanently delete multiple storage paths in a single request.

Arguments:
  • ids: List of storage path IDs to delete.
async def bulk_set_permissions( self, ids: List[int], *, set_permissions: easypaperless.SetPermissions | easypaperless.Unset = UNSET, owner: int | None | easypaperless.Unset = UNSET, merge: bool = False) -> None:
216    async def bulk_set_permissions(
217        self,
218        ids: List[int],
219        *,
220        set_permissions: SetPermissions | Unset = UNSET,
221        owner: int | None | Unset = UNSET,
222        merge: bool = False,
223    ) -> None:
224        """Set permissions and/or owner on multiple storage paths.
225
226        Args:
227            ids: List of storage path IDs to modify.
228            set_permissions: Explicit view/change permission sets.
229                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
230            owner: Numeric user ID to assign as owner.
231                Pass ``None`` to clear the owner.
232                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
233            merge: When ``True``, new permissions are merged with existing ones.
234        """
235        logger.info("Bulk setting permissions on %d storage paths", len(ids))
236        params: dict[str, Any] = {"merge": merge}
237        if not isinstance(set_permissions, Unset):
238            params["permissions"] = set_permissions.model_dump()
239        if not isinstance(owner, Unset):
240            params["owner"] = owner
241        await self._core._bulk_edit_objects("storage_paths", ids, "set_permissions", **params)

Set permissions and/or owner on multiple storage paths.

Arguments:
  • ids: List of storage path IDs to modify.
  • set_permissions: Explicit view/change permission sets. Omit (or pass ~easypaperless.UNSET) to leave unchanged.
  • owner: Numeric user ID to assign as owner. Pass None to clear the owner. Omit (or pass ~easypaperless.UNSET) to leave unchanged.
  • merge: When True, new permissions are merged with existing ones.
class TagsResource:
 21class TagsResource:
 22    """Accessor for tags: ``client.tags``."""
 23
 24    def __init__(self, core: _ClientCore) -> None:
 25        self._core = core
 26
 27    async def list(
 28        self,
 29        *,
 30        ids: List[int] | None = None,
 31        name_contains: str | None = None,
 32        name_exact: str | None = None,
 33        page: int | None = None,
 34        page_size: int | None = None,
 35        ordering: str | None = None,
 36        descending: bool = False,
 37    ) -> PagedResult[Tag]:
 38        """Return tags defined in paperless-ngx.
 39
 40        When ``page`` is ``None`` (the default), all pages are fetched
 41        automatically and ``next`` / ``previous`` in the result are always
 42        ``None``.  When ``page`` is set, only that page is fetched and
 43        ``next`` / ``previous`` reflect the raw API values.
 44
 45        Args:
 46            ids: Return only tags whose ID is in this list.
 47            name_contains: Case-insensitive substring filter on tag name.
 48            name_exact: Case-insensitive exact match on tag name.
 49            page: Return only this specific page (1-based).
 50            page_size: Number of results per page.
 51            ordering: Field to sort by.
 52            descending: When ``True``, reverses the sort direction.
 53
 54        Returns:
 55            :class:`~easypaperless.models.paged_result.PagedResult` of
 56            :class:`~easypaperless.models.tags.Tag` objects.
 57        """
 58        logger.info("Listing tags")
 59        params: dict[str, Any] = {}
 60        if ids is not None:
 61            params["id__in"] = ",".join(str(i) for i in ids)
 62        if name_contains is not None:
 63            params["name__icontains"] = name_contains
 64        if name_exact is not None:
 65            params["name__iexact"] = name_exact
 66        if page is not None:
 67            params["page"] = page
 68        if page_size is not None:
 69            params["page_size"] = page_size
 70        if ordering is not None:
 71            params["ordering"] = f"-{ordering}" if descending else ordering
 72        return cast(
 73            PagedResult[Tag],
 74            await self._core._list_resource("tags", Tag, params or None),
 75        )
 76
 77    async def get(self, id: int) -> Tag:
 78        """Fetch a single tag by its ID.
 79
 80        Args:
 81            id: Numeric tag ID.
 82
 83        Returns:
 84            The :class:`~easypaperless.models.tags.Tag` with the given ID.
 85
 86        Raises:
 87            ~easypaperless.exceptions.NotFoundError: If no tag exists with
 88                that ID.
 89        """
 90        logger.info("Getting tag id=%d", id)
 91        return cast(Tag, await self._core._get_resource("tags", id, Tag))
 92
 93    async def create(
 94        self,
 95        *,
 96        name: str,
 97        color: str | Unset = UNSET,
 98        is_inbox_tag: bool | Unset = UNSET,
 99        match: str | Unset = UNSET,
100        matching_algorithm: MatchingAlgorithm | Unset = UNSET,
101        is_insensitive: bool = True,
102        parent: int | None | Unset = UNSET,
103        owner: int | None | Unset = UNSET,
104        set_permissions: SetPermissions | None | Unset = UNSET,
105    ) -> Tag:
106        """Create a new tag.
107
108        Args:
109            name: Tag name. Must be unique.
110            color: Background colour as a CSS hex string.
111            is_inbox_tag: When ``True``, newly ingested documents get this tag.
112            match: Auto-matching pattern.
113            matching_algorithm: Controls how ``match`` is applied.
114                E.g. ``matching_algorithm=MatchingAlgorithm.REGEX`` for
115                regular-expression matching.
116            is_insensitive: When ``True``, ``match`` is case-insensitive.
117                Defaults to ``True``, matching the paperless-ngx API default.
118            parent: ID of parent tag for hierarchical trees.
119            owner: Numeric user ID to assign as owner.
120            set_permissions: Explicit view/change permission sets.
121                Pass ``None`` to create with empty permissions.
122
123        Returns:
124            The newly created :class:`~easypaperless.models.tags.Tag`.
125        """
126        logger.info("Creating tag name=%r", name)
127        return cast(
128            Tag,
129            await self._core._create_resource(
130                "tags",
131                Tag,
132                owner=owner,
133                set_permissions=set_permissions,
134                name=name,
135                color=color,
136                is_inbox_tag=is_inbox_tag,
137                match=match,
138                matching_algorithm=matching_algorithm,
139                is_insensitive=is_insensitive,
140                parent=parent,
141            ),
142        )
143
144    async def update(
145        self,
146        id: int,
147        *,
148        name: str | Unset = UNSET,
149        color: str | Unset = UNSET,
150        is_inbox_tag: bool | Unset = UNSET,
151        match: str | Unset = UNSET,
152        matching_algorithm: MatchingAlgorithm | Unset = UNSET,
153        is_insensitive: bool | Unset = UNSET,
154        parent: int | None | Unset = UNSET,
155        owner: int | None | Unset = UNSET,
156        set_permissions: SetPermissions | None | Unset = UNSET,
157    ) -> Tag:
158        """Partially update a tag (PATCH semantics).
159
160        Args:
161            id: Numeric ID of the tag to update.
162            name: Tag name.
163            color: Background colour as a CSS hex string.
164            is_inbox_tag: When ``True``, newly ingested documents get this tag.
165            match: Auto-matching pattern.
166            matching_algorithm: Controls how ``match`` is applied.
167                E.g. ``matching_algorithm=MatchingAlgorithm.REGEX`` for
168                regular-expression matching.
169            is_insensitive: When ``True``, ``match`` is case-insensitive.
170            parent: ID of parent tag.
171                Pass ``None`` to clear (make root tag).
172                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
173            owner: Numeric user ID to assign as owner.
174                Pass ``None`` to clear the owner.
175                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
176            set_permissions: Explicit view/change permission sets.
177                Pass ``None`` to clear all permissions (overwrite with empty).
178                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
179
180        Returns:
181            The updated :class:`~easypaperless.models.tags.Tag`.
182        """
183        logger.info("Updating tag id=%d", id)
184        return cast(
185            Tag,
186            await self._core._update_resource(
187                "tags",
188                id,
189                Tag,
190                name=name,
191                color=color,
192                is_inbox_tag=is_inbox_tag,
193                match=match,
194                matching_algorithm=matching_algorithm,
195                is_insensitive=is_insensitive,
196                parent=parent,
197                owner=owner,
198                set_permissions=set_permissions,
199            ),
200        )
201
202    async def delete(self, id: int) -> None:
203        """Delete a tag.
204
205        Args:
206            id: Numeric ID of the tag to delete.
207
208        Raises:
209            ~easypaperless.exceptions.NotFoundError: If no tag exists with
210                that ID.
211        """
212        logger.info("Deleting tag id=%d", id)
213        await self._core._delete_resource("tags", id)
214
215    async def bulk_delete(self, ids: List[int]) -> None:
216        """Permanently delete multiple tags in a single request.
217
218        Args:
219            ids: List of tag IDs to delete.
220        """
221        logger.info("Bulk deleting %d tags", len(ids))
222        await self._core._bulk_edit_objects("tags", ids, "delete")
223
224    async def bulk_set_permissions(
225        self,
226        ids: List[int],
227        *,
228        set_permissions: SetPermissions | Unset = UNSET,
229        owner: int | None | Unset = UNSET,
230        merge: bool = False,
231    ) -> None:
232        """Set permissions and/or owner on multiple tags.
233
234        Args:
235            ids: List of tag IDs to modify.
236            set_permissions: Explicit view/change permission sets.
237                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
238            owner: Numeric user ID to assign as owner.
239                Pass ``None`` to clear the owner.
240                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
241            merge: When ``True``, new permissions are merged with existing ones.
242        """
243        logger.info("Bulk setting permissions on %d tags", len(ids))
244        params: dict[str, Any] = {"merge": merge}
245        if not isinstance(set_permissions, Unset):
246            params["permissions"] = set_permissions.model_dump()
247        if not isinstance(owner, Unset):
248            params["owner"] = owner
249        await self._core._bulk_edit_objects("tags", ids, "set_permissions", **params)

Accessor for tags: client.tags.

TagsResource(core: easypaperless.client._ClientCore)
24    def __init__(self, core: _ClientCore) -> None:
25        self._core = core
async def list( self, *, ids: Optional[List[int]] = None, name_contains: str | None = None, name_exact: str | None = None, page: int | None = None, page_size: int | None = None, ordering: str | None = None, descending: bool = False) -> easypaperless.PagedResult[Tag]:
27    async def list(
28        self,
29        *,
30        ids: List[int] | None = None,
31        name_contains: str | None = None,
32        name_exact: str | None = None,
33        page: int | None = None,
34        page_size: int | None = None,
35        ordering: str | None = None,
36        descending: bool = False,
37    ) -> PagedResult[Tag]:
38        """Return tags defined in paperless-ngx.
39
40        When ``page`` is ``None`` (the default), all pages are fetched
41        automatically and ``next`` / ``previous`` in the result are always
42        ``None``.  When ``page`` is set, only that page is fetched and
43        ``next`` / ``previous`` reflect the raw API values.
44
45        Args:
46            ids: Return only tags whose ID is in this list.
47            name_contains: Case-insensitive substring filter on tag name.
48            name_exact: Case-insensitive exact match on tag name.
49            page: Return only this specific page (1-based).
50            page_size: Number of results per page.
51            ordering: Field to sort by.
52            descending: When ``True``, reverses the sort direction.
53
54        Returns:
55            :class:`~easypaperless.models.paged_result.PagedResult` of
56            :class:`~easypaperless.models.tags.Tag` objects.
57        """
58        logger.info("Listing tags")
59        params: dict[str, Any] = {}
60        if ids is not None:
61            params["id__in"] = ",".join(str(i) for i in ids)
62        if name_contains is not None:
63            params["name__icontains"] = name_contains
64        if name_exact is not None:
65            params["name__iexact"] = name_exact
66        if page is not None:
67            params["page"] = page
68        if page_size is not None:
69            params["page_size"] = page_size
70        if ordering is not None:
71            params["ordering"] = f"-{ordering}" if descending else ordering
72        return cast(
73            PagedResult[Tag],
74            await self._core._list_resource("tags", Tag, params or None),
75        )

Return tags defined in paperless-ngx.

When page is None (the default), all pages are fetched automatically and next / previous in the result are always None. When page is set, only that page is fetched and next / previous reflect the raw API values.

Arguments:
  • ids: Return only tags whose ID is in this list.
  • name_contains: Case-insensitive substring filter on tag name.
  • name_exact: Case-insensitive exact match on tag name.
  • page: Return only this specific page (1-based).
  • page_size: Number of results per page.
  • ordering: Field to sort by.
  • descending: When True, reverses the sort direction.
Returns:

~easypaperless.models.paged_result.PagedResult of ~easypaperless.models.tags.Tag objects.

async def get(self, id: int) -> easypaperless.Tag:
77    async def get(self, id: int) -> Tag:
78        """Fetch a single tag by its ID.
79
80        Args:
81            id: Numeric tag ID.
82
83        Returns:
84            The :class:`~easypaperless.models.tags.Tag` with the given ID.
85
86        Raises:
87            ~easypaperless.exceptions.NotFoundError: If no tag exists with
88                that ID.
89        """
90        logger.info("Getting tag id=%d", id)
91        return cast(Tag, await self._core._get_resource("tags", id, Tag))

Fetch a single tag by its ID.

Arguments:
  • id: Numeric tag ID.
Returns:

The ~easypaperless.models.tags.Tag with the given ID.

Raises:
async def create( self, *, name: str, color: str | easypaperless.Unset = UNSET, is_inbox_tag: bool | easypaperless.Unset = UNSET, match: str | easypaperless.Unset = UNSET, matching_algorithm: easypaperless.MatchingAlgorithm | easypaperless.Unset = UNSET, is_insensitive: bool = True, parent: int | None | easypaperless.Unset = UNSET, owner: int | None | easypaperless.Unset = UNSET, set_permissions: easypaperless.SetPermissions | None | easypaperless.Unset = UNSET) -> easypaperless.Tag:
 93    async def create(
 94        self,
 95        *,
 96        name: str,
 97        color: str | Unset = UNSET,
 98        is_inbox_tag: bool | Unset = UNSET,
 99        match: str | Unset = UNSET,
100        matching_algorithm: MatchingAlgorithm | Unset = UNSET,
101        is_insensitive: bool = True,
102        parent: int | None | Unset = UNSET,
103        owner: int | None | Unset = UNSET,
104        set_permissions: SetPermissions | None | Unset = UNSET,
105    ) -> Tag:
106        """Create a new tag.
107
108        Args:
109            name: Tag name. Must be unique.
110            color: Background colour as a CSS hex string.
111            is_inbox_tag: When ``True``, newly ingested documents get this tag.
112            match: Auto-matching pattern.
113            matching_algorithm: Controls how ``match`` is applied.
114                E.g. ``matching_algorithm=MatchingAlgorithm.REGEX`` for
115                regular-expression matching.
116            is_insensitive: When ``True``, ``match`` is case-insensitive.
117                Defaults to ``True``, matching the paperless-ngx API default.
118            parent: ID of parent tag for hierarchical trees.
119            owner: Numeric user ID to assign as owner.
120            set_permissions: Explicit view/change permission sets.
121                Pass ``None`` to create with empty permissions.
122
123        Returns:
124            The newly created :class:`~easypaperless.models.tags.Tag`.
125        """
126        logger.info("Creating tag name=%r", name)
127        return cast(
128            Tag,
129            await self._core._create_resource(
130                "tags",
131                Tag,
132                owner=owner,
133                set_permissions=set_permissions,
134                name=name,
135                color=color,
136                is_inbox_tag=is_inbox_tag,
137                match=match,
138                matching_algorithm=matching_algorithm,
139                is_insensitive=is_insensitive,
140                parent=parent,
141            ),
142        )

Create a new tag.

Arguments:
  • name: Tag name. Must be unique.
  • color: Background colour as a CSS hex string.
  • is_inbox_tag: When True, newly ingested documents get this tag.
  • match: Auto-matching pattern.
  • matching_algorithm: Controls how match is applied. E.g. matching_algorithm=MatchingAlgorithm.REGEX for regular-expression matching.
  • is_insensitive: When True, match is case-insensitive. Defaults to True, matching the paperless-ngx API default.
  • parent: ID of parent tag for hierarchical trees.
  • owner: Numeric user ID to assign as owner.
  • set_permissions: Explicit view/change permission sets. Pass None to create with empty permissions.
Returns:

The newly created ~easypaperless.models.tags.Tag.

async def update( self, id: int, *, name: str | easypaperless.Unset = UNSET, color: str | easypaperless.Unset = UNSET, is_inbox_tag: bool | easypaperless.Unset = UNSET, match: str | easypaperless.Unset = UNSET, matching_algorithm: easypaperless.MatchingAlgorithm | easypaperless.Unset = UNSET, is_insensitive: bool | easypaperless.Unset = UNSET, parent: int | None | easypaperless.Unset = UNSET, owner: int | None | easypaperless.Unset = UNSET, set_permissions: easypaperless.SetPermissions | None | easypaperless.Unset = UNSET) -> easypaperless.Tag:
144    async def update(
145        self,
146        id: int,
147        *,
148        name: str | Unset = UNSET,
149        color: str | Unset = UNSET,
150        is_inbox_tag: bool | Unset = UNSET,
151        match: str | Unset = UNSET,
152        matching_algorithm: MatchingAlgorithm | Unset = UNSET,
153        is_insensitive: bool | Unset = UNSET,
154        parent: int | None | Unset = UNSET,
155        owner: int | None | Unset = UNSET,
156        set_permissions: SetPermissions | None | Unset = UNSET,
157    ) -> Tag:
158        """Partially update a tag (PATCH semantics).
159
160        Args:
161            id: Numeric ID of the tag to update.
162            name: Tag name.
163            color: Background colour as a CSS hex string.
164            is_inbox_tag: When ``True``, newly ingested documents get this tag.
165            match: Auto-matching pattern.
166            matching_algorithm: Controls how ``match`` is applied.
167                E.g. ``matching_algorithm=MatchingAlgorithm.REGEX`` for
168                regular-expression matching.
169            is_insensitive: When ``True``, ``match`` is case-insensitive.
170            parent: ID of parent tag.
171                Pass ``None`` to clear (make root tag).
172                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
173            owner: Numeric user ID to assign as owner.
174                Pass ``None`` to clear the owner.
175                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
176            set_permissions: Explicit view/change permission sets.
177                Pass ``None`` to clear all permissions (overwrite with empty).
178                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
179
180        Returns:
181            The updated :class:`~easypaperless.models.tags.Tag`.
182        """
183        logger.info("Updating tag id=%d", id)
184        return cast(
185            Tag,
186            await self._core._update_resource(
187                "tags",
188                id,
189                Tag,
190                name=name,
191                color=color,
192                is_inbox_tag=is_inbox_tag,
193                match=match,
194                matching_algorithm=matching_algorithm,
195                is_insensitive=is_insensitive,
196                parent=parent,
197                owner=owner,
198                set_permissions=set_permissions,
199            ),
200        )

Partially update a tag (PATCH semantics).

Arguments:
  • id: Numeric ID of the tag to update.
  • name: Tag name.
  • color: Background colour as a CSS hex string.
  • is_inbox_tag: When True, newly ingested documents get this tag.
  • match: Auto-matching pattern.
  • matching_algorithm: Controls how match is applied. E.g. matching_algorithm=MatchingAlgorithm.REGEX for regular-expression matching.
  • is_insensitive: When True, match is case-insensitive.
  • parent: ID of parent tag. Pass None to clear (make root tag). Omit (or pass ~easypaperless.UNSET) to leave unchanged.
  • owner: Numeric user ID to assign as owner. Pass None to clear the owner. Omit (or pass ~easypaperless.UNSET) to leave unchanged.
  • set_permissions: Explicit view/change permission sets. Pass None to clear all permissions (overwrite with empty). Omit (or pass ~easypaperless.UNSET) to leave unchanged.
Returns:

The updated ~easypaperless.models.tags.Tag.

async def delete(self, id: int) -> None:
202    async def delete(self, id: int) -> None:
203        """Delete a tag.
204
205        Args:
206            id: Numeric ID of the tag to delete.
207
208        Raises:
209            ~easypaperless.exceptions.NotFoundError: If no tag exists with
210                that ID.
211        """
212        logger.info("Deleting tag id=%d", id)
213        await self._core._delete_resource("tags", id)

Delete a tag.

Arguments:
  • id: Numeric ID of the tag to delete.
Raises:
async def bulk_delete(self, ids: List[int]) -> None:
215    async def bulk_delete(self, ids: List[int]) -> None:
216        """Permanently delete multiple tags in a single request.
217
218        Args:
219            ids: List of tag IDs to delete.
220        """
221        logger.info("Bulk deleting %d tags", len(ids))
222        await self._core._bulk_edit_objects("tags", ids, "delete")

Permanently delete multiple tags in a single request.

Arguments:
  • ids: List of tag IDs to delete.
async def bulk_set_permissions( self, ids: List[int], *, set_permissions: easypaperless.SetPermissions | easypaperless.Unset = UNSET, owner: int | None | easypaperless.Unset = UNSET, merge: bool = False) -> None:
224    async def bulk_set_permissions(
225        self,
226        ids: List[int],
227        *,
228        set_permissions: SetPermissions | Unset = UNSET,
229        owner: int | None | Unset = UNSET,
230        merge: bool = False,
231    ) -> None:
232        """Set permissions and/or owner on multiple tags.
233
234        Args:
235            ids: List of tag IDs to modify.
236            set_permissions: Explicit view/change permission sets.
237                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
238            owner: Numeric user ID to assign as owner.
239                Pass ``None`` to clear the owner.
240                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
241            merge: When ``True``, new permissions are merged with existing ones.
242        """
243        logger.info("Bulk setting permissions on %d tags", len(ids))
244        params: dict[str, Any] = {"merge": merge}
245        if not isinstance(set_permissions, Unset):
246            params["permissions"] = set_permissions.model_dump()
247        if not isinstance(owner, Unset):
248            params["owner"] = owner
249        await self._core._bulk_edit_objects("tags", ids, "set_permissions", **params)

Set permissions and/or owner on multiple tags.

Arguments:
  • ids: List of tag IDs to modify.
  • set_permissions: Explicit view/change permission sets. Omit (or pass ~easypaperless.UNSET) to leave unchanged.
  • owner: Numeric user ID to assign as owner. Pass None to clear the owner. Omit (or pass ~easypaperless.UNSET) to leave unchanged.
  • merge: When True, new permissions are merged with existing ones.
class SyncCorrespondentsResource:
 18class SyncCorrespondentsResource:
 19    """Sync accessor for correspondents: ``client.correspondents``."""
 20
 21    def __init__(self, async_correspondents: CorrespondentsResource, run: Any) -> None:
 22        self._async_correspondents = async_correspondents
 23        self._run = run
 24
 25    def list(
 26        self,
 27        *,
 28        ids: List[int] | None = None,
 29        name_contains: str | None = None,
 30        name_exact: str | None = None,
 31        page: int | None = None,
 32        page_size: int | None = None,
 33        ordering: str | None = None,
 34        descending: bool = False,
 35    ) -> PagedResult[Correspondent]:
 36        """Return correspondents defined in paperless-ngx.
 37
 38        When ``page`` is ``None`` (the default), all pages are fetched
 39        automatically and ``next`` / ``previous`` in the result are always
 40        ``None``.  When ``page`` is set, only that page is fetched and
 41        ``next`` / ``previous`` reflect the raw API values.
 42
 43        Args:
 44            ids: Return only correspondents whose ID is in this list.
 45            name_contains: Case-insensitive substring filter on name.
 46            name_exact: Case-insensitive exact match on name.
 47            page: Return only this specific page (1-based).
 48            page_size: Number of results per page.
 49            ordering: Field to sort by.
 50            descending: When ``True``, reverses the sort direction.
 51
 52        Returns:
 53            :class:`~easypaperless.models.paged_result.PagedResult` of
 54            :class:`~easypaperless.models.correspondents.Correspondent` objects.
 55        """
 56        return cast(
 57            PagedResult[Correspondent],
 58            self._run(
 59                self._async_correspondents.list(
 60                    ids=ids,
 61                    name_contains=name_contains,
 62                    name_exact=name_exact,
 63                    page=page,
 64                    page_size=page_size,
 65                    ordering=ordering,
 66                    descending=descending,
 67                )
 68            ),
 69        )
 70
 71    def get(self, id: int) -> Correspondent:
 72        """Fetch a single correspondent by its ID.
 73
 74        Args:
 75            id: Numeric correspondent ID.
 76
 77        Returns:
 78            The :class:`~easypaperless.models.correspondents.Correspondent` with the given ID.
 79
 80        Raises:
 81            ~easypaperless.exceptions.NotFoundError: If no correspondent exists with that ID.
 82        """
 83        return cast(Correspondent, self._run(self._async_correspondents.get(id)))
 84
 85    def create(
 86        self,
 87        *,
 88        name: str,
 89        match: str | Unset = UNSET,
 90        matching_algorithm: MatchingAlgorithm | Unset = UNSET,
 91        is_insensitive: bool = True,
 92        owner: int | None | Unset = UNSET,
 93        set_permissions: SetPermissions | None | Unset = UNSET,
 94    ) -> Correspondent:
 95        """Create a new correspondent.
 96
 97        Args:
 98            name: Correspondent name. Must be unique.
 99            match: Auto-matching pattern.
100            matching_algorithm: Controls how ``match`` is applied.
101                E.g. ``matching_algorithm=MatchingAlgorithm.REGEX`` for
102                regular-expression matching.
103            is_insensitive: When ``True``, ``match`` is case-insensitive.
104                Defaults to ``True``, matching the paperless-ngx API default.
105            owner: Numeric user ID to assign as owner.
106            set_permissions: Explicit view/change permission sets.
107                Pass ``None`` to create with empty permissions.
108
109        Returns:
110            The newly created :class:`~easypaperless.models.correspondents.Correspondent`.
111        """
112        return cast(
113            Correspondent,
114            self._run(
115                self._async_correspondents.create(
116                    name=name,
117                    match=match,
118                    matching_algorithm=matching_algorithm,
119                    is_insensitive=is_insensitive,
120                    owner=owner,
121                    set_permissions=set_permissions,
122                )
123            ),
124        )
125
126    def update(
127        self,
128        id: int,
129        *,
130        name: str | Unset = UNSET,
131        match: str | Unset = UNSET,
132        matching_algorithm: MatchingAlgorithm | Unset = UNSET,
133        is_insensitive: bool | Unset = UNSET,
134        owner: int | None | Unset = UNSET,
135        set_permissions: SetPermissions | None | Unset = UNSET,
136    ) -> Correspondent:
137        """Partially update a correspondent (PATCH semantics).
138
139        Args:
140            id: Numeric ID of the correspondent to update.
141            name: Correspondent name.
142            match: Auto-matching pattern.
143            matching_algorithm: Controls how ``match`` is applied.
144                E.g. ``matching_algorithm=MatchingAlgorithm.REGEX`` for
145                regular-expression matching.
146            is_insensitive: When ``True``, ``match`` is case-insensitive.
147            owner: Numeric user ID to assign as owner.
148                Pass ``None`` to clear the owner.
149                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
150            set_permissions: Explicit view/change permission sets.
151                Pass ``None`` to clear all permissions (overwrite with empty).
152                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
153
154        Returns:
155            The updated :class:`~easypaperless.models.correspondents.Correspondent`.
156        """
157        return cast(
158            Correspondent,
159            self._run(
160                self._async_correspondents.update(
161                    id,
162                    name=name,
163                    match=match,
164                    matching_algorithm=matching_algorithm,
165                    is_insensitive=is_insensitive,
166                    owner=owner,
167                    set_permissions=set_permissions,
168                )
169            ),
170        )
171
172    def delete(self, id: int) -> None:
173        """Delete a correspondent.
174
175        Args:
176            id: Numeric ID of the correspondent to delete.
177
178        Raises:
179            ~easypaperless.exceptions.NotFoundError: If no correspondent exists with that ID.
180        """
181        self._run(self._async_correspondents.delete(id))
182
183    def bulk_delete(self, ids: List[int]) -> None:
184        """Permanently delete multiple correspondents in a single request.
185
186        Args:
187            ids: List of correspondent IDs to delete.
188        """
189        self._run(self._async_correspondents.bulk_delete(ids))
190
191    def bulk_set_permissions(
192        self,
193        ids: List[int],
194        *,
195        set_permissions: SetPermissions | Unset = UNSET,
196        owner: int | None | Unset = UNSET,
197        merge: bool = False,
198    ) -> None:
199        """Set permissions and/or owner on multiple correspondents.
200
201        Args:
202            ids: List of correspondent IDs to modify.
203            set_permissions: Explicit view/change permission sets.
204                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
205            owner: Numeric user ID to assign as owner.
206                Pass ``None`` to clear the owner.
207                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
208            merge: When ``True``, new permissions are merged with existing ones.
209        """
210        self._run(
211            self._async_correspondents.bulk_set_permissions(
212                ids, set_permissions=set_permissions, owner=owner, merge=merge
213            )
214        )

Sync accessor for correspondents: client.correspondents.

SyncCorrespondentsResource( async_correspondents: CorrespondentsResource, run: Any)
21    def __init__(self, async_correspondents: CorrespondentsResource, run: Any) -> None:
22        self._async_correspondents = async_correspondents
23        self._run = run
def list( self, *, ids: Optional[List[int]] = None, name_contains: str | None = None, name_exact: str | None = None, page: int | None = None, page_size: int | None = None, ordering: str | None = None, descending: bool = False) -> easypaperless.PagedResult[Correspondent]:
25    def list(
26        self,
27        *,
28        ids: List[int] | None = None,
29        name_contains: str | None = None,
30        name_exact: str | None = None,
31        page: int | None = None,
32        page_size: int | None = None,
33        ordering: str | None = None,
34        descending: bool = False,
35    ) -> PagedResult[Correspondent]:
36        """Return correspondents defined in paperless-ngx.
37
38        When ``page`` is ``None`` (the default), all pages are fetched
39        automatically and ``next`` / ``previous`` in the result are always
40        ``None``.  When ``page`` is set, only that page is fetched and
41        ``next`` / ``previous`` reflect the raw API values.
42
43        Args:
44            ids: Return only correspondents whose ID is in this list.
45            name_contains: Case-insensitive substring filter on name.
46            name_exact: Case-insensitive exact match on name.
47            page: Return only this specific page (1-based).
48            page_size: Number of results per page.
49            ordering: Field to sort by.
50            descending: When ``True``, reverses the sort direction.
51
52        Returns:
53            :class:`~easypaperless.models.paged_result.PagedResult` of
54            :class:`~easypaperless.models.correspondents.Correspondent` objects.
55        """
56        return cast(
57            PagedResult[Correspondent],
58            self._run(
59                self._async_correspondents.list(
60                    ids=ids,
61                    name_contains=name_contains,
62                    name_exact=name_exact,
63                    page=page,
64                    page_size=page_size,
65                    ordering=ordering,
66                    descending=descending,
67                )
68            ),
69        )

Return correspondents defined in paperless-ngx.

When page is None (the default), all pages are fetched automatically and next / previous in the result are always None. When page is set, only that page is fetched and next / previous reflect the raw API values.

Arguments:
  • ids: Return only correspondents whose ID is in this list.
  • name_contains: Case-insensitive substring filter on name.
  • name_exact: Case-insensitive exact match on name.
  • page: Return only this specific page (1-based).
  • page_size: Number of results per page.
  • ordering: Field to sort by.
  • descending: When True, reverses the sort direction.
Returns:

~easypaperless.models.paged_result.PagedResult of ~easypaperless.models.correspondents.Correspondent objects.

def get(self, id: int) -> easypaperless.Correspondent:
71    def get(self, id: int) -> Correspondent:
72        """Fetch a single correspondent by its ID.
73
74        Args:
75            id: Numeric correspondent ID.
76
77        Returns:
78            The :class:`~easypaperless.models.correspondents.Correspondent` with the given ID.
79
80        Raises:
81            ~easypaperless.exceptions.NotFoundError: If no correspondent exists with that ID.
82        """
83        return cast(Correspondent, self._run(self._async_correspondents.get(id)))

Fetch a single correspondent by its ID.

Arguments:
  • id: Numeric correspondent ID.
Returns:

The ~easypaperless.models.correspondents.Correspondent with the given ID.

Raises:
def create( self, *, name: str, match: str | easypaperless.Unset = UNSET, matching_algorithm: easypaperless.MatchingAlgorithm | easypaperless.Unset = UNSET, is_insensitive: bool = True, owner: int | None | easypaperless.Unset = UNSET, set_permissions: easypaperless.SetPermissions | None | easypaperless.Unset = UNSET) -> easypaperless.Correspondent:
 85    def create(
 86        self,
 87        *,
 88        name: str,
 89        match: str | Unset = UNSET,
 90        matching_algorithm: MatchingAlgorithm | Unset = UNSET,
 91        is_insensitive: bool = True,
 92        owner: int | None | Unset = UNSET,
 93        set_permissions: SetPermissions | None | Unset = UNSET,
 94    ) -> Correspondent:
 95        """Create a new correspondent.
 96
 97        Args:
 98            name: Correspondent name. Must be unique.
 99            match: Auto-matching pattern.
100            matching_algorithm: Controls how ``match`` is applied.
101                E.g. ``matching_algorithm=MatchingAlgorithm.REGEX`` for
102                regular-expression matching.
103            is_insensitive: When ``True``, ``match`` is case-insensitive.
104                Defaults to ``True``, matching the paperless-ngx API default.
105            owner: Numeric user ID to assign as owner.
106            set_permissions: Explicit view/change permission sets.
107                Pass ``None`` to create with empty permissions.
108
109        Returns:
110            The newly created :class:`~easypaperless.models.correspondents.Correspondent`.
111        """
112        return cast(
113            Correspondent,
114            self._run(
115                self._async_correspondents.create(
116                    name=name,
117                    match=match,
118                    matching_algorithm=matching_algorithm,
119                    is_insensitive=is_insensitive,
120                    owner=owner,
121                    set_permissions=set_permissions,
122                )
123            ),
124        )

Create a new correspondent.

Arguments:
  • name: Correspondent name. Must be unique.
  • match: Auto-matching pattern.
  • matching_algorithm: Controls how match is applied. E.g. matching_algorithm=MatchingAlgorithm.REGEX for regular-expression matching.
  • is_insensitive: When True, match is case-insensitive. Defaults to True, matching the paperless-ngx API default.
  • owner: Numeric user ID to assign as owner.
  • set_permissions: Explicit view/change permission sets. Pass None to create with empty permissions.
Returns:

The newly created ~easypaperless.models.correspondents.Correspondent.

def update( self, id: int, *, name: str | easypaperless.Unset = UNSET, match: str | easypaperless.Unset = UNSET, matching_algorithm: easypaperless.MatchingAlgorithm | easypaperless.Unset = UNSET, is_insensitive: bool | easypaperless.Unset = UNSET, owner: int | None | easypaperless.Unset = UNSET, set_permissions: easypaperless.SetPermissions | None | easypaperless.Unset = UNSET) -> easypaperless.Correspondent:
126    def update(
127        self,
128        id: int,
129        *,
130        name: str | Unset = UNSET,
131        match: str | Unset = UNSET,
132        matching_algorithm: MatchingAlgorithm | Unset = UNSET,
133        is_insensitive: bool | Unset = UNSET,
134        owner: int | None | Unset = UNSET,
135        set_permissions: SetPermissions | None | Unset = UNSET,
136    ) -> Correspondent:
137        """Partially update a correspondent (PATCH semantics).
138
139        Args:
140            id: Numeric ID of the correspondent to update.
141            name: Correspondent name.
142            match: Auto-matching pattern.
143            matching_algorithm: Controls how ``match`` is applied.
144                E.g. ``matching_algorithm=MatchingAlgorithm.REGEX`` for
145                regular-expression matching.
146            is_insensitive: When ``True``, ``match`` is case-insensitive.
147            owner: Numeric user ID to assign as owner.
148                Pass ``None`` to clear the owner.
149                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
150            set_permissions: Explicit view/change permission sets.
151                Pass ``None`` to clear all permissions (overwrite with empty).
152                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
153
154        Returns:
155            The updated :class:`~easypaperless.models.correspondents.Correspondent`.
156        """
157        return cast(
158            Correspondent,
159            self._run(
160                self._async_correspondents.update(
161                    id,
162                    name=name,
163                    match=match,
164                    matching_algorithm=matching_algorithm,
165                    is_insensitive=is_insensitive,
166                    owner=owner,
167                    set_permissions=set_permissions,
168                )
169            ),
170        )

Partially update a correspondent (PATCH semantics).

Arguments:
  • id: Numeric ID of the correspondent to update.
  • name: Correspondent name.
  • match: Auto-matching pattern.
  • matching_algorithm: Controls how match is applied. E.g. matching_algorithm=MatchingAlgorithm.REGEX for regular-expression matching.
  • is_insensitive: When True, match is case-insensitive.
  • owner: Numeric user ID to assign as owner. Pass None to clear the owner. Omit (or pass ~easypaperless.UNSET) to leave unchanged.
  • set_permissions: Explicit view/change permission sets. Pass None to clear all permissions (overwrite with empty). Omit (or pass ~easypaperless.UNSET) to leave unchanged.
Returns:

The updated ~easypaperless.models.correspondents.Correspondent.

def delete(self, id: int) -> None:
172    def delete(self, id: int) -> None:
173        """Delete a correspondent.
174
175        Args:
176            id: Numeric ID of the correspondent to delete.
177
178        Raises:
179            ~easypaperless.exceptions.NotFoundError: If no correspondent exists with that ID.
180        """
181        self._run(self._async_correspondents.delete(id))

Delete a correspondent.

Arguments:
  • id: Numeric ID of the correspondent to delete.
Raises:
def bulk_delete(self, ids: List[int]) -> None:
183    def bulk_delete(self, ids: List[int]) -> None:
184        """Permanently delete multiple correspondents in a single request.
185
186        Args:
187            ids: List of correspondent IDs to delete.
188        """
189        self._run(self._async_correspondents.bulk_delete(ids))

Permanently delete multiple correspondents in a single request.

Arguments:
  • ids: List of correspondent IDs to delete.
def bulk_set_permissions( self, ids: List[int], *, set_permissions: easypaperless.SetPermissions | easypaperless.Unset = UNSET, owner: int | None | easypaperless.Unset = UNSET, merge: bool = False) -> None:
191    def bulk_set_permissions(
192        self,
193        ids: List[int],
194        *,
195        set_permissions: SetPermissions | Unset = UNSET,
196        owner: int | None | Unset = UNSET,
197        merge: bool = False,
198    ) -> None:
199        """Set permissions and/or owner on multiple correspondents.
200
201        Args:
202            ids: List of correspondent IDs to modify.
203            set_permissions: Explicit view/change permission sets.
204                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
205            owner: Numeric user ID to assign as owner.
206                Pass ``None`` to clear the owner.
207                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
208            merge: When ``True``, new permissions are merged with existing ones.
209        """
210        self._run(
211            self._async_correspondents.bulk_set_permissions(
212                ids, set_permissions=set_permissions, owner=owner, merge=merge
213            )
214        )

Set permissions and/or owner on multiple correspondents.

Arguments:
  • ids: List of correspondent IDs to modify.
  • set_permissions: Explicit view/change permission sets. Omit (or pass ~easypaperless.UNSET) to leave unchanged.
  • owner: Numeric user ID to assign as owner. Pass None to clear the owner. Omit (or pass ~easypaperless.UNSET) to leave unchanged.
  • merge: When True, new permissions are merged with existing ones.
class SyncCustomFieldsResource:
 17class SyncCustomFieldsResource:
 18    """Sync accessor for custom fields: ``client.custom_fields``."""
 19
 20    def __init__(self, async_custom_fields: CustomFieldsResource, run: Any) -> None:
 21        self._async_custom_fields = async_custom_fields
 22        self._run = run
 23
 24    def list(
 25        self,
 26        *,
 27        name_contains: str | None = None,
 28        name_exact: str | None = None,
 29        page: int | None = None,
 30        page_size: int | None = None,
 31        ordering: str | None = None,
 32        descending: bool = False,
 33    ) -> PagedResult[CustomField]:
 34        """Return all custom fields defined in paperless-ngx.
 35
 36        When ``page`` is ``None`` (the default), all pages are fetched
 37        automatically and ``next`` / ``previous`` in the result are always
 38        ``None``.  When ``page`` is set, only that page is fetched and
 39        ``next`` / ``previous`` reflect the raw API values.
 40
 41        Args:
 42            name_contains: Case-insensitive substring filter on name.
 43            name_exact: Case-insensitive exact match on name.
 44            page: Return only this specific page (1-based).
 45            page_size: Number of results per page.
 46            ordering: Field to sort by.
 47            descending: When ``True``, reverses the sort direction.
 48
 49        Returns:
 50            :class:`~easypaperless.models.paged_result.PagedResult` of
 51            :class:`~easypaperless.models.custom_fields.CustomField` objects.
 52        """
 53        return cast(
 54            PagedResult[CustomField],
 55            self._run(
 56                self._async_custom_fields.list(
 57                    name_contains=name_contains,
 58                    name_exact=name_exact,
 59                    page=page,
 60                    page_size=page_size,
 61                    ordering=ordering,
 62                    descending=descending,
 63                )
 64            ),
 65        )
 66
 67    def get(self, id: int) -> CustomField:
 68        """Fetch a single custom field by its ID.
 69
 70        Args:
 71            id: Numeric custom-field ID.
 72
 73        Returns:
 74            The :class:`~easypaperless.models.custom_fields.CustomField` with the given ID.
 75
 76        Raises:
 77            ~easypaperless.exceptions.NotFoundError: If no custom field exists with that ID.
 78        """
 79        return cast(CustomField, self._run(self._async_custom_fields.get(id)))
 80
 81    def create(
 82        self,
 83        *,
 84        name: str,
 85        data_type: str,
 86        extra_data: Any | None = None,
 87        owner: int | None | Unset = UNSET,
 88        set_permissions: SetPermissions | None | Unset = UNSET,
 89    ) -> CustomField:
 90        """Create a new custom field.
 91
 92        Args:
 93            name: Field name shown in the UI. Must be unique.
 94            data_type: Value type. One of ``"string"``, ``"boolean"``,
 95                ``"integer"``, ``"float"``, ``"monetary"``, ``"date"``,
 96                ``"url"``, ``"documentlink"``, ``"select"``.
 97            extra_data: Additional configuration for the field type.
 98            owner: Numeric user ID to assign as owner.
 99            set_permissions: Explicit view/change permission sets.
100                Pass ``None`` to create with empty permissions.
101
102        Returns:
103            The newly created :class:`~easypaperless.models.custom_fields.CustomField`.
104        """
105        return cast(
106            CustomField,
107            self._run(
108                self._async_custom_fields.create(
109                    name=name,
110                    data_type=data_type,
111                    extra_data=extra_data,
112                    owner=owner,
113                    set_permissions=set_permissions,
114                )
115            ),
116        )
117
118    def update(
119        self,
120        id: int,
121        *,
122        name: str | Unset = UNSET,
123        data_type: str | Unset = UNSET,
124        extra_data: Any | None | Unset = UNSET,
125        owner: int | None | Unset = UNSET,
126        set_permissions: SetPermissions | None | Unset = UNSET,
127    ) -> CustomField:
128        """Partially update a custom field (PATCH semantics).
129
130        Args:
131            id: Numeric ID of the custom field to update.
132            name: Field name shown in the UI.
133            data_type: Value type (e.g. ``"string"``, ``"boolean"``, ``"integer"``).
134                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
135            extra_data: Additional configuration for the field type.
136            owner: Numeric user ID to assign as owner.
137                Pass ``None`` to clear the owner.
138                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
139            set_permissions: Explicit view/change permission sets.
140                Pass ``None`` to clear all permissions (overwrite with empty).
141                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
142
143        Returns:
144            The updated :class:`~easypaperless.models.custom_fields.CustomField`.
145        """
146        return cast(
147            CustomField,
148            self._run(
149                self._async_custom_fields.update(
150                    id,
151                    name=name,
152                    data_type=data_type,
153                    extra_data=extra_data,
154                    owner=owner,
155                    set_permissions=set_permissions,
156                )
157            ),
158        )
159
160    def delete(self, id: int) -> None:
161        """Delete a custom field.
162
163        Args:
164            id: Numeric ID of the custom field to delete.
165
166        Raises:
167            ~easypaperless.exceptions.NotFoundError: If no custom field exists with that ID.
168        """
169        self._run(self._async_custom_fields.delete(id))

Sync accessor for custom fields: client.custom_fields.

SyncCustomFieldsResource( async_custom_fields: CustomFieldsResource, run: Any)
20    def __init__(self, async_custom_fields: CustomFieldsResource, run: Any) -> None:
21        self._async_custom_fields = async_custom_fields
22        self._run = run
def list( self, *, name_contains: str | None = None, name_exact: str | None = None, page: int | None = None, page_size: int | None = None, ordering: str | None = None, descending: bool = False) -> easypaperless.PagedResult[CustomField]:
24    def list(
25        self,
26        *,
27        name_contains: str | None = None,
28        name_exact: str | None = None,
29        page: int | None = None,
30        page_size: int | None = None,
31        ordering: str | None = None,
32        descending: bool = False,
33    ) -> PagedResult[CustomField]:
34        """Return all custom fields defined in paperless-ngx.
35
36        When ``page`` is ``None`` (the default), all pages are fetched
37        automatically and ``next`` / ``previous`` in the result are always
38        ``None``.  When ``page`` is set, only that page is fetched and
39        ``next`` / ``previous`` reflect the raw API values.
40
41        Args:
42            name_contains: Case-insensitive substring filter on name.
43            name_exact: Case-insensitive exact match on name.
44            page: Return only this specific page (1-based).
45            page_size: Number of results per page.
46            ordering: Field to sort by.
47            descending: When ``True``, reverses the sort direction.
48
49        Returns:
50            :class:`~easypaperless.models.paged_result.PagedResult` of
51            :class:`~easypaperless.models.custom_fields.CustomField` objects.
52        """
53        return cast(
54            PagedResult[CustomField],
55            self._run(
56                self._async_custom_fields.list(
57                    name_contains=name_contains,
58                    name_exact=name_exact,
59                    page=page,
60                    page_size=page_size,
61                    ordering=ordering,
62                    descending=descending,
63                )
64            ),
65        )

Return all custom fields defined in paperless-ngx.

When page is None (the default), all pages are fetched automatically and next / previous in the result are always None. When page is set, only that page is fetched and next / previous reflect the raw API values.

Arguments:
  • name_contains: Case-insensitive substring filter on name.
  • name_exact: Case-insensitive exact match on name.
  • page: Return only this specific page (1-based).
  • page_size: Number of results per page.
  • ordering: Field to sort by.
  • descending: When True, reverses the sort direction.
Returns:

~easypaperless.models.paged_result.PagedResult of ~easypaperless.models.custom_fields.CustomField objects.

def get(self, id: int) -> easypaperless.CustomField:
67    def get(self, id: int) -> CustomField:
68        """Fetch a single custom field by its ID.
69
70        Args:
71            id: Numeric custom-field ID.
72
73        Returns:
74            The :class:`~easypaperless.models.custom_fields.CustomField` with the given ID.
75
76        Raises:
77            ~easypaperless.exceptions.NotFoundError: If no custom field exists with that ID.
78        """
79        return cast(CustomField, self._run(self._async_custom_fields.get(id)))

Fetch a single custom field by its ID.

Arguments:
  • id: Numeric custom-field ID.
Returns:

The ~easypaperless.models.custom_fields.CustomField with the given ID.

Raises:
def create( self, *, name: str, data_type: str, extra_data: typing.Any | None = None, owner: int | None | easypaperless.Unset = UNSET, set_permissions: easypaperless.SetPermissions | None | easypaperless.Unset = UNSET) -> easypaperless.CustomField:
 81    def create(
 82        self,
 83        *,
 84        name: str,
 85        data_type: str,
 86        extra_data: Any | None = None,
 87        owner: int | None | Unset = UNSET,
 88        set_permissions: SetPermissions | None | Unset = UNSET,
 89    ) -> CustomField:
 90        """Create a new custom field.
 91
 92        Args:
 93            name: Field name shown in the UI. Must be unique.
 94            data_type: Value type. One of ``"string"``, ``"boolean"``,
 95                ``"integer"``, ``"float"``, ``"monetary"``, ``"date"``,
 96                ``"url"``, ``"documentlink"``, ``"select"``.
 97            extra_data: Additional configuration for the field type.
 98            owner: Numeric user ID to assign as owner.
 99            set_permissions: Explicit view/change permission sets.
100                Pass ``None`` to create with empty permissions.
101
102        Returns:
103            The newly created :class:`~easypaperless.models.custom_fields.CustomField`.
104        """
105        return cast(
106            CustomField,
107            self._run(
108                self._async_custom_fields.create(
109                    name=name,
110                    data_type=data_type,
111                    extra_data=extra_data,
112                    owner=owner,
113                    set_permissions=set_permissions,
114                )
115            ),
116        )

Create a new custom field.

Arguments:
  • name: Field name shown in the UI. Must be unique.
  • data_type: Value type. One of "string", "boolean", "integer", "float", "monetary", "date", "url", "documentlink", "select".
  • extra_data: Additional configuration for the field type.
  • owner: Numeric user ID to assign as owner.
  • set_permissions: Explicit view/change permission sets. Pass None to create with empty permissions.
Returns:

The newly created ~easypaperless.models.custom_fields.CustomField.

def update( self, id: int, *, name: str | easypaperless.Unset = UNSET, data_type: str | easypaperless.Unset = UNSET, extra_data: typing.Any | None | easypaperless.Unset = UNSET, owner: int | None | easypaperless.Unset = UNSET, set_permissions: easypaperless.SetPermissions | None | easypaperless.Unset = UNSET) -> easypaperless.CustomField:
118    def update(
119        self,
120        id: int,
121        *,
122        name: str | Unset = UNSET,
123        data_type: str | Unset = UNSET,
124        extra_data: Any | None | Unset = UNSET,
125        owner: int | None | Unset = UNSET,
126        set_permissions: SetPermissions | None | Unset = UNSET,
127    ) -> CustomField:
128        """Partially update a custom field (PATCH semantics).
129
130        Args:
131            id: Numeric ID of the custom field to update.
132            name: Field name shown in the UI.
133            data_type: Value type (e.g. ``"string"``, ``"boolean"``, ``"integer"``).
134                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
135            extra_data: Additional configuration for the field type.
136            owner: Numeric user ID to assign as owner.
137                Pass ``None`` to clear the owner.
138                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
139            set_permissions: Explicit view/change permission sets.
140                Pass ``None`` to clear all permissions (overwrite with empty).
141                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
142
143        Returns:
144            The updated :class:`~easypaperless.models.custom_fields.CustomField`.
145        """
146        return cast(
147            CustomField,
148            self._run(
149                self._async_custom_fields.update(
150                    id,
151                    name=name,
152                    data_type=data_type,
153                    extra_data=extra_data,
154                    owner=owner,
155                    set_permissions=set_permissions,
156                )
157            ),
158        )

Partially update a custom field (PATCH semantics).

Arguments:
  • id: Numeric ID of the custom field to update.
  • name: Field name shown in the UI.
  • data_type: Value type (e.g. "string", "boolean", "integer"). Omit (or pass ~easypaperless.UNSET) to leave unchanged.
  • extra_data: Additional configuration for the field type.
  • owner: Numeric user ID to assign as owner. Pass None to clear the owner. Omit (or pass ~easypaperless.UNSET) to leave unchanged.
  • set_permissions: Explicit view/change permission sets. Pass None to clear all permissions (overwrite with empty). Omit (or pass ~easypaperless.UNSET) to leave unchanged.
Returns:

The updated ~easypaperless.models.custom_fields.CustomField.

def delete(self, id: int) -> None:
160    def delete(self, id: int) -> None:
161        """Delete a custom field.
162
163        Args:
164            id: Numeric ID of the custom field to delete.
165
166        Raises:
167            ~easypaperless.exceptions.NotFoundError: If no custom field exists with that ID.
168        """
169        self._run(self._async_custom_fields.delete(id))

Delete a custom field.

Arguments:
  • id: Numeric ID of the custom field to delete.
Raises:
class SyncDocumentTypesResource:
 18class SyncDocumentTypesResource:
 19    """Sync accessor for document types: ``client.document_types``."""
 20
 21    def __init__(self, async_document_types: DocumentTypesResource, run: Any) -> None:
 22        self._async_document_types = async_document_types
 23        self._run = run
 24
 25    def list(
 26        self,
 27        *,
 28        ids: List[int] | None = None,
 29        name_contains: str | None = None,
 30        name_exact: str | None = None,
 31        page: int | None = None,
 32        page_size: int | None = None,
 33        ordering: str | None = None,
 34        descending: bool = False,
 35    ) -> PagedResult[DocumentType]:
 36        """Return document types defined in paperless-ngx.
 37
 38        When ``page`` is ``None`` (the default), all pages are fetched
 39        automatically and ``next`` / ``previous`` in the result are always
 40        ``None``.  When ``page`` is set, only that page is fetched and
 41        ``next`` / ``previous`` reflect the raw API values.
 42
 43        Args:
 44            ids: Return only document types whose ID is in this list.
 45            name_contains: Case-insensitive substring filter on name.
 46            name_exact: Case-insensitive exact match on name.
 47            page: Return only this specific page (1-based).
 48            page_size: Number of results per page.
 49            ordering: Field to sort by.
 50            descending: When ``True``, reverses the sort direction.
 51
 52        Returns:
 53            :class:`~easypaperless.models.paged_result.PagedResult` of
 54            :class:`~easypaperless.models.document_types.DocumentType` objects.
 55        """
 56        return cast(
 57            PagedResult[DocumentType],
 58            self._run(
 59                self._async_document_types.list(
 60                    ids=ids,
 61                    name_contains=name_contains,
 62                    name_exact=name_exact,
 63                    page=page,
 64                    page_size=page_size,
 65                    ordering=ordering,
 66                    descending=descending,
 67                )
 68            ),
 69        )
 70
 71    def get(self, id: int) -> DocumentType:
 72        """Fetch a single document type by its ID.
 73
 74        Args:
 75            id: Numeric document-type ID.
 76
 77        Returns:
 78            The :class:`~easypaperless.models.document_types.DocumentType` with the given ID.
 79
 80        Raises:
 81            ~easypaperless.exceptions.NotFoundError: If no document type exists with that ID.
 82        """
 83        return cast(DocumentType, self._run(self._async_document_types.get(id)))
 84
 85    def create(
 86        self,
 87        *,
 88        name: str,
 89        match: str | Unset = UNSET,
 90        matching_algorithm: MatchingAlgorithm | Unset = UNSET,
 91        is_insensitive: bool = True,
 92        owner: int | None | Unset = UNSET,
 93        set_permissions: SetPermissions | None | Unset = UNSET,
 94    ) -> DocumentType:
 95        """Create a new document type.
 96
 97        Args:
 98            name: Document-type name. Must be unique.
 99            match: Auto-matching pattern.
100            matching_algorithm: Controls how ``match`` is applied.
101                E.g. ``matching_algorithm=MatchingAlgorithm.REGEX`` for
102                regular-expression matching.
103            is_insensitive: When ``True``, ``match`` is case-insensitive.
104                Defaults to ``True``, matching the paperless-ngx API default.
105            owner: Numeric user ID to assign as owner.
106            set_permissions: Explicit view/change permission sets.
107                Pass ``None`` to create with empty permissions.
108
109        Returns:
110            The newly created :class:`~easypaperless.models.document_types.DocumentType`.
111        """
112        return cast(
113            DocumentType,
114            self._run(
115                self._async_document_types.create(
116                    name=name,
117                    match=match,
118                    matching_algorithm=matching_algorithm,
119                    is_insensitive=is_insensitive,
120                    owner=owner,
121                    set_permissions=set_permissions,
122                )
123            ),
124        )
125
126    def update(
127        self,
128        id: int,
129        *,
130        name: str | Unset = UNSET,
131        match: str | Unset = UNSET,
132        matching_algorithm: MatchingAlgorithm | Unset = UNSET,
133        is_insensitive: bool | Unset = UNSET,
134        owner: int | None | Unset = UNSET,
135        set_permissions: SetPermissions | None | Unset = UNSET,
136    ) -> DocumentType:
137        """Partially update a document type (PATCH semantics).
138
139        Args:
140            id: Numeric ID of the document type to update.
141            name: Document-type name.
142            match: Auto-matching pattern.
143            matching_algorithm: Controls how ``match`` is applied.
144                E.g. ``matching_algorithm=MatchingAlgorithm.REGEX`` for
145                regular-expression matching.
146            is_insensitive: When ``True``, ``match`` is case-insensitive.
147            owner: Numeric user ID to assign as owner.
148                Pass ``None`` to clear the owner.
149                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
150            set_permissions: Explicit view/change permission sets.
151                Pass ``None`` to clear all permissions (overwrite with empty).
152                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
153
154        Returns:
155            The updated :class:`~easypaperless.models.document_types.DocumentType`.
156        """
157        return cast(
158            DocumentType,
159            self._run(
160                self._async_document_types.update(
161                    id,
162                    name=name,
163                    match=match,
164                    matching_algorithm=matching_algorithm,
165                    is_insensitive=is_insensitive,
166                    owner=owner,
167                    set_permissions=set_permissions,
168                )
169            ),
170        )
171
172    def delete(self, id: int) -> None:
173        """Delete a document type.
174
175        Args:
176            id: Numeric ID of the document type to delete.
177
178        Raises:
179            ~easypaperless.exceptions.NotFoundError: If no document type exists with that ID.
180        """
181        self._run(self._async_document_types.delete(id))
182
183    def bulk_delete(self, ids: List[int]) -> None:
184        """Permanently delete multiple document types in a single request.
185
186        Args:
187            ids: List of document type IDs to delete.
188        """
189        self._run(self._async_document_types.bulk_delete(ids))
190
191    def bulk_set_permissions(
192        self,
193        ids: List[int],
194        *,
195        set_permissions: SetPermissions | Unset = UNSET,
196        owner: int | None | Unset = UNSET,
197        merge: bool = False,
198    ) -> None:
199        """Set permissions and/or owner on multiple document types.
200
201        Args:
202            ids: List of document type IDs to modify.
203            set_permissions: Explicit view/change permission sets.
204                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
205            owner: Numeric user ID to assign as owner.
206                Pass ``None`` to clear the owner.
207                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
208            merge: When ``True``, new permissions are merged with existing ones.
209        """
210        self._run(
211            self._async_document_types.bulk_set_permissions(
212                ids, set_permissions=set_permissions, owner=owner, merge=merge
213            )
214        )

Sync accessor for document types: client.document_types.

SyncDocumentTypesResource( async_document_types: DocumentTypesResource, run: Any)
21    def __init__(self, async_document_types: DocumentTypesResource, run: Any) -> None:
22        self._async_document_types = async_document_types
23        self._run = run
def list( self, *, ids: Optional[List[int]] = None, name_contains: str | None = None, name_exact: str | None = None, page: int | None = None, page_size: int | None = None, ordering: str | None = None, descending: bool = False) -> easypaperless.PagedResult[DocumentType]:
25    def list(
26        self,
27        *,
28        ids: List[int] | None = None,
29        name_contains: str | None = None,
30        name_exact: str | None = None,
31        page: int | None = None,
32        page_size: int | None = None,
33        ordering: str | None = None,
34        descending: bool = False,
35    ) -> PagedResult[DocumentType]:
36        """Return document types defined in paperless-ngx.
37
38        When ``page`` is ``None`` (the default), all pages are fetched
39        automatically and ``next`` / ``previous`` in the result are always
40        ``None``.  When ``page`` is set, only that page is fetched and
41        ``next`` / ``previous`` reflect the raw API values.
42
43        Args:
44            ids: Return only document types whose ID is in this list.
45            name_contains: Case-insensitive substring filter on name.
46            name_exact: Case-insensitive exact match on name.
47            page: Return only this specific page (1-based).
48            page_size: Number of results per page.
49            ordering: Field to sort by.
50            descending: When ``True``, reverses the sort direction.
51
52        Returns:
53            :class:`~easypaperless.models.paged_result.PagedResult` of
54            :class:`~easypaperless.models.document_types.DocumentType` objects.
55        """
56        return cast(
57            PagedResult[DocumentType],
58            self._run(
59                self._async_document_types.list(
60                    ids=ids,
61                    name_contains=name_contains,
62                    name_exact=name_exact,
63                    page=page,
64                    page_size=page_size,
65                    ordering=ordering,
66                    descending=descending,
67                )
68            ),
69        )

Return document types defined in paperless-ngx.

When page is None (the default), all pages are fetched automatically and next / previous in the result are always None. When page is set, only that page is fetched and next / previous reflect the raw API values.

Arguments:
  • ids: Return only document types whose ID is in this list.
  • name_contains: Case-insensitive substring filter on name.
  • name_exact: Case-insensitive exact match on name.
  • page: Return only this specific page (1-based).
  • page_size: Number of results per page.
  • ordering: Field to sort by.
  • descending: When True, reverses the sort direction.
Returns:

~easypaperless.models.paged_result.PagedResult of ~easypaperless.models.document_types.DocumentType objects.

def get(self, id: int) -> easypaperless.DocumentType:
71    def get(self, id: int) -> DocumentType:
72        """Fetch a single document type by its ID.
73
74        Args:
75            id: Numeric document-type ID.
76
77        Returns:
78            The :class:`~easypaperless.models.document_types.DocumentType` with the given ID.
79
80        Raises:
81            ~easypaperless.exceptions.NotFoundError: If no document type exists with that ID.
82        """
83        return cast(DocumentType, self._run(self._async_document_types.get(id)))

Fetch a single document type by its ID.

Arguments:
  • id: Numeric document-type ID.
Returns:

The ~easypaperless.models.document_types.DocumentType with the given ID.

Raises:
def create( self, *, name: str, match: str | easypaperless.Unset = UNSET, matching_algorithm: easypaperless.MatchingAlgorithm | easypaperless.Unset = UNSET, is_insensitive: bool = True, owner: int | None | easypaperless.Unset = UNSET, set_permissions: easypaperless.SetPermissions | None | easypaperless.Unset = UNSET) -> easypaperless.DocumentType:
 85    def create(
 86        self,
 87        *,
 88        name: str,
 89        match: str | Unset = UNSET,
 90        matching_algorithm: MatchingAlgorithm | Unset = UNSET,
 91        is_insensitive: bool = True,
 92        owner: int | None | Unset = UNSET,
 93        set_permissions: SetPermissions | None | Unset = UNSET,
 94    ) -> DocumentType:
 95        """Create a new document type.
 96
 97        Args:
 98            name: Document-type name. Must be unique.
 99            match: Auto-matching pattern.
100            matching_algorithm: Controls how ``match`` is applied.
101                E.g. ``matching_algorithm=MatchingAlgorithm.REGEX`` for
102                regular-expression matching.
103            is_insensitive: When ``True``, ``match`` is case-insensitive.
104                Defaults to ``True``, matching the paperless-ngx API default.
105            owner: Numeric user ID to assign as owner.
106            set_permissions: Explicit view/change permission sets.
107                Pass ``None`` to create with empty permissions.
108
109        Returns:
110            The newly created :class:`~easypaperless.models.document_types.DocumentType`.
111        """
112        return cast(
113            DocumentType,
114            self._run(
115                self._async_document_types.create(
116                    name=name,
117                    match=match,
118                    matching_algorithm=matching_algorithm,
119                    is_insensitive=is_insensitive,
120                    owner=owner,
121                    set_permissions=set_permissions,
122                )
123            ),
124        )

Create a new document type.

Arguments:
  • name: Document-type name. Must be unique.
  • match: Auto-matching pattern.
  • matching_algorithm: Controls how match is applied. E.g. matching_algorithm=MatchingAlgorithm.REGEX for regular-expression matching.
  • is_insensitive: When True, match is case-insensitive. Defaults to True, matching the paperless-ngx API default.
  • owner: Numeric user ID to assign as owner.
  • set_permissions: Explicit view/change permission sets. Pass None to create with empty permissions.
Returns:

The newly created ~easypaperless.models.document_types.DocumentType.

def update( self, id: int, *, name: str | easypaperless.Unset = UNSET, match: str | easypaperless.Unset = UNSET, matching_algorithm: easypaperless.MatchingAlgorithm | easypaperless.Unset = UNSET, is_insensitive: bool | easypaperless.Unset = UNSET, owner: int | None | easypaperless.Unset = UNSET, set_permissions: easypaperless.SetPermissions | None | easypaperless.Unset = UNSET) -> easypaperless.DocumentType:
126    def update(
127        self,
128        id: int,
129        *,
130        name: str | Unset = UNSET,
131        match: str | Unset = UNSET,
132        matching_algorithm: MatchingAlgorithm | Unset = UNSET,
133        is_insensitive: bool | Unset = UNSET,
134        owner: int | None | Unset = UNSET,
135        set_permissions: SetPermissions | None | Unset = UNSET,
136    ) -> DocumentType:
137        """Partially update a document type (PATCH semantics).
138
139        Args:
140            id: Numeric ID of the document type to update.
141            name: Document-type name.
142            match: Auto-matching pattern.
143            matching_algorithm: Controls how ``match`` is applied.
144                E.g. ``matching_algorithm=MatchingAlgorithm.REGEX`` for
145                regular-expression matching.
146            is_insensitive: When ``True``, ``match`` is case-insensitive.
147            owner: Numeric user ID to assign as owner.
148                Pass ``None`` to clear the owner.
149                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
150            set_permissions: Explicit view/change permission sets.
151                Pass ``None`` to clear all permissions (overwrite with empty).
152                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
153
154        Returns:
155            The updated :class:`~easypaperless.models.document_types.DocumentType`.
156        """
157        return cast(
158            DocumentType,
159            self._run(
160                self._async_document_types.update(
161                    id,
162                    name=name,
163                    match=match,
164                    matching_algorithm=matching_algorithm,
165                    is_insensitive=is_insensitive,
166                    owner=owner,
167                    set_permissions=set_permissions,
168                )
169            ),
170        )

Partially update a document type (PATCH semantics).

Arguments:
  • id: Numeric ID of the document type to update.
  • name: Document-type name.
  • match: Auto-matching pattern.
  • matching_algorithm: Controls how match is applied. E.g. matching_algorithm=MatchingAlgorithm.REGEX for regular-expression matching.
  • is_insensitive: When True, match is case-insensitive.
  • owner: Numeric user ID to assign as owner. Pass None to clear the owner. Omit (or pass ~easypaperless.UNSET) to leave unchanged.
  • set_permissions: Explicit view/change permission sets. Pass None to clear all permissions (overwrite with empty). Omit (or pass ~easypaperless.UNSET) to leave unchanged.
Returns:

The updated ~easypaperless.models.document_types.DocumentType.

def delete(self, id: int) -> None:
172    def delete(self, id: int) -> None:
173        """Delete a document type.
174
175        Args:
176            id: Numeric ID of the document type to delete.
177
178        Raises:
179            ~easypaperless.exceptions.NotFoundError: If no document type exists with that ID.
180        """
181        self._run(self._async_document_types.delete(id))

Delete a document type.

Arguments:
  • id: Numeric ID of the document type to delete.
Raises:
def bulk_delete(self, ids: List[int]) -> None:
183    def bulk_delete(self, ids: List[int]) -> None:
184        """Permanently delete multiple document types in a single request.
185
186        Args:
187            ids: List of document type IDs to delete.
188        """
189        self._run(self._async_document_types.bulk_delete(ids))

Permanently delete multiple document types in a single request.

Arguments:
  • ids: List of document type IDs to delete.
def bulk_set_permissions( self, ids: List[int], *, set_permissions: easypaperless.SetPermissions | easypaperless.Unset = UNSET, owner: int | None | easypaperless.Unset = UNSET, merge: bool = False) -> None:
191    def bulk_set_permissions(
192        self,
193        ids: List[int],
194        *,
195        set_permissions: SetPermissions | Unset = UNSET,
196        owner: int | None | Unset = UNSET,
197        merge: bool = False,
198    ) -> None:
199        """Set permissions and/or owner on multiple document types.
200
201        Args:
202            ids: List of document type IDs to modify.
203            set_permissions: Explicit view/change permission sets.
204                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
205            owner: Numeric user ID to assign as owner.
206                Pass ``None`` to clear the owner.
207                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
208            merge: When ``True``, new permissions are merged with existing ones.
209        """
210        self._run(
211            self._async_document_types.bulk_set_permissions(
212                ids, set_permissions=set_permissions, owner=owner, merge=merge
213            )
214        )

Set permissions and/or owner on multiple document types.

Arguments:
  • ids: List of document type IDs to modify.
  • set_permissions: Explicit view/change permission sets. Omit (or pass ~easypaperless.UNSET) to leave unchanged.
  • owner: Numeric user ID to assign as owner. Pass None to clear the owner. Omit (or pass ~easypaperless.UNSET) to leave unchanged.
  • merge: When True, new permissions are merged with existing ones.
class SyncDocumentsResource:
 91class SyncDocumentsResource:
 92    """Sync accessor for documents: ``client.documents``."""
 93
 94    def __init__(self, async_documents: DocumentsResource, run: Any) -> None:
 95        self._async_documents = async_documents
 96        self._run = run
 97        self.notes = SyncNotesResource(async_documents.notes, run)
 98
 99    def get(self, id: int, *, include_metadata: bool = False) -> Document:
100        """Fetch a single document by its ID.
101
102        Args:
103            id: Numeric paperless-ngx document ID.
104            include_metadata: When ``True``, the extended file-level metadata
105                is fetched concurrently and attached to the document.
106                Default: ``False``.
107
108        Returns:
109            The :class:`~easypaperless.models.documents.Document` with the
110            given ID.
111
112        Raises:
113            ~easypaperless.exceptions.NotFoundError: If no document exists
114                with that ID.
115        """
116        return cast(
117            Document, self._run(self._async_documents.get(id, include_metadata=include_metadata))
118        )
119
120    def get_metadata(self, id: int) -> DocumentMetadata:
121        """Fetch the extended file-level metadata for a document.
122
123        Args:
124            id: Numeric paperless-ngx document ID.
125
126        Returns:
127            A :class:`~easypaperless.models.documents.DocumentMetadata` instance.
128
129        Raises:
130            ~easypaperless.exceptions.NotFoundError: If no document exists
131                with that ID.
132        """
133        return cast(DocumentMetadata, self._run(self._async_documents.get_metadata(id)))
134
135    def list(
136        self,
137        *,
138        search: str | None = None,
139        search_mode: str = "title_or_content",
140        ids: List[int] | None = None,
141        tags: List[int | str] | None = None,
142        any_tags: List[int | str] | None = None,
143        exclude_tags: List[int | str] | None = None,
144        correspondent: int | str | None | Unset = UNSET,
145        any_correspondent: List[int | str] | None = None,
146        exclude_correspondents: List[int | str] | None = None,
147        document_type: int | str | None | Unset = UNSET,
148        document_type_name_contains: str | None = None,
149        document_type_name_exact: str | None = None,
150        any_document_type: List[int | str] | None = None,
151        exclude_document_types: List[int | str] | None = None,
152        storage_path: int | str | None | Unset = UNSET,
153        any_storage_paths: List[int | str] | None = None,
154        exclude_storage_paths: List[int | str] | None = None,
155        owner: int | None | Unset = UNSET,
156        exclude_owners: List[int] | None = None,
157        custom_fields: List[int | str] | None = None,
158        any_custom_fields: List[int | str] | None = None,
159        exclude_custom_fields: List[int | str] | None = None,
160        custom_field_query: List[Any] | None = None,
161        archive_serial_number: int | None | Unset = UNSET,
162        archive_serial_number_from: int | None = None,
163        archive_serial_number_till: int | None = None,
164        created_after: date | str | None = None,
165        created_before: date | str | None = None,
166        added_after: date | datetime | str | None = None,
167        added_from: date | datetime | str | None = None,
168        added_before: date | datetime | str | None = None,
169        added_until: date | datetime | str | None = None,
170        modified_after: date | datetime | str | None = None,
171        modified_from: date | datetime | str | None = None,
172        modified_before: date | datetime | str | None = None,
173        modified_until: date | datetime | str | None = None,
174        checksum: str | None = None,
175        page_size: int = 25,
176        page: int | None = None,
177        ordering: str | None = None,
178        descending: bool = False,
179        max_results: int | None = None,
180        on_page: Callable[[int, int | None], None] | None = None,
181    ) -> PagedResult[Document]:
182        """Return a filtered list of documents.
183
184        All tag, correspondent, document-type, storage-path, and custom-field
185        parameters accept either integer IDs or string names.
186
187        When ``page`` is ``None`` (the default), all pages are fetched
188        automatically and ``next`` / ``previous`` in the returned
189        :class:`~easypaperless.models.paged_result.PagedResult` are always
190        ``None`` — even if ``max_results`` truncates the final result set.
191        ``count`` always reflects the server total, not the truncated length.
192        When ``page`` is set to a specific integer, only that one page is
193        fetched and ``next`` / ``previous`` contain the raw API values.
194
195        Args:
196            search: Search string.  Behaviour depends on ``search_mode``.
197            search_mode: How ``search`` is applied.  One of:
198                ``"title_or_content"`` *(default)*, ``"title"``, ``"query"``,
199                ``"original_filename"``.
200            ids: Return only documents whose ID is in this list.
201            tags: Documents must have **all** of these tags (AND semantics).
202            any_tags: Documents must have **at least one** of these tags.
203            exclude_tags: Documents must have **none** of these tags.
204            correspondent: Filter to documents assigned to this correspondent.
205                Pass ``None`` to return only documents with no correspondent set.
206            any_correspondent: Filter to documents assigned to any of these.
207            exclude_correspondents: Exclude documents assigned to any of these.
208            document_type: Filter to documents of exactly this type.
209                Pass ``None`` to return only documents with no document type set.
210            document_type_name_contains: Case-insensitive substring filter on document type name.
211            document_type_name_exact: Case-insensitive exact match on document type name.
212            any_document_type: Filter to documents whose type is any of these.
213            exclude_document_types: Exclude documents whose type is any of these.
214            storage_path: Filter to documents assigned to this storage path.
215                Pass ``None`` to return only documents with no storage path set.
216            any_storage_paths: Filter to documents assigned to any of these paths.
217            exclude_storage_paths: Exclude documents assigned to any of these paths.
218            owner: Filter to documents owned by this user ID.
219                Pass ``None`` to return only documents with no owner set.
220            exclude_owners: Exclude documents owned by any of these user IDs.
221            custom_fields: Documents must have **all** of these custom fields set.
222            any_custom_fields: Documents must have **at least one** of these fields.
223            exclude_custom_fields: Documents must have **none** of these fields.
224            custom_field_query: Filter documents by custom field values using a nested
225                query structure. See the `paperless-ngx API docs
226                <https://docs.paperless-ngx.com/api/#filtering-by-custom-fields>`_ for
227                the query format.
228            archive_serial_number: Filter by exact archive serial number.
229                Pass ``None`` to return only documents with no ASN set.
230            archive_serial_number_from: Filter by ASN >= this value.
231            archive_serial_number_till: Filter by ASN <= this value.
232            created_after: Only documents created after this date.
233                String input must be ISO-8601: ``"YYYY-MM-DD"``.
234            created_before: Only documents created before this date.
235                String input must be ISO-8601: ``"YYYY-MM-DD"``.
236            added_after: Only documents added after this date/time.
237                String input must be ISO-8601: ``"YYYY-MM-DD"`` for date precision or
238                ``"YYYY-MM-DDTHH:MM:SS"`` for datetime precision.
239            added_from: Only documents added on or after this date/time.
240                String input must be ISO-8601: ``"YYYY-MM-DD"`` or ``"YYYY-MM-DDTHH:MM:SS"``.
241            added_before: Only documents added before this date/time.
242                String input must be ISO-8601: ``"YYYY-MM-DD"`` or ``"YYYY-MM-DDTHH:MM:SS"``.
243            added_until: Only documents added on or before this date/time.
244                String input must be ISO-8601: ``"YYYY-MM-DD"`` or ``"YYYY-MM-DDTHH:MM:SS"``.
245            modified_after: Only documents modified after this date/time.
246                String input must be ISO-8601: ``"YYYY-MM-DD"`` or ``"YYYY-MM-DDTHH:MM:SS"``.
247            modified_from: Only documents modified on or after this date/time.
248                String input must be ISO-8601: ``"YYYY-MM-DD"`` or ``"YYYY-MM-DDTHH:MM:SS"``.
249            modified_before: Only documents modified before this date/time.
250                String input must be ISO-8601: ``"YYYY-MM-DD"`` or ``"YYYY-MM-DDTHH:MM:SS"``.
251            modified_until: Only documents modified on or before this date/time.
252                String input must be ISO-8601: ``"YYYY-MM-DD"`` or ``"YYYY-MM-DDTHH:MM:SS"``.
253            checksum: MD5 checksum of the original file (exact match).
254            page_size: Number of results per API page.  Default: ``25``.
255            page: Return only this specific page (1-based).
256            ordering: Field name to sort by.
257            descending: When ``True``, reverses the sort direction.
258            max_results: Stop after collecting this many documents.
259            on_page: Callback invoked after each page fetch.
260
261        Returns:
262            :class:`~easypaperless.models.paged_result.PagedResult` of
263            :class:`~easypaperless.models.documents.Document` objects.
264        """
265        return cast(
266            PagedResult[Document],
267            self._run(
268                self._async_documents.list(
269                    search=search,
270                    search_mode=search_mode,
271                    ids=ids,
272                    tags=tags,
273                    any_tags=any_tags,
274                    exclude_tags=exclude_tags,
275                    correspondent=correspondent,
276                    any_correspondent=any_correspondent,
277                    exclude_correspondents=exclude_correspondents,
278                    document_type=document_type,
279                    document_type_name_contains=document_type_name_contains,
280                    document_type_name_exact=document_type_name_exact,
281                    any_document_type=any_document_type,
282                    exclude_document_types=exclude_document_types,
283                    storage_path=storage_path,
284                    any_storage_paths=any_storage_paths,
285                    exclude_storage_paths=exclude_storage_paths,
286                    owner=owner,
287                    exclude_owners=exclude_owners,
288                    custom_fields=custom_fields,
289                    any_custom_fields=any_custom_fields,
290                    exclude_custom_fields=exclude_custom_fields,
291                    custom_field_query=custom_field_query,
292                    archive_serial_number=archive_serial_number,
293                    archive_serial_number_from=archive_serial_number_from,
294                    archive_serial_number_till=archive_serial_number_till,
295                    created_after=created_after,
296                    created_before=created_before,
297                    added_after=added_after,
298                    added_from=added_from,
299                    added_before=added_before,
300                    added_until=added_until,
301                    modified_after=modified_after,
302                    modified_from=modified_from,
303                    modified_before=modified_before,
304                    modified_until=modified_until,
305                    checksum=checksum,
306                    page_size=page_size,
307                    page=page,
308                    ordering=ordering,
309                    descending=descending,
310                    max_results=max_results,
311                    on_page=on_page,
312                )
313            ),
314        )
315
316    def update(
317        self,
318        id: int,
319        *,
320        title: str | Unset = UNSET,
321        content: str | Unset = UNSET,
322        created: date | str | None | Unset = UNSET,
323        correspondent: int | str | None | Unset = UNSET,
324        document_type: int | str | None | Unset = UNSET,
325        storage_path: int | str | None | Unset = UNSET,
326        tags: List[int | str] | None | Unset = UNSET,
327        archive_serial_number: int | None | Unset = UNSET,
328        custom_fields: List[dict[str, Any]] | None | Unset = UNSET,
329        owner: int | None | Unset = UNSET,
330        set_permissions: SetPermissions | None | Unset = UNSET,
331        remove_inbox_tags: bool | None | Unset = UNSET,
332    ) -> Document:
333        """Partially update a document (PATCH semantics).
334
335        Args:
336            id: Numeric ID of the document to update.
337            title: New document title.
338            content: OCR text content of the document.
339            created: Creation date as an ISO-8601 string (``"YYYY-MM-DD"``) or a
340                :class:`~datetime.date` object.
341            correspondent: Correspondent to assign, as an ID or name.
342                Pass ``None`` to clear the correspondent.
343            document_type: Document type to assign, as an ID or name.
344                Pass ``None`` to clear the document type.
345            storage_path: Storage path to assign, as an ID or name.
346                Pass ``None`` to clear the storage path.
347            tags: Full replacement list of tags (IDs or names).
348            archive_serial_number: Archive serial number to assign.
349                Pass ``None`` to clear the archive serial number.
350            custom_fields: List of ``{"field": <field_id>, "value": ...}`` dicts.
351            owner: Numeric user ID to assign as document owner.
352                Pass ``None`` to clear the owner.
353            set_permissions: Explicit view/change permission sets.
354                Pass ``None`` to clear all permissions (overwrite with empty).
355                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
356            remove_inbox_tags: When ``True``, removes all inbox tags from the document.
357
358        Returns:
359            The updated :class:`~easypaperless.models.documents.Document`.
360        """
361        return cast(
362            Document,
363            self._run(
364                self._async_documents.update(
365                    id,
366                    title=title,
367                    content=content,
368                    created=created,
369                    correspondent=correspondent,
370                    document_type=document_type,
371                    storage_path=storage_path,
372                    tags=tags,
373                    archive_serial_number=archive_serial_number,
374                    custom_fields=custom_fields,
375                    owner=owner,
376                    set_permissions=set_permissions,
377                    remove_inbox_tags=remove_inbox_tags,
378                )
379            ),
380        )
381
382    def delete(self, id: int) -> None:
383        """Permanently delete a document.
384
385        Args:
386            id: Numeric ID of the document to delete.
387
388        Raises:
389            ~easypaperless.exceptions.NotFoundError: If no document exists
390                with that ID.
391        """
392        self._run(self._async_documents.delete(id))
393
394    def download(self, id: int, *, original: bool = False) -> bytes:
395        """Download the binary content of a document.
396
397        Args:
398            id: Numeric ID of the document to download.
399            original: If ``False`` *(default)*, returns the archived PDF
400                (``GET /documents/{id}/download/``).
401                If ``True``, returns the original uploaded file
402                (``GET /documents/{id}/download/?original=true``).
403
404        Returns:
405            Raw file bytes.
406        """
407        return cast(bytes, self._run(self._async_documents.download(id, original=original)))
408
409    def upload(
410        self,
411        file: str | Path,
412        *,
413        title: str | Unset = UNSET,
414        created: date | str | None = None,
415        correspondent: int | str | None | Unset = UNSET,
416        document_type: int | str | None | Unset = UNSET,
417        storage_path: int | str | None | Unset = UNSET,
418        tags: List[int | str] | None = None,
419        archive_serial_number: int | None | Unset = UNSET,
420        custom_fields: List[dict[str, Any]] | None = None,
421        wait: bool = False,
422        poll_interval: float | None = None,
423        poll_timeout: float | None = None,
424    ) -> str | Document:
425        """Upload a document to paperless-ngx.
426
427        Args:
428            file: Path to the file to upload.
429            title: Title to assign to the document.
430            created: Creation date as an ISO-8601 string (``"YYYY-MM-DD"``) or a
431                :class:`~datetime.date` object.
432            correspondent: Correspondent to assign, as an ID or name.
433            document_type: Document type to assign, as an ID or name.
434            storage_path: Storage path to assign, as an ID or name.
435            tags: Tags to assign, as IDs or names.
436            archive_serial_number: Archive serial number to assign.
437            custom_fields: List of ``{"field": <field_id>, "value": ...}`` dicts.
438            wait: If ``False`` *(default)*, returns immediately with the task ID.
439                If ``True``, polls until processing completes.
440            poll_interval: Seconds between task-status checks while waiting for
441                processing to complete (requires ``wait=True``). Overrides the
442                client-level default. When omitted, falls back to the client-level
443                ``poll_interval`` (``2.0`` s unless changed at construction).
444            poll_timeout: Maximum seconds to wait before raising
445                :exc:`~easypaperless.exceptions.TaskTimeoutError` (requires
446                ``wait=True``). Overrides the client-level default. When omitted,
447                falls back to the client-level ``poll_timeout`` (``60.0`` s unless
448                changed at construction).
449
450        Returns:
451            The Celery task ID string when ``wait=False``, or the fully
452            processed :class:`~easypaperless.models.documents.Document`
453            when ``wait=True``.
454
455        Raises:
456            ~easypaperless.exceptions.UploadError: If processing fails.
457            ~easypaperless.exceptions.TaskTimeoutError: If timeout is exceeded.
458        """
459        return cast(
460            str | Document,
461            self._run(
462                self._async_documents.upload(
463                    file,
464                    title=title,
465                    created=created,
466                    correspondent=correspondent,
467                    document_type=document_type,
468                    storage_path=storage_path,
469                    tags=tags,
470                    archive_serial_number=archive_serial_number,
471                    custom_fields=custom_fields,
472                    wait=wait,
473                    poll_interval=poll_interval,
474                    poll_timeout=poll_timeout,
475                )
476            ),
477        )
478
479    def bulk_add_tag(self, document_ids: List[int], tag: int | str) -> None:
480        """Add a tag to multiple documents in a single request.
481
482        Args:
483            document_ids: List of document IDs to tag.
484            tag: Tag to add, as an ID or name.
485        """
486        self._run(self._async_documents.bulk_add_tag(document_ids, tag))
487
488    def bulk_remove_tag(self, document_ids: List[int], tag: int | str) -> None:
489        """Remove a tag from multiple documents in a single request.
490
491        Args:
492            document_ids: List of document IDs to un-tag.
493            tag: Tag to remove, as an ID or name.
494        """
495        self._run(self._async_documents.bulk_remove_tag(document_ids, tag))
496
497    def bulk_modify_tags(
498        self,
499        document_ids: List[int],
500        *,
501        add_tags: List[int | str] | None = None,
502        remove_tags: List[int | str] | None = None,
503    ) -> None:
504        """Add and/or remove tags on multiple documents atomically.
505
506        Args:
507            document_ids: List of document IDs to modify.
508            add_tags: Tags to add, as IDs or names.
509            remove_tags: Tags to remove, as IDs or names.
510        """
511        self._run(
512            self._async_documents.bulk_modify_tags(
513                document_ids, add_tags=add_tags, remove_tags=remove_tags
514            )
515        )
516
517    def bulk_delete(self, document_ids: List[int]) -> None:
518        """Permanently delete multiple documents in a single request.
519
520        Args:
521            document_ids: List of document IDs to delete.
522        """
523        self._run(self._async_documents.bulk_delete(document_ids))
524
525    def bulk_set_correspondent(
526        self, document_ids: List[int], correspondent: int | str | None
527    ) -> None:
528        """Assign a correspondent to multiple documents in a single request.
529
530        Args:
531            document_ids: List of document IDs to modify.
532            correspondent: Correspondent to assign, as an ID or name.
533                Pass ``None`` to clear.
534        """
535        self._run(self._async_documents.bulk_set_correspondent(document_ids, correspondent))
536
537    def bulk_set_document_type(
538        self, document_ids: List[int], document_type: int | str | None
539    ) -> None:
540        """Assign a document type to multiple documents in a single request.
541
542        Args:
543            document_ids: List of document IDs to modify.
544            document_type: Document type to assign, as an ID or name.
545                Pass ``None`` to clear.
546        """
547        self._run(self._async_documents.bulk_set_document_type(document_ids, document_type))
548
549    def bulk_set_storage_path(
550        self, document_ids: List[int], storage_path: int | str | None
551    ) -> None:
552        """Assign a storage path to multiple documents in a single request.
553
554        Args:
555            document_ids: List of document IDs to modify.
556            storage_path: Storage path to assign, as an ID or name.
557                Pass ``None`` to clear.
558        """
559        self._run(self._async_documents.bulk_set_storage_path(document_ids, storage_path))
560
561    def bulk_modify_custom_fields(
562        self,
563        document_ids: List[int],
564        *,
565        add_fields: List[dict[str, Any]] | None = None,
566        remove_fields: List[int] | None = None,
567    ) -> None:
568        """Add and/or remove custom field values on multiple documents.
569
570        Args:
571            document_ids: List of document IDs to modify.
572            add_fields: Custom-field value dicts to add.
573            remove_fields: Custom-field IDs whose values should be removed.
574        """
575        self._run(
576            self._async_documents.bulk_modify_custom_fields(
577                document_ids, add_fields=add_fields, remove_fields=remove_fields
578            )
579        )
580
581    def bulk_set_permissions(
582        self,
583        document_ids: List[int],
584        *,
585        set_permissions: SetPermissions | Unset = UNSET,
586        owner: int | None | Unset = UNSET,
587        merge: bool = False,
588    ) -> None:
589        """Set permissions and/or owner on multiple documents.
590
591        Args:
592            document_ids: List of document IDs to modify.
593            set_permissions: Explicit view/change permission sets.
594                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
595            owner: Numeric user ID to assign as document owner.
596                Pass ``None`` to clear the owner.
597                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
598            merge: When ``True``, new permissions are merged with existing ones.
599        """
600        self._run(
601            self._async_documents.bulk_set_permissions(
602                document_ids,
603                set_permissions=set_permissions,
604                owner=owner,
605                merge=merge,
606            )
607        )

Sync accessor for documents: client.documents.

SyncDocumentsResource( async_documents: DocumentsResource, run: Any)
94    def __init__(self, async_documents: DocumentsResource, run: Any) -> None:
95        self._async_documents = async_documents
96        self._run = run
97        self.notes = SyncNotesResource(async_documents.notes, run)
notes
def get( self, id: int, *, include_metadata: bool = False) -> easypaperless.Document:
 99    def get(self, id: int, *, include_metadata: bool = False) -> Document:
100        """Fetch a single document by its ID.
101
102        Args:
103            id: Numeric paperless-ngx document ID.
104            include_metadata: When ``True``, the extended file-level metadata
105                is fetched concurrently and attached to the document.
106                Default: ``False``.
107
108        Returns:
109            The :class:`~easypaperless.models.documents.Document` with the
110            given ID.
111
112        Raises:
113            ~easypaperless.exceptions.NotFoundError: If no document exists
114                with that ID.
115        """
116        return cast(
117            Document, self._run(self._async_documents.get(id, include_metadata=include_metadata))
118        )

Fetch a single document by its ID.

Arguments:
  • id: Numeric paperless-ngx document ID.
  • include_metadata: When True, the extended file-level metadata is fetched concurrently and attached to the document. Default: False.
Returns:

The ~easypaperless.models.documents.Document with the given ID.

Raises:
def get_metadata(self, id: int) -> easypaperless.DocumentMetadata:
120    def get_metadata(self, id: int) -> DocumentMetadata:
121        """Fetch the extended file-level metadata for a document.
122
123        Args:
124            id: Numeric paperless-ngx document ID.
125
126        Returns:
127            A :class:`~easypaperless.models.documents.DocumentMetadata` instance.
128
129        Raises:
130            ~easypaperless.exceptions.NotFoundError: If no document exists
131                with that ID.
132        """
133        return cast(DocumentMetadata, self._run(self._async_documents.get_metadata(id)))

Fetch the extended file-level metadata for a document.

Arguments:
  • id: Numeric paperless-ngx document ID.
Returns:

A ~easypaperless.models.documents.DocumentMetadata instance.

Raises:
def list( self, *, search: str | None = None, search_mode: str = 'title_or_content', ids: Optional[List[int]] = None, tags: Optional[List[Union[str, int]]] = None, any_tags: Optional[List[Union[str, int]]] = None, exclude_tags: Optional[List[Union[str, int]]] = None, correspondent: int | str | None | easypaperless.Unset = UNSET, any_correspondent: Optional[List[Union[str, int]]] = None, exclude_correspondents: Optional[List[Union[str, int]]] = None, document_type: int | str | None | easypaperless.Unset = UNSET, document_type_name_contains: str | None = None, document_type_name_exact: str | None = None, any_document_type: Optional[List[Union[str, int]]] = None, exclude_document_types: Optional[List[Union[str, int]]] = None, storage_path: int | str | None | easypaperless.Unset = UNSET, any_storage_paths: Optional[List[Union[str, int]]] = None, exclude_storage_paths: Optional[List[Union[str, int]]] = None, owner: int | None | easypaperless.Unset = UNSET, exclude_owners: Optional[List[int]] = None, custom_fields: Optional[List[Union[str, int]]] = None, any_custom_fields: Optional[List[Union[str, int]]] = None, exclude_custom_fields: Optional[List[Union[str, int]]] = None, custom_field_query: Optional[List[Any]] = None, archive_serial_number: int | None | easypaperless.Unset = UNSET, archive_serial_number_from: int | None = None, archive_serial_number_till: int | None = None, created_after: datetime.date | str | None = None, created_before: datetime.date | str | None = None, added_after: datetime.date | datetime.datetime | str | None = None, added_from: datetime.date | datetime.datetime | str | None = None, added_before: datetime.date | datetime.datetime | str | None = None, added_until: datetime.date | datetime.datetime | str | None = None, modified_after: datetime.date | datetime.datetime | str | None = None, modified_from: datetime.date | datetime.datetime | str | None = None, modified_before: datetime.date | datetime.datetime | str | None = None, modified_until: datetime.date | datetime.datetime | str | None = None, checksum: str | None = None, page_size: int = 25, page: int | None = None, ordering: str | None = None, descending: bool = False, max_results: int | None = None, on_page: Callable[[int, int | None], None] | None = None) -> easypaperless.PagedResult[Document]:
135    def list(
136        self,
137        *,
138        search: str | None = None,
139        search_mode: str = "title_or_content",
140        ids: List[int] | None = None,
141        tags: List[int | str] | None = None,
142        any_tags: List[int | str] | None = None,
143        exclude_tags: List[int | str] | None = None,
144        correspondent: int | str | None | Unset = UNSET,
145        any_correspondent: List[int | str] | None = None,
146        exclude_correspondents: List[int | str] | None = None,
147        document_type: int | str | None | Unset = UNSET,
148        document_type_name_contains: str | None = None,
149        document_type_name_exact: str | None = None,
150        any_document_type: List[int | str] | None = None,
151        exclude_document_types: List[int | str] | None = None,
152        storage_path: int | str | None | Unset = UNSET,
153        any_storage_paths: List[int | str] | None = None,
154        exclude_storage_paths: List[int | str] | None = None,
155        owner: int | None | Unset = UNSET,
156        exclude_owners: List[int] | None = None,
157        custom_fields: List[int | str] | None = None,
158        any_custom_fields: List[int | str] | None = None,
159        exclude_custom_fields: List[int | str] | None = None,
160        custom_field_query: List[Any] | None = None,
161        archive_serial_number: int | None | Unset = UNSET,
162        archive_serial_number_from: int | None = None,
163        archive_serial_number_till: int | None = None,
164        created_after: date | str | None = None,
165        created_before: date | str | None = None,
166        added_after: date | datetime | str | None = None,
167        added_from: date | datetime | str | None = None,
168        added_before: date | datetime | str | None = None,
169        added_until: date | datetime | str | None = None,
170        modified_after: date | datetime | str | None = None,
171        modified_from: date | datetime | str | None = None,
172        modified_before: date | datetime | str | None = None,
173        modified_until: date | datetime | str | None = None,
174        checksum: str | None = None,
175        page_size: int = 25,
176        page: int | None = None,
177        ordering: str | None = None,
178        descending: bool = False,
179        max_results: int | None = None,
180        on_page: Callable[[int, int | None], None] | None = None,
181    ) -> PagedResult[Document]:
182        """Return a filtered list of documents.
183
184        All tag, correspondent, document-type, storage-path, and custom-field
185        parameters accept either integer IDs or string names.
186
187        When ``page`` is ``None`` (the default), all pages are fetched
188        automatically and ``next`` / ``previous`` in the returned
189        :class:`~easypaperless.models.paged_result.PagedResult` are always
190        ``None`` — even if ``max_results`` truncates the final result set.
191        ``count`` always reflects the server total, not the truncated length.
192        When ``page`` is set to a specific integer, only that one page is
193        fetched and ``next`` / ``previous`` contain the raw API values.
194
195        Args:
196            search: Search string.  Behaviour depends on ``search_mode``.
197            search_mode: How ``search`` is applied.  One of:
198                ``"title_or_content"`` *(default)*, ``"title"``, ``"query"``,
199                ``"original_filename"``.
200            ids: Return only documents whose ID is in this list.
201            tags: Documents must have **all** of these tags (AND semantics).
202            any_tags: Documents must have **at least one** of these tags.
203            exclude_tags: Documents must have **none** of these tags.
204            correspondent: Filter to documents assigned to this correspondent.
205                Pass ``None`` to return only documents with no correspondent set.
206            any_correspondent: Filter to documents assigned to any of these.
207            exclude_correspondents: Exclude documents assigned to any of these.
208            document_type: Filter to documents of exactly this type.
209                Pass ``None`` to return only documents with no document type set.
210            document_type_name_contains: Case-insensitive substring filter on document type name.
211            document_type_name_exact: Case-insensitive exact match on document type name.
212            any_document_type: Filter to documents whose type is any of these.
213            exclude_document_types: Exclude documents whose type is any of these.
214            storage_path: Filter to documents assigned to this storage path.
215                Pass ``None`` to return only documents with no storage path set.
216            any_storage_paths: Filter to documents assigned to any of these paths.
217            exclude_storage_paths: Exclude documents assigned to any of these paths.
218            owner: Filter to documents owned by this user ID.
219                Pass ``None`` to return only documents with no owner set.
220            exclude_owners: Exclude documents owned by any of these user IDs.
221            custom_fields: Documents must have **all** of these custom fields set.
222            any_custom_fields: Documents must have **at least one** of these fields.
223            exclude_custom_fields: Documents must have **none** of these fields.
224            custom_field_query: Filter documents by custom field values using a nested
225                query structure. See the `paperless-ngx API docs
226                <https://docs.paperless-ngx.com/api/#filtering-by-custom-fields>`_ for
227                the query format.
228            archive_serial_number: Filter by exact archive serial number.
229                Pass ``None`` to return only documents with no ASN set.
230            archive_serial_number_from: Filter by ASN >= this value.
231            archive_serial_number_till: Filter by ASN <= this value.
232            created_after: Only documents created after this date.
233                String input must be ISO-8601: ``"YYYY-MM-DD"``.
234            created_before: Only documents created before this date.
235                String input must be ISO-8601: ``"YYYY-MM-DD"``.
236            added_after: Only documents added after this date/time.
237                String input must be ISO-8601: ``"YYYY-MM-DD"`` for date precision or
238                ``"YYYY-MM-DDTHH:MM:SS"`` for datetime precision.
239            added_from: Only documents added on or after this date/time.
240                String input must be ISO-8601: ``"YYYY-MM-DD"`` or ``"YYYY-MM-DDTHH:MM:SS"``.
241            added_before: Only documents added before this date/time.
242                String input must be ISO-8601: ``"YYYY-MM-DD"`` or ``"YYYY-MM-DDTHH:MM:SS"``.
243            added_until: Only documents added on or before this date/time.
244                String input must be ISO-8601: ``"YYYY-MM-DD"`` or ``"YYYY-MM-DDTHH:MM:SS"``.
245            modified_after: Only documents modified after this date/time.
246                String input must be ISO-8601: ``"YYYY-MM-DD"`` or ``"YYYY-MM-DDTHH:MM:SS"``.
247            modified_from: Only documents modified on or after this date/time.
248                String input must be ISO-8601: ``"YYYY-MM-DD"`` or ``"YYYY-MM-DDTHH:MM:SS"``.
249            modified_before: Only documents modified before this date/time.
250                String input must be ISO-8601: ``"YYYY-MM-DD"`` or ``"YYYY-MM-DDTHH:MM:SS"``.
251            modified_until: Only documents modified on or before this date/time.
252                String input must be ISO-8601: ``"YYYY-MM-DD"`` or ``"YYYY-MM-DDTHH:MM:SS"``.
253            checksum: MD5 checksum of the original file (exact match).
254            page_size: Number of results per API page.  Default: ``25``.
255            page: Return only this specific page (1-based).
256            ordering: Field name to sort by.
257            descending: When ``True``, reverses the sort direction.
258            max_results: Stop after collecting this many documents.
259            on_page: Callback invoked after each page fetch.
260
261        Returns:
262            :class:`~easypaperless.models.paged_result.PagedResult` of
263            :class:`~easypaperless.models.documents.Document` objects.
264        """
265        return cast(
266            PagedResult[Document],
267            self._run(
268                self._async_documents.list(
269                    search=search,
270                    search_mode=search_mode,
271                    ids=ids,
272                    tags=tags,
273                    any_tags=any_tags,
274                    exclude_tags=exclude_tags,
275                    correspondent=correspondent,
276                    any_correspondent=any_correspondent,
277                    exclude_correspondents=exclude_correspondents,
278                    document_type=document_type,
279                    document_type_name_contains=document_type_name_contains,
280                    document_type_name_exact=document_type_name_exact,
281                    any_document_type=any_document_type,
282                    exclude_document_types=exclude_document_types,
283                    storage_path=storage_path,
284                    any_storage_paths=any_storage_paths,
285                    exclude_storage_paths=exclude_storage_paths,
286                    owner=owner,
287                    exclude_owners=exclude_owners,
288                    custom_fields=custom_fields,
289                    any_custom_fields=any_custom_fields,
290                    exclude_custom_fields=exclude_custom_fields,
291                    custom_field_query=custom_field_query,
292                    archive_serial_number=archive_serial_number,
293                    archive_serial_number_from=archive_serial_number_from,
294                    archive_serial_number_till=archive_serial_number_till,
295                    created_after=created_after,
296                    created_before=created_before,
297                    added_after=added_after,
298                    added_from=added_from,
299                    added_before=added_before,
300                    added_until=added_until,
301                    modified_after=modified_after,
302                    modified_from=modified_from,
303                    modified_before=modified_before,
304                    modified_until=modified_until,
305                    checksum=checksum,
306                    page_size=page_size,
307                    page=page,
308                    ordering=ordering,
309                    descending=descending,
310                    max_results=max_results,
311                    on_page=on_page,
312                )
313            ),
314        )

Return a filtered list of documents.

All tag, correspondent, document-type, storage-path, and custom-field parameters accept either integer IDs or string names.

When page is None (the default), all pages are fetched automatically and next / previous in the returned ~easypaperless.models.paged_result.PagedResult are always None — even if max_results truncates the final result set. count always reflects the server total, not the truncated length. When page is set to a specific integer, only that one page is fetched and next / previous contain the raw API values.

Arguments:
  • search: Search string. Behaviour depends on search_mode.
  • search_mode: How search is applied. One of: "title_or_content" (default), "title", "query", "original_filename".
  • ids: Return only documents whose ID is in this list.
  • tags: Documents must have all of these tags (AND semantics).
  • any_tags: Documents must have at least one of these tags.
  • exclude_tags: Documents must have none of these tags.
  • correspondent: Filter to documents assigned to this correspondent. Pass None to return only documents with no correspondent set.
  • any_correspondent: Filter to documents assigned to any of these.
  • exclude_correspondents: Exclude documents assigned to any of these.
  • document_type: Filter to documents of exactly this type. Pass None to return only documents with no document type set.
  • document_type_name_contains: Case-insensitive substring filter on document type name.
  • document_type_name_exact: Case-insensitive exact match on document type name.
  • any_document_type: Filter to documents whose type is any of these.
  • exclude_document_types: Exclude documents whose type is any of these.
  • storage_path: Filter to documents assigned to this storage path. Pass None to return only documents with no storage path set.
  • any_storage_paths: Filter to documents assigned to any of these paths.
  • exclude_storage_paths: Exclude documents assigned to any of these paths.
  • owner: Filter to documents owned by this user ID. Pass None to return only documents with no owner set.
  • exclude_owners: Exclude documents owned by any of these user IDs.
  • custom_fields: Documents must have all of these custom fields set.
  • any_custom_fields: Documents must have at least one of these fields.
  • exclude_custom_fields: Documents must have none of these fields.
  • custom_field_query: Filter documents by custom field values using a nested query structure. See the paperless-ngx API docs for the query format.
  • archive_serial_number: Filter by exact archive serial number. Pass None to return only documents with no ASN set.
  • archive_serial_number_from: Filter by ASN >= this value.
  • archive_serial_number_till: Filter by ASN <= this value.
  • created_after: Only documents created after this date. String input must be ISO-8601: "YYYY-MM-DD".
  • created_before: Only documents created before this date. String input must be ISO-8601: "YYYY-MM-DD".
  • added_after: Only documents added after this date/time. String input must be ISO-8601: "YYYY-MM-DD" for date precision or "YYYY-MM-DDTHH:MM:SS" for datetime precision.
  • added_from: Only documents added on or after this date/time. String input must be ISO-8601: "YYYY-MM-DD" or "YYYY-MM-DDTHH:MM:SS".
  • added_before: Only documents added before this date/time. String input must be ISO-8601: "YYYY-MM-DD" or "YYYY-MM-DDTHH:MM:SS".
  • added_until: Only documents added on or before this date/time. String input must be ISO-8601: "YYYY-MM-DD" or "YYYY-MM-DDTHH:MM:SS".
  • modified_after: Only documents modified after this date/time. String input must be ISO-8601: "YYYY-MM-DD" or "YYYY-MM-DDTHH:MM:SS".
  • modified_from: Only documents modified on or after this date/time. String input must be ISO-8601: "YYYY-MM-DD" or "YYYY-MM-DDTHH:MM:SS".
  • modified_before: Only documents modified before this date/time. String input must be ISO-8601: "YYYY-MM-DD" or "YYYY-MM-DDTHH:MM:SS".
  • modified_until: Only documents modified on or before this date/time. String input must be ISO-8601: "YYYY-MM-DD" or "YYYY-MM-DDTHH:MM:SS".
  • checksum: MD5 checksum of the original file (exact match).
  • page_size: Number of results per API page. Default: 25.
  • page: Return only this specific page (1-based).
  • ordering: Field name to sort by.
  • descending: When True, reverses the sort direction.
  • max_results: Stop after collecting this many documents.
  • on_page: Callback invoked after each page fetch.
Returns:

~easypaperless.models.paged_result.PagedResult of ~easypaperless.models.documents.Document objects.

def update( self, id: int, *, title: str | easypaperless.Unset = UNSET, content: str | easypaperless.Unset = UNSET, created: datetime.date | str | None | easypaperless.Unset = UNSET, correspondent: int | str | None | easypaperless.Unset = UNSET, document_type: int | str | None | easypaperless.Unset = UNSET, storage_path: int | str | None | easypaperless.Unset = UNSET, tags: Union[List[Union[str, int]], NoneType, easypaperless.Unset] = UNSET, archive_serial_number: int | None | easypaperless.Unset = UNSET, custom_fields: Union[List[dict[str, Any]], NoneType, easypaperless.Unset] = UNSET, owner: int | None | easypaperless.Unset = UNSET, set_permissions: easypaperless.SetPermissions | None | easypaperless.Unset = UNSET, remove_inbox_tags: bool | None | easypaperless.Unset = UNSET) -> easypaperless.Document:
316    def update(
317        self,
318        id: int,
319        *,
320        title: str | Unset = UNSET,
321        content: str | Unset = UNSET,
322        created: date | str | None | Unset = UNSET,
323        correspondent: int | str | None | Unset = UNSET,
324        document_type: int | str | None | Unset = UNSET,
325        storage_path: int | str | None | Unset = UNSET,
326        tags: List[int | str] | None | Unset = UNSET,
327        archive_serial_number: int | None | Unset = UNSET,
328        custom_fields: List[dict[str, Any]] | None | Unset = UNSET,
329        owner: int | None | Unset = UNSET,
330        set_permissions: SetPermissions | None | Unset = UNSET,
331        remove_inbox_tags: bool | None | Unset = UNSET,
332    ) -> Document:
333        """Partially update a document (PATCH semantics).
334
335        Args:
336            id: Numeric ID of the document to update.
337            title: New document title.
338            content: OCR text content of the document.
339            created: Creation date as an ISO-8601 string (``"YYYY-MM-DD"``) or a
340                :class:`~datetime.date` object.
341            correspondent: Correspondent to assign, as an ID or name.
342                Pass ``None`` to clear the correspondent.
343            document_type: Document type to assign, as an ID or name.
344                Pass ``None`` to clear the document type.
345            storage_path: Storage path to assign, as an ID or name.
346                Pass ``None`` to clear the storage path.
347            tags: Full replacement list of tags (IDs or names).
348            archive_serial_number: Archive serial number to assign.
349                Pass ``None`` to clear the archive serial number.
350            custom_fields: List of ``{"field": <field_id>, "value": ...}`` dicts.
351            owner: Numeric user ID to assign as document owner.
352                Pass ``None`` to clear the owner.
353            set_permissions: Explicit view/change permission sets.
354                Pass ``None`` to clear all permissions (overwrite with empty).
355                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
356            remove_inbox_tags: When ``True``, removes all inbox tags from the document.
357
358        Returns:
359            The updated :class:`~easypaperless.models.documents.Document`.
360        """
361        return cast(
362            Document,
363            self._run(
364                self._async_documents.update(
365                    id,
366                    title=title,
367                    content=content,
368                    created=created,
369                    correspondent=correspondent,
370                    document_type=document_type,
371                    storage_path=storage_path,
372                    tags=tags,
373                    archive_serial_number=archive_serial_number,
374                    custom_fields=custom_fields,
375                    owner=owner,
376                    set_permissions=set_permissions,
377                    remove_inbox_tags=remove_inbox_tags,
378                )
379            ),
380        )

Partially update a document (PATCH semantics).

Arguments:
  • id: Numeric ID of the document to update.
  • title: New document title.
  • content: OCR text content of the document.
  • created: Creation date as an ISO-8601 string ("YYYY-MM-DD") or a ~datetime.date object.
  • correspondent: Correspondent to assign, as an ID or name. Pass None to clear the correspondent.
  • document_type: Document type to assign, as an ID or name. Pass None to clear the document type.
  • storage_path: Storage path to assign, as an ID or name. Pass None to clear the storage path.
  • tags: Full replacement list of tags (IDs or names).
  • archive_serial_number: Archive serial number to assign. Pass None to clear the archive serial number.
  • custom_fields: List of {"field": <field_id>, "value": ...} dicts.
  • owner: Numeric user ID to assign as document owner. Pass None to clear the owner.
  • set_permissions: Explicit view/change permission sets. Pass None to clear all permissions (overwrite with empty). Omit (or pass ~easypaperless.UNSET) to leave unchanged.
  • remove_inbox_tags: When True, removes all inbox tags from the document.
Returns:

The updated ~easypaperless.models.documents.Document.

def delete(self, id: int) -> None:
382    def delete(self, id: int) -> None:
383        """Permanently delete a document.
384
385        Args:
386            id: Numeric ID of the document to delete.
387
388        Raises:
389            ~easypaperless.exceptions.NotFoundError: If no document exists
390                with that ID.
391        """
392        self._run(self._async_documents.delete(id))

Permanently delete a document.

Arguments:
  • id: Numeric ID of the document to delete.
Raises:
def download(self, id: int, *, original: bool = False) -> bytes:
394    def download(self, id: int, *, original: bool = False) -> bytes:
395        """Download the binary content of a document.
396
397        Args:
398            id: Numeric ID of the document to download.
399            original: If ``False`` *(default)*, returns the archived PDF
400                (``GET /documents/{id}/download/``).
401                If ``True``, returns the original uploaded file
402                (``GET /documents/{id}/download/?original=true``).
403
404        Returns:
405            Raw file bytes.
406        """
407        return cast(bytes, self._run(self._async_documents.download(id, original=original)))

Download the binary content of a document.

Arguments:
  • id: Numeric ID of the document to download.
  • original: If False (default), returns the archived PDF (GET /documents/{id}/download/). If True, returns the original uploaded file (GET /documents/{id}/download/?original=true).
Returns:

Raw file bytes.

def upload( self, file: str | pathlib._local.Path, *, title: str | easypaperless.Unset = UNSET, created: datetime.date | str | None = None, correspondent: int | str | None | easypaperless.Unset = UNSET, document_type: int | str | None | easypaperless.Unset = UNSET, storage_path: int | str | None | easypaperless.Unset = UNSET, tags: Optional[List[Union[str, int]]] = None, archive_serial_number: int | None | easypaperless.Unset = UNSET, custom_fields: Optional[List[dict[str, Any]]] = None, wait: bool = False, poll_interval: float | None = None, poll_timeout: float | None = None) -> str | easypaperless.Document:
409    def upload(
410        self,
411        file: str | Path,
412        *,
413        title: str | Unset = UNSET,
414        created: date | str | None = None,
415        correspondent: int | str | None | Unset = UNSET,
416        document_type: int | str | None | Unset = UNSET,
417        storage_path: int | str | None | Unset = UNSET,
418        tags: List[int | str] | None = None,
419        archive_serial_number: int | None | Unset = UNSET,
420        custom_fields: List[dict[str, Any]] | None = None,
421        wait: bool = False,
422        poll_interval: float | None = None,
423        poll_timeout: float | None = None,
424    ) -> str | Document:
425        """Upload a document to paperless-ngx.
426
427        Args:
428            file: Path to the file to upload.
429            title: Title to assign to the document.
430            created: Creation date as an ISO-8601 string (``"YYYY-MM-DD"``) or a
431                :class:`~datetime.date` object.
432            correspondent: Correspondent to assign, as an ID or name.
433            document_type: Document type to assign, as an ID or name.
434            storage_path: Storage path to assign, as an ID or name.
435            tags: Tags to assign, as IDs or names.
436            archive_serial_number: Archive serial number to assign.
437            custom_fields: List of ``{"field": <field_id>, "value": ...}`` dicts.
438            wait: If ``False`` *(default)*, returns immediately with the task ID.
439                If ``True``, polls until processing completes.
440            poll_interval: Seconds between task-status checks while waiting for
441                processing to complete (requires ``wait=True``). Overrides the
442                client-level default. When omitted, falls back to the client-level
443                ``poll_interval`` (``2.0`` s unless changed at construction).
444            poll_timeout: Maximum seconds to wait before raising
445                :exc:`~easypaperless.exceptions.TaskTimeoutError` (requires
446                ``wait=True``). Overrides the client-level default. When omitted,
447                falls back to the client-level ``poll_timeout`` (``60.0`` s unless
448                changed at construction).
449
450        Returns:
451            The Celery task ID string when ``wait=False``, or the fully
452            processed :class:`~easypaperless.models.documents.Document`
453            when ``wait=True``.
454
455        Raises:
456            ~easypaperless.exceptions.UploadError: If processing fails.
457            ~easypaperless.exceptions.TaskTimeoutError: If timeout is exceeded.
458        """
459        return cast(
460            str | Document,
461            self._run(
462                self._async_documents.upload(
463                    file,
464                    title=title,
465                    created=created,
466                    correspondent=correspondent,
467                    document_type=document_type,
468                    storage_path=storage_path,
469                    tags=tags,
470                    archive_serial_number=archive_serial_number,
471                    custom_fields=custom_fields,
472                    wait=wait,
473                    poll_interval=poll_interval,
474                    poll_timeout=poll_timeout,
475                )
476            ),
477        )

Upload a document to paperless-ngx.

Arguments:
  • file: Path to the file to upload.
  • title: Title to assign to the document.
  • created: Creation date as an ISO-8601 string ("YYYY-MM-DD") or a ~datetime.date object.
  • correspondent: Correspondent to assign, as an ID or name.
  • document_type: Document type to assign, as an ID or name.
  • storage_path: Storage path to assign, as an ID or name.
  • tags: Tags to assign, as IDs or names.
  • archive_serial_number: Archive serial number to assign.
  • custom_fields: List of {"field": <field_id>, "value": ...} dicts.
  • wait: If False (default), returns immediately with the task ID. If True, polls until processing completes.
  • poll_interval: Seconds between task-status checks while waiting for processing to complete (requires wait=True). Overrides the client-level default. When omitted, falls back to the client-level poll_interval (2.0 s unless changed at construction).
  • poll_timeout: Maximum seconds to wait before raising ~easypaperless.exceptions.TaskTimeoutError (requires wait=True). Overrides the client-level default. When omitted, falls back to the client-level poll_timeout (60.0 s unless changed at construction).
Returns:

The Celery task ID string when wait=False, or the fully processed ~easypaperless.models.documents.Document when wait=True.

Raises:
def bulk_add_tag(self, document_ids: List[int], tag: int | str) -> None:
479    def bulk_add_tag(self, document_ids: List[int], tag: int | str) -> None:
480        """Add a tag to multiple documents in a single request.
481
482        Args:
483            document_ids: List of document IDs to tag.
484            tag: Tag to add, as an ID or name.
485        """
486        self._run(self._async_documents.bulk_add_tag(document_ids, tag))

Add a tag to multiple documents in a single request.

Arguments:
  • document_ids: List of document IDs to tag.
  • tag: Tag to add, as an ID or name.
def bulk_remove_tag(self, document_ids: List[int], tag: int | str) -> None:
488    def bulk_remove_tag(self, document_ids: List[int], tag: int | str) -> None:
489        """Remove a tag from multiple documents in a single request.
490
491        Args:
492            document_ids: List of document IDs to un-tag.
493            tag: Tag to remove, as an ID or name.
494        """
495        self._run(self._async_documents.bulk_remove_tag(document_ids, tag))

Remove a tag from multiple documents in a single request.

Arguments:
  • document_ids: List of document IDs to un-tag.
  • tag: Tag to remove, as an ID or name.
def bulk_modify_tags( self, document_ids: List[int], *, add_tags: Optional[List[Union[str, int]]] = None, remove_tags: Optional[List[Union[str, int]]] = None) -> None:
497    def bulk_modify_tags(
498        self,
499        document_ids: List[int],
500        *,
501        add_tags: List[int | str] | None = None,
502        remove_tags: List[int | str] | None = None,
503    ) -> None:
504        """Add and/or remove tags on multiple documents atomically.
505
506        Args:
507            document_ids: List of document IDs to modify.
508            add_tags: Tags to add, as IDs or names.
509            remove_tags: Tags to remove, as IDs or names.
510        """
511        self._run(
512            self._async_documents.bulk_modify_tags(
513                document_ids, add_tags=add_tags, remove_tags=remove_tags
514            )
515        )

Add and/or remove tags on multiple documents atomically.

Arguments:
  • document_ids: List of document IDs to modify.
  • add_tags: Tags to add, as IDs or names.
  • remove_tags: Tags to remove, as IDs or names.
def bulk_delete(self, document_ids: List[int]) -> None:
517    def bulk_delete(self, document_ids: List[int]) -> None:
518        """Permanently delete multiple documents in a single request.
519
520        Args:
521            document_ids: List of document IDs to delete.
522        """
523        self._run(self._async_documents.bulk_delete(document_ids))

Permanently delete multiple documents in a single request.

Arguments:
  • document_ids: List of document IDs to delete.
def bulk_set_correspondent(self, document_ids: List[int], correspondent: int | str | None) -> None:
525    def bulk_set_correspondent(
526        self, document_ids: List[int], correspondent: int | str | None
527    ) -> None:
528        """Assign a correspondent to multiple documents in a single request.
529
530        Args:
531            document_ids: List of document IDs to modify.
532            correspondent: Correspondent to assign, as an ID or name.
533                Pass ``None`` to clear.
534        """
535        self._run(self._async_documents.bulk_set_correspondent(document_ids, correspondent))

Assign a correspondent to multiple documents in a single request.

Arguments:
  • document_ids: List of document IDs to modify.
  • correspondent: Correspondent to assign, as an ID or name. Pass None to clear.
def bulk_set_document_type(self, document_ids: List[int], document_type: int | str | None) -> None:
537    def bulk_set_document_type(
538        self, document_ids: List[int], document_type: int | str | None
539    ) -> None:
540        """Assign a document type to multiple documents in a single request.
541
542        Args:
543            document_ids: List of document IDs to modify.
544            document_type: Document type to assign, as an ID or name.
545                Pass ``None`` to clear.
546        """
547        self._run(self._async_documents.bulk_set_document_type(document_ids, document_type))

Assign a document type to multiple documents in a single request.

Arguments:
  • document_ids: List of document IDs to modify.
  • document_type: Document type to assign, as an ID or name. Pass None to clear.
def bulk_set_storage_path(self, document_ids: List[int], storage_path: int | str | None) -> None:
549    def bulk_set_storage_path(
550        self, document_ids: List[int], storage_path: int | str | None
551    ) -> None:
552        """Assign a storage path to multiple documents in a single request.
553
554        Args:
555            document_ids: List of document IDs to modify.
556            storage_path: Storage path to assign, as an ID or name.
557                Pass ``None`` to clear.
558        """
559        self._run(self._async_documents.bulk_set_storage_path(document_ids, storage_path))

Assign a storage path to multiple documents in a single request.

Arguments:
  • document_ids: List of document IDs to modify.
  • storage_path: Storage path to assign, as an ID or name. Pass None to clear.
def bulk_modify_custom_fields( self, document_ids: List[int], *, add_fields: Optional[List[dict[str, Any]]] = None, remove_fields: Optional[List[int]] = None) -> None:
561    def bulk_modify_custom_fields(
562        self,
563        document_ids: List[int],
564        *,
565        add_fields: List[dict[str, Any]] | None = None,
566        remove_fields: List[int] | None = None,
567    ) -> None:
568        """Add and/or remove custom field values on multiple documents.
569
570        Args:
571            document_ids: List of document IDs to modify.
572            add_fields: Custom-field value dicts to add.
573            remove_fields: Custom-field IDs whose values should be removed.
574        """
575        self._run(
576            self._async_documents.bulk_modify_custom_fields(
577                document_ids, add_fields=add_fields, remove_fields=remove_fields
578            )
579        )

Add and/or remove custom field values on multiple documents.

Arguments:
  • document_ids: List of document IDs to modify.
  • add_fields: Custom-field value dicts to add.
  • remove_fields: Custom-field IDs whose values should be removed.
def bulk_set_permissions( self, document_ids: List[int], *, set_permissions: easypaperless.SetPermissions | easypaperless.Unset = UNSET, owner: int | None | easypaperless.Unset = UNSET, merge: bool = False) -> None:
581    def bulk_set_permissions(
582        self,
583        document_ids: List[int],
584        *,
585        set_permissions: SetPermissions | Unset = UNSET,
586        owner: int | None | Unset = UNSET,
587        merge: bool = False,
588    ) -> None:
589        """Set permissions and/or owner on multiple documents.
590
591        Args:
592            document_ids: List of document IDs to modify.
593            set_permissions: Explicit view/change permission sets.
594                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
595            owner: Numeric user ID to assign as document owner.
596                Pass ``None`` to clear the owner.
597                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
598            merge: When ``True``, new permissions are merged with existing ones.
599        """
600        self._run(
601            self._async_documents.bulk_set_permissions(
602                document_ids,
603                set_permissions=set_permissions,
604                owner=owner,
605                merge=merge,
606            )
607        )

Set permissions and/or owner on multiple documents.

Arguments:
  • document_ids: List of document IDs to modify.
  • set_permissions: Explicit view/change permission sets. Omit (or pass ~easypaperless.UNSET) to leave unchanged.
  • owner: Numeric user ID to assign as document owner. Pass None to clear the owner. Omit (or pass ~easypaperless.UNSET) to leave unchanged.
  • merge: When True, new permissions are merged with existing ones.
class SyncNotesResource:
20class SyncNotesResource:
21    """Sync accessor for document notes: ``client.documents.notes``."""
22
23    def __init__(self, async_notes: NotesResource, run: Any) -> None:
24        self._async_notes = async_notes
25        self._run = run
26
27    def list(
28        self,
29        document_id: int,
30        *,
31        page: int | None = None,
32        page_size: int | None = None,
33    ) -> PagedResult[DocumentNote]:
34        """Fetch notes attached to a document.
35
36        When ``page`` is ``None`` (the default), all pages are fetched
37        automatically and ``next`` / ``previous`` in the returned
38        :class:`~easypaperless.models.paged_result.PagedResult` are always
39        ``None``.  When ``page`` is set to a specific integer, only that one
40        page is fetched and ``next`` / ``previous`` contain the raw API values.
41
42        Args:
43            document_id: Numeric ID of the document whose notes to retrieve.
44            page: Return only this specific page (1-based).
45            page_size: Number of results per page.
46
47        Returns:
48            :class:`~easypaperless.models.paged_result.PagedResult` of
49            :class:`~easypaperless.models.documents.DocumentNote` objects,
50            ordered by creation time.
51
52        Raises:
53            ~easypaperless.exceptions.NotFoundError: If no document exists
54                with that ID.
55        """
56        return cast(
57            PagedResult[DocumentNote],
58            self._run(self._async_notes.list(document_id, page=page, page_size=page_size)),
59        )
60
61    def create(self, document_id: int, *, note: str) -> DocumentNote:
62        """Create a new note on a document.
63
64        Args:
65            document_id: Numeric ID of the document to annotate.
66            note: Text content of the note.
67
68        Returns:
69            The newly created :class:`~easypaperless.models.documents.DocumentNote`.
70
71        Raises:
72            ~easypaperless.exceptions.NotFoundError: If no document exists
73                with that ID.
74        """
75        return cast(DocumentNote, self._run(self._async_notes.create(document_id, note=note)))
76
77    def delete(self, document_id: int, note_id: int) -> None:
78        """Delete a note from a document.
79
80        Args:
81            document_id: Numeric ID of the document that owns the note.
82            note_id: Numeric ID of the note to delete.
83
84        Raises:
85            ~easypaperless.exceptions.NotFoundError: If no document or note
86                exists with the given IDs.
87        """
88        self._run(self._async_notes.delete(document_id, note_id))

Sync accessor for document notes: client.documents.notes.

SyncNotesResource( async_notes: NotesResource, run: Any)
23    def __init__(self, async_notes: NotesResource, run: Any) -> None:
24        self._async_notes = async_notes
25        self._run = run
def list( self, document_id: int, *, page: int | None = None, page_size: int | None = None) -> easypaperless.PagedResult[DocumentNote]:
27    def list(
28        self,
29        document_id: int,
30        *,
31        page: int | None = None,
32        page_size: int | None = None,
33    ) -> PagedResult[DocumentNote]:
34        """Fetch notes attached to a document.
35
36        When ``page`` is ``None`` (the default), all pages are fetched
37        automatically and ``next`` / ``previous`` in the returned
38        :class:`~easypaperless.models.paged_result.PagedResult` are always
39        ``None``.  When ``page`` is set to a specific integer, only that one
40        page is fetched and ``next`` / ``previous`` contain the raw API values.
41
42        Args:
43            document_id: Numeric ID of the document whose notes to retrieve.
44            page: Return only this specific page (1-based).
45            page_size: Number of results per page.
46
47        Returns:
48            :class:`~easypaperless.models.paged_result.PagedResult` of
49            :class:`~easypaperless.models.documents.DocumentNote` objects,
50            ordered by creation time.
51
52        Raises:
53            ~easypaperless.exceptions.NotFoundError: If no document exists
54                with that ID.
55        """
56        return cast(
57            PagedResult[DocumentNote],
58            self._run(self._async_notes.list(document_id, page=page, page_size=page_size)),
59        )

Fetch notes attached to a document.

When page is None (the default), all pages are fetched automatically and next / previous in the returned ~easypaperless.models.paged_result.PagedResult are always None. When page is set to a specific integer, only that one page is fetched and next / previous contain the raw API values.

Arguments:
  • document_id: Numeric ID of the document whose notes to retrieve.
  • page: Return only this specific page (1-based).
  • page_size: Number of results per page.
Returns:

~easypaperless.models.paged_result.PagedResult of ~easypaperless.models.documents.DocumentNote objects, ordered by creation time.

Raises:
def create( self, document_id: int, *, note: str) -> easypaperless.DocumentNote:
61    def create(self, document_id: int, *, note: str) -> DocumentNote:
62        """Create a new note on a document.
63
64        Args:
65            document_id: Numeric ID of the document to annotate.
66            note: Text content of the note.
67
68        Returns:
69            The newly created :class:`~easypaperless.models.documents.DocumentNote`.
70
71        Raises:
72            ~easypaperless.exceptions.NotFoundError: If no document exists
73                with that ID.
74        """
75        return cast(DocumentNote, self._run(self._async_notes.create(document_id, note=note)))

Create a new note on a document.

Arguments:
  • document_id: Numeric ID of the document to annotate.
  • note: Text content of the note.
Returns:

The newly created ~easypaperless.models.documents.DocumentNote.

Raises:
def delete(self, document_id: int, note_id: int) -> None:
77    def delete(self, document_id: int, note_id: int) -> None:
78        """Delete a note from a document.
79
80        Args:
81            document_id: Numeric ID of the document that owns the note.
82            note_id: Numeric ID of the note to delete.
83
84        Raises:
85            ~easypaperless.exceptions.NotFoundError: If no document or note
86                exists with the given IDs.
87        """
88        self._run(self._async_notes.delete(document_id, note_id))

Delete a note from a document.

Arguments:
  • document_id: Numeric ID of the document that owns the note.
  • note_id: Numeric ID of the note to delete.
Raises:
class SyncStoragePathsResource:
 18class SyncStoragePathsResource:
 19    """Sync accessor for storage paths: ``client.storage_paths``."""
 20
 21    def __init__(self, async_storage_paths: StoragePathsResource, run: Any) -> None:
 22        self._async_storage_paths = async_storage_paths
 23        self._run = run
 24
 25    def list(
 26        self,
 27        *,
 28        ids: List[int] | None = None,
 29        name_contains: str | None = None,
 30        name_exact: str | None = None,
 31        path_contains: str | None = None,
 32        path_exact: str | None = None,
 33        page: int | None = None,
 34        page_size: int | None = None,
 35        ordering: str | None = None,
 36        descending: bool = False,
 37    ) -> PagedResult[StoragePath]:
 38        """Return storage paths defined in paperless-ngx.
 39
 40        When ``page`` is ``None`` (the default), all pages are fetched
 41        automatically and ``next`` / ``previous`` in the result are always
 42        ``None``.  When ``page`` is set, only that page is fetched and
 43        ``next`` / ``previous`` reflect the raw API values.
 44
 45        Args:
 46            ids: Return only storage paths whose ID is in this list.
 47            name_contains: Case-insensitive substring filter on name.
 48            name_exact: Case-insensitive exact match on name.
 49            path_contains: Case-insensitive substring filter on path template.
 50            path_exact: Case-insensitive exact match on path template.
 51            page: Return only this specific page (1-based).
 52            page_size: Number of results per page.
 53            ordering: Field to sort by.
 54            descending: When ``True``, reverses the sort direction.
 55
 56        Returns:
 57            :class:`~easypaperless.models.paged_result.PagedResult` of
 58            :class:`~easypaperless.models.storage_paths.StoragePath` objects.
 59        """
 60        return cast(
 61            PagedResult[StoragePath],
 62            self._run(
 63                self._async_storage_paths.list(
 64                    ids=ids,
 65                    name_contains=name_contains,
 66                    name_exact=name_exact,
 67                    path_contains=path_contains,
 68                    path_exact=path_exact,
 69                    page=page,
 70                    page_size=page_size,
 71                    ordering=ordering,
 72                    descending=descending,
 73                )
 74            ),
 75        )
 76
 77    def get(self, id: int) -> StoragePath:
 78        """Fetch a single storage path by its ID.
 79
 80        Args:
 81            id: Numeric storage-path ID.
 82
 83        Returns:
 84            The :class:`~easypaperless.models.storage_paths.StoragePath` with the given ID.
 85
 86        Raises:
 87            ~easypaperless.exceptions.NotFoundError: If no storage path exists with that ID.
 88        """
 89        return cast(StoragePath, self._run(self._async_storage_paths.get(id)))
 90
 91    def create(
 92        self,
 93        *,
 94        name: str,
 95        path: str | Unset = UNSET,
 96        match: str | Unset = UNSET,
 97        matching_algorithm: MatchingAlgorithm | Unset = UNSET,
 98        is_insensitive: bool = True,
 99        owner: int | None | Unset = UNSET,
100        set_permissions: SetPermissions | None | Unset = UNSET,
101    ) -> StoragePath:
102        """Create a new storage path.
103
104        Args:
105            name: Storage-path name. Must be unique.
106            path: Template string for the archive file path.
107            match: Auto-matching pattern.
108            matching_algorithm: Controls how ``match`` is applied.
109                E.g. ``matching_algorithm=MatchingAlgorithm.REGEX`` for
110                regular-expression matching.
111            is_insensitive: When ``True``, ``match`` is case-insensitive.
112                Defaults to ``True``, matching the paperless-ngx API default.
113            owner: Numeric user ID to assign as owner.
114            set_permissions: Explicit view/change permission sets.
115                Pass ``None`` to create with empty permissions.
116
117        Returns:
118            The newly created :class:`~easypaperless.models.storage_paths.StoragePath`.
119        """
120        return cast(
121            StoragePath,
122            self._run(
123                self._async_storage_paths.create(
124                    name=name,
125                    path=path,
126                    match=match,
127                    matching_algorithm=matching_algorithm,
128                    is_insensitive=is_insensitive,
129                    owner=owner,
130                    set_permissions=set_permissions,
131                )
132            ),
133        )
134
135    def update(
136        self,
137        id: int,
138        *,
139        name: str | Unset = UNSET,
140        path: str | Unset = UNSET,
141        match: str | Unset = UNSET,
142        matching_algorithm: MatchingAlgorithm | Unset = UNSET,
143        is_insensitive: bool | Unset = UNSET,
144        owner: int | None | Unset = UNSET,
145        set_permissions: SetPermissions | None | Unset = UNSET,
146    ) -> StoragePath:
147        """Partially update a storage path (PATCH semantics).
148
149        Args:
150            id: Numeric ID of the storage path to update.
151            name: Storage-path name.
152            path: Template string for the archive file path.
153            match: Auto-matching pattern.
154            matching_algorithm: Controls how ``match`` is applied.
155                E.g. ``matching_algorithm=MatchingAlgorithm.REGEX`` for
156                regular-expression matching.
157            is_insensitive: When ``True``, ``match`` is case-insensitive.
158            owner: Numeric user ID to assign as owner.
159                Pass ``None`` to clear the owner.
160                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
161            set_permissions: Explicit view/change permission sets.
162                Pass ``None`` to clear all permissions (overwrite with empty).
163                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
164
165        Returns:
166            The updated :class:`~easypaperless.models.storage_paths.StoragePath`.
167        """
168        return cast(
169            StoragePath,
170            self._run(
171                self._async_storage_paths.update(
172                    id,
173                    name=name,
174                    path=path,
175                    match=match,
176                    matching_algorithm=matching_algorithm,
177                    is_insensitive=is_insensitive,
178                    owner=owner,
179                    set_permissions=set_permissions,
180                )
181            ),
182        )
183
184    def delete(self, id: int) -> None:
185        """Delete a storage path.
186
187        Args:
188            id: Numeric ID of the storage path to delete.
189
190        Raises:
191            ~easypaperless.exceptions.NotFoundError: If no storage path exists with that ID.
192        """
193        self._run(self._async_storage_paths.delete(id))
194
195    def bulk_delete(self, ids: List[int]) -> None:
196        """Permanently delete multiple storage paths in a single request.
197
198        Args:
199            ids: List of storage path IDs to delete.
200        """
201        self._run(self._async_storage_paths.bulk_delete(ids))
202
203    def bulk_set_permissions(
204        self,
205        ids: List[int],
206        *,
207        set_permissions: SetPermissions | Unset = UNSET,
208        owner: int | None | Unset = UNSET,
209        merge: bool = False,
210    ) -> None:
211        """Set permissions and/or owner on multiple storage paths.
212
213        Args:
214            ids: List of storage path IDs to modify.
215            set_permissions: Explicit view/change permission sets.
216                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
217            owner: Numeric user ID to assign as owner.
218                Pass ``None`` to clear the owner.
219                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
220            merge: When ``True``, new permissions are merged with existing ones.
221        """
222        self._run(
223            self._async_storage_paths.bulk_set_permissions(
224                ids, set_permissions=set_permissions, owner=owner, merge=merge
225            )
226        )

Sync accessor for storage paths: client.storage_paths.

SyncStoragePathsResource( async_storage_paths: StoragePathsResource, run: Any)
21    def __init__(self, async_storage_paths: StoragePathsResource, run: Any) -> None:
22        self._async_storage_paths = async_storage_paths
23        self._run = run
def list( self, *, ids: Optional[List[int]] = None, name_contains: str | None = None, name_exact: str | None = None, path_contains: str | None = None, path_exact: str | None = None, page: int | None = None, page_size: int | None = None, ordering: str | None = None, descending: bool = False) -> easypaperless.PagedResult[StoragePath]:
25    def list(
26        self,
27        *,
28        ids: List[int] | None = None,
29        name_contains: str | None = None,
30        name_exact: str | None = None,
31        path_contains: str | None = None,
32        path_exact: str | None = None,
33        page: int | None = None,
34        page_size: int | None = None,
35        ordering: str | None = None,
36        descending: bool = False,
37    ) -> PagedResult[StoragePath]:
38        """Return storage paths defined in paperless-ngx.
39
40        When ``page`` is ``None`` (the default), all pages are fetched
41        automatically and ``next`` / ``previous`` in the result are always
42        ``None``.  When ``page`` is set, only that page is fetched and
43        ``next`` / ``previous`` reflect the raw API values.
44
45        Args:
46            ids: Return only storage paths whose ID is in this list.
47            name_contains: Case-insensitive substring filter on name.
48            name_exact: Case-insensitive exact match on name.
49            path_contains: Case-insensitive substring filter on path template.
50            path_exact: Case-insensitive exact match on path template.
51            page: Return only this specific page (1-based).
52            page_size: Number of results per page.
53            ordering: Field to sort by.
54            descending: When ``True``, reverses the sort direction.
55
56        Returns:
57            :class:`~easypaperless.models.paged_result.PagedResult` of
58            :class:`~easypaperless.models.storage_paths.StoragePath` objects.
59        """
60        return cast(
61            PagedResult[StoragePath],
62            self._run(
63                self._async_storage_paths.list(
64                    ids=ids,
65                    name_contains=name_contains,
66                    name_exact=name_exact,
67                    path_contains=path_contains,
68                    path_exact=path_exact,
69                    page=page,
70                    page_size=page_size,
71                    ordering=ordering,
72                    descending=descending,
73                )
74            ),
75        )

Return storage paths defined in paperless-ngx.

When page is None (the default), all pages are fetched automatically and next / previous in the result are always None. When page is set, only that page is fetched and next / previous reflect the raw API values.

Arguments:
  • ids: Return only storage paths whose ID is in this list.
  • name_contains: Case-insensitive substring filter on name.
  • name_exact: Case-insensitive exact match on name.
  • path_contains: Case-insensitive substring filter on path template.
  • path_exact: Case-insensitive exact match on path template.
  • page: Return only this specific page (1-based).
  • page_size: Number of results per page.
  • ordering: Field to sort by.
  • descending: When True, reverses the sort direction.
Returns:

~easypaperless.models.paged_result.PagedResult of ~easypaperless.models.storage_paths.StoragePath objects.

def get(self, id: int) -> easypaperless.StoragePath:
77    def get(self, id: int) -> StoragePath:
78        """Fetch a single storage path by its ID.
79
80        Args:
81            id: Numeric storage-path ID.
82
83        Returns:
84            The :class:`~easypaperless.models.storage_paths.StoragePath` with the given ID.
85
86        Raises:
87            ~easypaperless.exceptions.NotFoundError: If no storage path exists with that ID.
88        """
89        return cast(StoragePath, self._run(self._async_storage_paths.get(id)))

Fetch a single storage path by its ID.

Arguments:
  • id: Numeric storage-path ID.
Returns:

The ~easypaperless.models.storage_paths.StoragePath with the given ID.

Raises:
def create( self, *, name: str, path: str | easypaperless.Unset = UNSET, match: str | easypaperless.Unset = UNSET, matching_algorithm: easypaperless.MatchingAlgorithm | easypaperless.Unset = UNSET, is_insensitive: bool = True, owner: int | None | easypaperless.Unset = UNSET, set_permissions: easypaperless.SetPermissions | None | easypaperless.Unset = UNSET) -> easypaperless.StoragePath:
 91    def create(
 92        self,
 93        *,
 94        name: str,
 95        path: str | Unset = UNSET,
 96        match: str | Unset = UNSET,
 97        matching_algorithm: MatchingAlgorithm | Unset = UNSET,
 98        is_insensitive: bool = True,
 99        owner: int | None | Unset = UNSET,
100        set_permissions: SetPermissions | None | Unset = UNSET,
101    ) -> StoragePath:
102        """Create a new storage path.
103
104        Args:
105            name: Storage-path name. Must be unique.
106            path: Template string for the archive file path.
107            match: Auto-matching pattern.
108            matching_algorithm: Controls how ``match`` is applied.
109                E.g. ``matching_algorithm=MatchingAlgorithm.REGEX`` for
110                regular-expression matching.
111            is_insensitive: When ``True``, ``match`` is case-insensitive.
112                Defaults to ``True``, matching the paperless-ngx API default.
113            owner: Numeric user ID to assign as owner.
114            set_permissions: Explicit view/change permission sets.
115                Pass ``None`` to create with empty permissions.
116
117        Returns:
118            The newly created :class:`~easypaperless.models.storage_paths.StoragePath`.
119        """
120        return cast(
121            StoragePath,
122            self._run(
123                self._async_storage_paths.create(
124                    name=name,
125                    path=path,
126                    match=match,
127                    matching_algorithm=matching_algorithm,
128                    is_insensitive=is_insensitive,
129                    owner=owner,
130                    set_permissions=set_permissions,
131                )
132            ),
133        )

Create a new storage path.

Arguments:
  • name: Storage-path name. Must be unique.
  • path: Template string for the archive file path.
  • match: Auto-matching pattern.
  • matching_algorithm: Controls how match is applied. E.g. matching_algorithm=MatchingAlgorithm.REGEX for regular-expression matching.
  • is_insensitive: When True, match is case-insensitive. Defaults to True, matching the paperless-ngx API default.
  • owner: Numeric user ID to assign as owner.
  • set_permissions: Explicit view/change permission sets. Pass None to create with empty permissions.
Returns:

The newly created ~easypaperless.models.storage_paths.StoragePath.

def update( self, id: int, *, name: str | easypaperless.Unset = UNSET, path: str | easypaperless.Unset = UNSET, match: str | easypaperless.Unset = UNSET, matching_algorithm: easypaperless.MatchingAlgorithm | easypaperless.Unset = UNSET, is_insensitive: bool | easypaperless.Unset = UNSET, owner: int | None | easypaperless.Unset = UNSET, set_permissions: easypaperless.SetPermissions | None | easypaperless.Unset = UNSET) -> easypaperless.StoragePath:
135    def update(
136        self,
137        id: int,
138        *,
139        name: str | Unset = UNSET,
140        path: str | Unset = UNSET,
141        match: str | Unset = UNSET,
142        matching_algorithm: MatchingAlgorithm | Unset = UNSET,
143        is_insensitive: bool | Unset = UNSET,
144        owner: int | None | Unset = UNSET,
145        set_permissions: SetPermissions | None | Unset = UNSET,
146    ) -> StoragePath:
147        """Partially update a storage path (PATCH semantics).
148
149        Args:
150            id: Numeric ID of the storage path to update.
151            name: Storage-path name.
152            path: Template string for the archive file path.
153            match: Auto-matching pattern.
154            matching_algorithm: Controls how ``match`` is applied.
155                E.g. ``matching_algorithm=MatchingAlgorithm.REGEX`` for
156                regular-expression matching.
157            is_insensitive: When ``True``, ``match`` is case-insensitive.
158            owner: Numeric user ID to assign as owner.
159                Pass ``None`` to clear the owner.
160                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
161            set_permissions: Explicit view/change permission sets.
162                Pass ``None`` to clear all permissions (overwrite with empty).
163                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
164
165        Returns:
166            The updated :class:`~easypaperless.models.storage_paths.StoragePath`.
167        """
168        return cast(
169            StoragePath,
170            self._run(
171                self._async_storage_paths.update(
172                    id,
173                    name=name,
174                    path=path,
175                    match=match,
176                    matching_algorithm=matching_algorithm,
177                    is_insensitive=is_insensitive,
178                    owner=owner,
179                    set_permissions=set_permissions,
180                )
181            ),
182        )

Partially update a storage path (PATCH semantics).

Arguments:
  • id: Numeric ID of the storage path to update.
  • name: Storage-path name.
  • path: Template string for the archive file path.
  • match: Auto-matching pattern.
  • matching_algorithm: Controls how match is applied. E.g. matching_algorithm=MatchingAlgorithm.REGEX for regular-expression matching.
  • is_insensitive: When True, match is case-insensitive.
  • owner: Numeric user ID to assign as owner. Pass None to clear the owner. Omit (or pass ~easypaperless.UNSET) to leave unchanged.
  • set_permissions: Explicit view/change permission sets. Pass None to clear all permissions (overwrite with empty). Omit (or pass ~easypaperless.UNSET) to leave unchanged.
Returns:

The updated ~easypaperless.models.storage_paths.StoragePath.

def delete(self, id: int) -> None:
184    def delete(self, id: int) -> None:
185        """Delete a storage path.
186
187        Args:
188            id: Numeric ID of the storage path to delete.
189
190        Raises:
191            ~easypaperless.exceptions.NotFoundError: If no storage path exists with that ID.
192        """
193        self._run(self._async_storage_paths.delete(id))

Delete a storage path.

Arguments:
  • id: Numeric ID of the storage path to delete.
Raises:
def bulk_delete(self, ids: List[int]) -> None:
195    def bulk_delete(self, ids: List[int]) -> None:
196        """Permanently delete multiple storage paths in a single request.
197
198        Args:
199            ids: List of storage path IDs to delete.
200        """
201        self._run(self._async_storage_paths.bulk_delete(ids))

Permanently delete multiple storage paths in a single request.

Arguments:
  • ids: List of storage path IDs to delete.
def bulk_set_permissions( self, ids: List[int], *, set_permissions: easypaperless.SetPermissions | easypaperless.Unset = UNSET, owner: int | None | easypaperless.Unset = UNSET, merge: bool = False) -> None:
203    def bulk_set_permissions(
204        self,
205        ids: List[int],
206        *,
207        set_permissions: SetPermissions | Unset = UNSET,
208        owner: int | None | Unset = UNSET,
209        merge: bool = False,
210    ) -> None:
211        """Set permissions and/or owner on multiple storage paths.
212
213        Args:
214            ids: List of storage path IDs to modify.
215            set_permissions: Explicit view/change permission sets.
216                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
217            owner: Numeric user ID to assign as owner.
218                Pass ``None`` to clear the owner.
219                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
220            merge: When ``True``, new permissions are merged with existing ones.
221        """
222        self._run(
223            self._async_storage_paths.bulk_set_permissions(
224                ids, set_permissions=set_permissions, owner=owner, merge=merge
225            )
226        )

Set permissions and/or owner on multiple storage paths.

Arguments:
  • ids: List of storage path IDs to modify.
  • set_permissions: Explicit view/change permission sets. Omit (or pass ~easypaperless.UNSET) to leave unchanged.
  • owner: Numeric user ID to assign as owner. Pass None to clear the owner. Omit (or pass ~easypaperless.UNSET) to leave unchanged.
  • merge: When True, new permissions are merged with existing ones.
class SyncTagsResource:
 18class SyncTagsResource:
 19    """Sync accessor for tags: ``client.tags``."""
 20
 21    def __init__(self, async_tags: TagsResource, run: Any) -> None:
 22        self._async_tags = async_tags
 23        self._run = run
 24
 25    def list(
 26        self,
 27        *,
 28        ids: List[int] | None = None,
 29        name_contains: str | None = None,
 30        name_exact: str | None = None,
 31        page: int | None = None,
 32        page_size: int | None = None,
 33        ordering: str | None = None,
 34        descending: bool = False,
 35    ) -> PagedResult[Tag]:
 36        """Return tags defined in paperless-ngx.
 37
 38        When ``page`` is ``None`` (the default), all pages are fetched
 39        automatically and ``next`` / ``previous`` in the result are always
 40        ``None``.  When ``page`` is set, only that page is fetched and
 41        ``next`` / ``previous`` reflect the raw API values.
 42
 43        Args:
 44            ids: Return only tags whose ID is in this list.
 45            name_contains: Case-insensitive substring filter on tag name.
 46            name_exact: Case-insensitive exact match on tag name.
 47            page: Return only this specific page (1-based).
 48            page_size: Number of results per page.
 49            ordering: Field to sort by.
 50            descending: When ``True``, reverses the sort direction.
 51
 52        Returns:
 53            :class:`~easypaperless.models.paged_result.PagedResult` of
 54            :class:`~easypaperless.models.tags.Tag` objects.
 55        """
 56        return cast(
 57            PagedResult[Tag],
 58            self._run(
 59                self._async_tags.list(
 60                    ids=ids,
 61                    name_contains=name_contains,
 62                    name_exact=name_exact,
 63                    page=page,
 64                    page_size=page_size,
 65                    ordering=ordering,
 66                    descending=descending,
 67                )
 68            ),
 69        )
 70
 71    def get(self, id: int) -> Tag:
 72        """Fetch a single tag by its ID.
 73
 74        Args:
 75            id: Numeric tag ID.
 76
 77        Returns:
 78            The :class:`~easypaperless.models.tags.Tag` with the given ID.
 79
 80        Raises:
 81            ~easypaperless.exceptions.NotFoundError: If no tag exists with
 82                that ID.
 83        """
 84        return cast(Tag, self._run(self._async_tags.get(id)))
 85
 86    def create(
 87        self,
 88        *,
 89        name: str,
 90        color: str | Unset = UNSET,
 91        is_inbox_tag: bool | Unset = UNSET,
 92        match: str | Unset = UNSET,
 93        matching_algorithm: MatchingAlgorithm | Unset = UNSET,
 94        is_insensitive: bool = True,
 95        parent: int | None | Unset = UNSET,
 96        owner: int | None | Unset = UNSET,
 97        set_permissions: SetPermissions | None | Unset = UNSET,
 98    ) -> Tag:
 99        """Create a new tag.
100
101        Args:
102            name: Tag name. Must be unique.
103            color: Background colour as a CSS hex string.
104            is_inbox_tag: When ``True``, newly ingested documents get this tag.
105            match: Auto-matching pattern.
106            matching_algorithm: Controls how ``match`` is applied.
107                E.g. ``matching_algorithm=MatchingAlgorithm.REGEX`` for
108                regular-expression matching.
109            is_insensitive: When ``True``, ``match`` is case-insensitive.
110                Defaults to ``True``, matching the paperless-ngx API default.
111            parent: ID of parent tag for hierarchical trees.
112            owner: Numeric user ID to assign as owner.
113            set_permissions: Explicit view/change permission sets.
114                Pass ``None`` to create with empty permissions.
115
116        Returns:
117            The newly created :class:`~easypaperless.models.tags.Tag`.
118        """
119        return cast(
120            Tag,
121            self._run(
122                self._async_tags.create(
123                    name=name,
124                    color=color,
125                    is_inbox_tag=is_inbox_tag,
126                    match=match,
127                    matching_algorithm=matching_algorithm,
128                    is_insensitive=is_insensitive,
129                    parent=parent,
130                    owner=owner,
131                    set_permissions=set_permissions,
132                )
133            ),
134        )
135
136    def update(
137        self,
138        id: int,
139        *,
140        name: str | Unset = UNSET,
141        color: str | Unset = UNSET,
142        is_inbox_tag: bool | Unset = UNSET,
143        match: str | Unset = UNSET,
144        matching_algorithm: MatchingAlgorithm | Unset = UNSET,
145        is_insensitive: bool | Unset = UNSET,
146        parent: int | None | Unset = UNSET,
147        owner: int | None | Unset = UNSET,
148        set_permissions: SetPermissions | None | Unset = UNSET,
149    ) -> Tag:
150        """Partially update a tag (PATCH semantics).
151
152        Args:
153            id: Numeric ID of the tag to update.
154            name: Tag name.
155            color: Background colour as a CSS hex string.
156            is_inbox_tag: When ``True``, newly ingested documents get this tag.
157            match: Auto-matching pattern.
158            matching_algorithm: Controls how ``match`` is applied.
159                E.g. ``matching_algorithm=MatchingAlgorithm.REGEX`` for
160                regular-expression matching.
161            is_insensitive: When ``True``, ``match`` is case-insensitive.
162            parent: ID of parent tag.
163                Pass ``None`` to clear (make root tag).
164                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
165            owner: Numeric user ID to assign as owner.
166                Pass ``None`` to clear the owner.
167                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
168            set_permissions: Explicit view/change permission sets.
169                Pass ``None`` to clear all permissions (overwrite with empty).
170                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
171
172        Returns:
173            The updated :class:`~easypaperless.models.tags.Tag`.
174        """
175        return cast(
176            Tag,
177            self._run(
178                self._async_tags.update(
179                    id,
180                    name=name,
181                    color=color,
182                    is_inbox_tag=is_inbox_tag,
183                    match=match,
184                    matching_algorithm=matching_algorithm,
185                    is_insensitive=is_insensitive,
186                    parent=parent,
187                    owner=owner,
188                    set_permissions=set_permissions,
189                )
190            ),
191        )
192
193    def delete(self, id: int) -> None:
194        """Delete a tag.
195
196        Args:
197            id: Numeric ID of the tag to delete.
198
199        Raises:
200            ~easypaperless.exceptions.NotFoundError: If no tag exists with
201                that ID.
202        """
203        self._run(self._async_tags.delete(id))
204
205    def bulk_delete(self, ids: List[int]) -> None:
206        """Permanently delete multiple tags in a single request.
207
208        Args:
209            ids: List of tag IDs to delete.
210        """
211        self._run(self._async_tags.bulk_delete(ids))
212
213    def bulk_set_permissions(
214        self,
215        ids: List[int],
216        *,
217        set_permissions: SetPermissions | Unset = UNSET,
218        owner: int | None | Unset = UNSET,
219        merge: bool = False,
220    ) -> None:
221        """Set permissions and/or owner on multiple tags.
222
223        Args:
224            ids: List of tag IDs to modify.
225            set_permissions: Explicit view/change permission sets.
226                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
227            owner: Numeric user ID to assign as owner.
228                Pass ``None`` to clear the owner.
229                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
230            merge: When ``True``, new permissions are merged with existing ones.
231        """
232        self._run(
233            self._async_tags.bulk_set_permissions(
234                ids, set_permissions=set_permissions, owner=owner, merge=merge
235            )
236        )

Sync accessor for tags: client.tags.

SyncTagsResource( async_tags: TagsResource, run: Any)
21    def __init__(self, async_tags: TagsResource, run: Any) -> None:
22        self._async_tags = async_tags
23        self._run = run
def list( self, *, ids: Optional[List[int]] = None, name_contains: str | None = None, name_exact: str | None = None, page: int | None = None, page_size: int | None = None, ordering: str | None = None, descending: bool = False) -> easypaperless.PagedResult[Tag]:
25    def list(
26        self,
27        *,
28        ids: List[int] | None = None,
29        name_contains: str | None = None,
30        name_exact: str | None = None,
31        page: int | None = None,
32        page_size: int | None = None,
33        ordering: str | None = None,
34        descending: bool = False,
35    ) -> PagedResult[Tag]:
36        """Return tags defined in paperless-ngx.
37
38        When ``page`` is ``None`` (the default), all pages are fetched
39        automatically and ``next`` / ``previous`` in the result are always
40        ``None``.  When ``page`` is set, only that page is fetched and
41        ``next`` / ``previous`` reflect the raw API values.
42
43        Args:
44            ids: Return only tags whose ID is in this list.
45            name_contains: Case-insensitive substring filter on tag name.
46            name_exact: Case-insensitive exact match on tag name.
47            page: Return only this specific page (1-based).
48            page_size: Number of results per page.
49            ordering: Field to sort by.
50            descending: When ``True``, reverses the sort direction.
51
52        Returns:
53            :class:`~easypaperless.models.paged_result.PagedResult` of
54            :class:`~easypaperless.models.tags.Tag` objects.
55        """
56        return cast(
57            PagedResult[Tag],
58            self._run(
59                self._async_tags.list(
60                    ids=ids,
61                    name_contains=name_contains,
62                    name_exact=name_exact,
63                    page=page,
64                    page_size=page_size,
65                    ordering=ordering,
66                    descending=descending,
67                )
68            ),
69        )

Return tags defined in paperless-ngx.

When page is None (the default), all pages are fetched automatically and next / previous in the result are always None. When page is set, only that page is fetched and next / previous reflect the raw API values.

Arguments:
  • ids: Return only tags whose ID is in this list.
  • name_contains: Case-insensitive substring filter on tag name.
  • name_exact: Case-insensitive exact match on tag name.
  • page: Return only this specific page (1-based).
  • page_size: Number of results per page.
  • ordering: Field to sort by.
  • descending: When True, reverses the sort direction.
Returns:

~easypaperless.models.paged_result.PagedResult of ~easypaperless.models.tags.Tag objects.

def get(self, id: int) -> easypaperless.Tag:
71    def get(self, id: int) -> Tag:
72        """Fetch a single tag by its ID.
73
74        Args:
75            id: Numeric tag ID.
76
77        Returns:
78            The :class:`~easypaperless.models.tags.Tag` with the given ID.
79
80        Raises:
81            ~easypaperless.exceptions.NotFoundError: If no tag exists with
82                that ID.
83        """
84        return cast(Tag, self._run(self._async_tags.get(id)))

Fetch a single tag by its ID.

Arguments:
  • id: Numeric tag ID.
Returns:

The ~easypaperless.models.tags.Tag with the given ID.

Raises:
def create( self, *, name: str, color: str | easypaperless.Unset = UNSET, is_inbox_tag: bool | easypaperless.Unset = UNSET, match: str | easypaperless.Unset = UNSET, matching_algorithm: easypaperless.MatchingAlgorithm | easypaperless.Unset = UNSET, is_insensitive: bool = True, parent: int | None | easypaperless.Unset = UNSET, owner: int | None | easypaperless.Unset = UNSET, set_permissions: easypaperless.SetPermissions | None | easypaperless.Unset = UNSET) -> easypaperless.Tag:
 86    def create(
 87        self,
 88        *,
 89        name: str,
 90        color: str | Unset = UNSET,
 91        is_inbox_tag: bool | Unset = UNSET,
 92        match: str | Unset = UNSET,
 93        matching_algorithm: MatchingAlgorithm | Unset = UNSET,
 94        is_insensitive: bool = True,
 95        parent: int | None | Unset = UNSET,
 96        owner: int | None | Unset = UNSET,
 97        set_permissions: SetPermissions | None | Unset = UNSET,
 98    ) -> Tag:
 99        """Create a new tag.
100
101        Args:
102            name: Tag name. Must be unique.
103            color: Background colour as a CSS hex string.
104            is_inbox_tag: When ``True``, newly ingested documents get this tag.
105            match: Auto-matching pattern.
106            matching_algorithm: Controls how ``match`` is applied.
107                E.g. ``matching_algorithm=MatchingAlgorithm.REGEX`` for
108                regular-expression matching.
109            is_insensitive: When ``True``, ``match`` is case-insensitive.
110                Defaults to ``True``, matching the paperless-ngx API default.
111            parent: ID of parent tag for hierarchical trees.
112            owner: Numeric user ID to assign as owner.
113            set_permissions: Explicit view/change permission sets.
114                Pass ``None`` to create with empty permissions.
115
116        Returns:
117            The newly created :class:`~easypaperless.models.tags.Tag`.
118        """
119        return cast(
120            Tag,
121            self._run(
122                self._async_tags.create(
123                    name=name,
124                    color=color,
125                    is_inbox_tag=is_inbox_tag,
126                    match=match,
127                    matching_algorithm=matching_algorithm,
128                    is_insensitive=is_insensitive,
129                    parent=parent,
130                    owner=owner,
131                    set_permissions=set_permissions,
132                )
133            ),
134        )

Create a new tag.

Arguments:
  • name: Tag name. Must be unique.
  • color: Background colour as a CSS hex string.
  • is_inbox_tag: When True, newly ingested documents get this tag.
  • match: Auto-matching pattern.
  • matching_algorithm: Controls how match is applied. E.g. matching_algorithm=MatchingAlgorithm.REGEX for regular-expression matching.
  • is_insensitive: When True, match is case-insensitive. Defaults to True, matching the paperless-ngx API default.
  • parent: ID of parent tag for hierarchical trees.
  • owner: Numeric user ID to assign as owner.
  • set_permissions: Explicit view/change permission sets. Pass None to create with empty permissions.
Returns:

The newly created ~easypaperless.models.tags.Tag.

def update( self, id: int, *, name: str | easypaperless.Unset = UNSET, color: str | easypaperless.Unset = UNSET, is_inbox_tag: bool | easypaperless.Unset = UNSET, match: str | easypaperless.Unset = UNSET, matching_algorithm: easypaperless.MatchingAlgorithm | easypaperless.Unset = UNSET, is_insensitive: bool | easypaperless.Unset = UNSET, parent: int | None | easypaperless.Unset = UNSET, owner: int | None | easypaperless.Unset = UNSET, set_permissions: easypaperless.SetPermissions | None | easypaperless.Unset = UNSET) -> easypaperless.Tag:
136    def update(
137        self,
138        id: int,
139        *,
140        name: str | Unset = UNSET,
141        color: str | Unset = UNSET,
142        is_inbox_tag: bool | Unset = UNSET,
143        match: str | Unset = UNSET,
144        matching_algorithm: MatchingAlgorithm | Unset = UNSET,
145        is_insensitive: bool | Unset = UNSET,
146        parent: int | None | Unset = UNSET,
147        owner: int | None | Unset = UNSET,
148        set_permissions: SetPermissions | None | Unset = UNSET,
149    ) -> Tag:
150        """Partially update a tag (PATCH semantics).
151
152        Args:
153            id: Numeric ID of the tag to update.
154            name: Tag name.
155            color: Background colour as a CSS hex string.
156            is_inbox_tag: When ``True``, newly ingested documents get this tag.
157            match: Auto-matching pattern.
158            matching_algorithm: Controls how ``match`` is applied.
159                E.g. ``matching_algorithm=MatchingAlgorithm.REGEX`` for
160                regular-expression matching.
161            is_insensitive: When ``True``, ``match`` is case-insensitive.
162            parent: ID of parent tag.
163                Pass ``None`` to clear (make root tag).
164                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
165            owner: Numeric user ID to assign as owner.
166                Pass ``None`` to clear the owner.
167                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
168            set_permissions: Explicit view/change permission sets.
169                Pass ``None`` to clear all permissions (overwrite with empty).
170                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
171
172        Returns:
173            The updated :class:`~easypaperless.models.tags.Tag`.
174        """
175        return cast(
176            Tag,
177            self._run(
178                self._async_tags.update(
179                    id,
180                    name=name,
181                    color=color,
182                    is_inbox_tag=is_inbox_tag,
183                    match=match,
184                    matching_algorithm=matching_algorithm,
185                    is_insensitive=is_insensitive,
186                    parent=parent,
187                    owner=owner,
188                    set_permissions=set_permissions,
189                )
190            ),
191        )

Partially update a tag (PATCH semantics).

Arguments:
  • id: Numeric ID of the tag to update.
  • name: Tag name.
  • color: Background colour as a CSS hex string.
  • is_inbox_tag: When True, newly ingested documents get this tag.
  • match: Auto-matching pattern.
  • matching_algorithm: Controls how match is applied. E.g. matching_algorithm=MatchingAlgorithm.REGEX for regular-expression matching.
  • is_insensitive: When True, match is case-insensitive.
  • parent: ID of parent tag. Pass None to clear (make root tag). Omit (or pass ~easypaperless.UNSET) to leave unchanged.
  • owner: Numeric user ID to assign as owner. Pass None to clear the owner. Omit (or pass ~easypaperless.UNSET) to leave unchanged.
  • set_permissions: Explicit view/change permission sets. Pass None to clear all permissions (overwrite with empty). Omit (or pass ~easypaperless.UNSET) to leave unchanged.
Returns:

The updated ~easypaperless.models.tags.Tag.

def delete(self, id: int) -> None:
193    def delete(self, id: int) -> None:
194        """Delete a tag.
195
196        Args:
197            id: Numeric ID of the tag to delete.
198
199        Raises:
200            ~easypaperless.exceptions.NotFoundError: If no tag exists with
201                that ID.
202        """
203        self._run(self._async_tags.delete(id))

Delete a tag.

Arguments:
  • id: Numeric ID of the tag to delete.
Raises:
def bulk_delete(self, ids: List[int]) -> None:
205    def bulk_delete(self, ids: List[int]) -> None:
206        """Permanently delete multiple tags in a single request.
207
208        Args:
209            ids: List of tag IDs to delete.
210        """
211        self._run(self._async_tags.bulk_delete(ids))

Permanently delete multiple tags in a single request.

Arguments:
  • ids: List of tag IDs to delete.
def bulk_set_permissions( self, ids: List[int], *, set_permissions: easypaperless.SetPermissions | easypaperless.Unset = UNSET, owner: int | None | easypaperless.Unset = UNSET, merge: bool = False) -> None:
213    def bulk_set_permissions(
214        self,
215        ids: List[int],
216        *,
217        set_permissions: SetPermissions | Unset = UNSET,
218        owner: int | None | Unset = UNSET,
219        merge: bool = False,
220    ) -> None:
221        """Set permissions and/or owner on multiple tags.
222
223        Args:
224            ids: List of tag IDs to modify.
225            set_permissions: Explicit view/change permission sets.
226                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
227            owner: Numeric user ID to assign as owner.
228                Pass ``None`` to clear the owner.
229                Omit (or pass :data:`~easypaperless.UNSET`) to leave unchanged.
230            merge: When ``True``, new permissions are merged with existing ones.
231        """
232        self._run(
233            self._async_tags.bulk_set_permissions(
234                ids, set_permissions=set_permissions, owner=owner, merge=merge
235            )
236        )

Set permissions and/or owner on multiple tags.

Arguments:
  • ids: List of tag IDs to modify.
  • set_permissions: Explicit view/change permission sets. Omit (or pass ~easypaperless.UNSET) to leave unchanged.
  • owner: Numeric user ID to assign as owner. Pass None to clear the owner. Omit (or pass ~easypaperless.UNSET) to leave unchanged.
  • merge: When True, new permissions are merged with existing ones.
class UsersResource:
 20class UsersResource:
 21    """Accessor for users: ``client.users``."""
 22
 23    def __init__(self, core: _ClientCore) -> None:
 24        self._core = core
 25
 26    async def list(
 27        self,
 28        *,
 29        username_contains: str | Unset = UNSET,
 30        username_exact: str | Unset = UNSET,
 31        ordering: str | Unset = UNSET,
 32        page: int | Unset = UNSET,
 33        page_size: int | Unset = UNSET,
 34    ) -> PagedResult[User]:
 35        """Return users defined in paperless-ngx.
 36
 37        When ``page`` is ``UNSET`` (the default), all pages are fetched
 38        automatically and ``next`` / ``previous`` in the result are always
 39        ``None``.  When ``page`` is set, only that page is fetched and
 40        ``next`` / ``previous`` reflect the raw API values.
 41
 42        Args:
 43            username_contains: Case-insensitive substring filter on username.
 44            username_exact: Case-insensitive exact match on username.
 45            ordering: Field to sort by.
 46            page: Return only this specific page (1-based).
 47            page_size: Number of results per page.
 48
 49        Returns:
 50            :class:`~easypaperless.models.paged_result.PagedResult` of
 51            :class:`~easypaperless.models.users.User` objects.
 52        """
 53        logger.info("Listing users")
 54        params: dict[str, Any] = {}
 55        if not isinstance(username_contains, Unset):
 56            params["username__icontains"] = username_contains
 57        if not isinstance(username_exact, Unset):
 58            params["username__iexact"] = username_exact
 59        if not isinstance(ordering, Unset):
 60            params["ordering"] = ordering
 61        if not isinstance(page, Unset):
 62            params["page"] = page
 63        if not isinstance(page_size, Unset):
 64            params["page_size"] = page_size
 65        return cast(
 66            PagedResult[User],
 67            await self._core._list_resource("users", User, params or None),
 68        )
 69
 70    async def get(self, id: int) -> User:
 71        """Fetch a single user by their ID.
 72
 73        Args:
 74            id: Numeric user ID.
 75
 76        Returns:
 77            The :class:`~easypaperless.models.users.User` with the given ID.
 78
 79        Raises:
 80            ~easypaperless.exceptions.NotFoundError: If no user exists with
 81                that ID.
 82        """
 83        logger.info("Getting user id=%d", id)
 84        return cast(User, await self._core._get_resource("users", id, User))
 85
 86    async def create(
 87        self,
 88        *,
 89        username: str,
 90        email: str | Unset = UNSET,
 91        password: str | Unset = UNSET,
 92        first_name: str | Unset = UNSET,
 93        last_name: str | Unset = UNSET,
 94        date_joined: datetime | Unset = UNSET,
 95        is_staff: bool | Unset = UNSET,
 96        is_active: bool | Unset = UNSET,
 97        is_superuser: bool | Unset = UNSET,
 98        groups: List[int] | Unset = UNSET,
 99        user_permissions: List[str] | Unset = UNSET,
100    ) -> User:
101        """Create a new user.
102
103        Args:
104            username: Login username. Must be unique.
105            email: Email address.
106            password: Password for the new account.
107            first_name: Given name.
108            last_name: Family name.
109            date_joined: Account creation timestamp.
110            is_staff: Grant staff (admin UI) access.
111            is_active: Whether the account is active.
112            is_superuser: Grant unrestricted superuser access.
113            groups: IDs of groups to assign the user to.
114            user_permissions: Directly assigned permission strings.
115
116        Returns:
117            The newly created :class:`~easypaperless.models.users.User`.
118        """
119        logger.info("Creating user username=%r", username)
120        return cast(
121            User,
122            await self._core._create_resource(
123                "users",
124                User,
125                username=username,
126                email=email,
127                password=password,
128                first_name=first_name,
129                last_name=last_name,
130                date_joined=date_joined,
131                is_staff=is_staff,
132                is_active=is_active,
133                is_superuser=is_superuser,
134                groups=groups,
135                user_permissions=user_permissions,
136            ),
137        )
138
139    async def update(
140        self,
141        id: int,
142        *,
143        username: str | Unset = UNSET,
144        email: str | Unset = UNSET,
145        password: str | Unset = UNSET,
146        first_name: str | Unset = UNSET,
147        last_name: str | Unset = UNSET,
148        date_joined: datetime | Unset = UNSET,
149        is_staff: bool | Unset = UNSET,
150        is_active: bool | Unset = UNSET,
151        is_superuser: bool | Unset = UNSET,
152        groups: List[int] | Unset = UNSET,
153        user_permissions: List[str] | Unset = UNSET,
154    ) -> User:
155        """Partially update a user (PATCH semantics).
156
157        Only fields with a non-:data:`~easypaperless.UNSET` value are included
158        in the request body.  Omit a parameter (or pass
159        :data:`~easypaperless.UNSET`) to leave it unchanged.
160
161        Args:
162            id: Numeric ID of the user to update.
163            username: Login username.
164            email: Email address.
165            password: New password.
166            first_name: Given name.
167            last_name: Family name.
168            date_joined: Account creation timestamp.
169            is_staff: Grant or revoke staff access.
170            is_active: Activate or deactivate the account.
171            is_superuser: Grant or revoke superuser access.
172            groups: IDs of groups to assign the user to.
173            user_permissions: Directly assigned permission strings.
174
175        Returns:
176            The updated :class:`~easypaperless.models.users.User`.
177        """
178        logger.info("Updating user id=%d", id)
179        return cast(
180            User,
181            await self._core._update_resource(
182                "users",
183                id,
184                User,
185                username=username,
186                email=email,
187                password=password,
188                first_name=first_name,
189                last_name=last_name,
190                date_joined=date_joined,
191                is_staff=is_staff,
192                is_active=is_active,
193                is_superuser=is_superuser,
194                groups=groups,
195                user_permissions=user_permissions,
196            ),
197        )
198
199    async def delete(self, id: int) -> None:
200        """Delete a user.
201
202        Args:
203            id: Numeric ID of the user to delete.
204
205        Raises:
206            ~easypaperless.exceptions.NotFoundError: If no user exists with
207                that ID.
208        """
209        logger.info("Deleting user id=%d", id)
210        await self._core._delete_resource("users", id)

Accessor for users: client.users.

UsersResource(core: easypaperless.client._ClientCore)
23    def __init__(self, core: _ClientCore) -> None:
24        self._core = core
async def list( self, *, username_contains: str | easypaperless.Unset = UNSET, username_exact: str | easypaperless.Unset = UNSET, ordering: str | easypaperless.Unset = UNSET, page: int | easypaperless.Unset = UNSET, page_size: int | easypaperless.Unset = UNSET) -> easypaperless.PagedResult[User]:
26    async def list(
27        self,
28        *,
29        username_contains: str | Unset = UNSET,
30        username_exact: str | Unset = UNSET,
31        ordering: str | Unset = UNSET,
32        page: int | Unset = UNSET,
33        page_size: int | Unset = UNSET,
34    ) -> PagedResult[User]:
35        """Return users defined in paperless-ngx.
36
37        When ``page`` is ``UNSET`` (the default), all pages are fetched
38        automatically and ``next`` / ``previous`` in the result are always
39        ``None``.  When ``page`` is set, only that page is fetched and
40        ``next`` / ``previous`` reflect the raw API values.
41
42        Args:
43            username_contains: Case-insensitive substring filter on username.
44            username_exact: Case-insensitive exact match on username.
45            ordering: Field to sort by.
46            page: Return only this specific page (1-based).
47            page_size: Number of results per page.
48
49        Returns:
50            :class:`~easypaperless.models.paged_result.PagedResult` of
51            :class:`~easypaperless.models.users.User` objects.
52        """
53        logger.info("Listing users")
54        params: dict[str, Any] = {}
55        if not isinstance(username_contains, Unset):
56            params["username__icontains"] = username_contains
57        if not isinstance(username_exact, Unset):
58            params["username__iexact"] = username_exact
59        if not isinstance(ordering, Unset):
60            params["ordering"] = ordering
61        if not isinstance(page, Unset):
62            params["page"] = page
63        if not isinstance(page_size, Unset):
64            params["page_size"] = page_size
65        return cast(
66            PagedResult[User],
67            await self._core._list_resource("users", User, params or None),
68        )

Return users defined in paperless-ngx.

When page is UNSET (the default), all pages are fetched automatically and next / previous in the result are always None. When page is set, only that page is fetched and next / previous reflect the raw API values.

Arguments:
  • username_contains: Case-insensitive substring filter on username.
  • username_exact: Case-insensitive exact match on username.
  • ordering: Field to sort by.
  • page: Return only this specific page (1-based).
  • page_size: Number of results per page.
Returns:

~easypaperless.models.paged_result.PagedResult of ~easypaperless.models.users.User objects.

async def get(self, id: int) -> easypaperless.User:
70    async def get(self, id: int) -> User:
71        """Fetch a single user by their ID.
72
73        Args:
74            id: Numeric user ID.
75
76        Returns:
77            The :class:`~easypaperless.models.users.User` with the given ID.
78
79        Raises:
80            ~easypaperless.exceptions.NotFoundError: If no user exists with
81                that ID.
82        """
83        logger.info("Getting user id=%d", id)
84        return cast(User, await self._core._get_resource("users", id, User))

Fetch a single user by their ID.

Arguments:
  • id: Numeric user ID.
Returns:

The ~easypaperless.models.users.User with the given ID.

Raises:
async def create( self, *, username: str, email: str | easypaperless.Unset = UNSET, password: str | easypaperless.Unset = UNSET, first_name: str | easypaperless.Unset = UNSET, last_name: str | easypaperless.Unset = UNSET, date_joined: datetime.datetime | easypaperless.Unset = UNSET, is_staff: bool | easypaperless.Unset = UNSET, is_active: bool | easypaperless.Unset = UNSET, is_superuser: bool | easypaperless.Unset = UNSET, groups: Union[List[int], easypaperless.Unset] = UNSET, user_permissions: Union[List[str], easypaperless.Unset] = UNSET) -> easypaperless.User:
 86    async def create(
 87        self,
 88        *,
 89        username: str,
 90        email: str | Unset = UNSET,
 91        password: str | Unset = UNSET,
 92        first_name: str | Unset = UNSET,
 93        last_name: str | Unset = UNSET,
 94        date_joined: datetime | Unset = UNSET,
 95        is_staff: bool | Unset = UNSET,
 96        is_active: bool | Unset = UNSET,
 97        is_superuser: bool | Unset = UNSET,
 98        groups: List[int] | Unset = UNSET,
 99        user_permissions: List[str] | Unset = UNSET,
100    ) -> User:
101        """Create a new user.
102
103        Args:
104            username: Login username. Must be unique.
105            email: Email address.
106            password: Password for the new account.
107            first_name: Given name.
108            last_name: Family name.
109            date_joined: Account creation timestamp.
110            is_staff: Grant staff (admin UI) access.
111            is_active: Whether the account is active.
112            is_superuser: Grant unrestricted superuser access.
113            groups: IDs of groups to assign the user to.
114            user_permissions: Directly assigned permission strings.
115
116        Returns:
117            The newly created :class:`~easypaperless.models.users.User`.
118        """
119        logger.info("Creating user username=%r", username)
120        return cast(
121            User,
122            await self._core._create_resource(
123                "users",
124                User,
125                username=username,
126                email=email,
127                password=password,
128                first_name=first_name,
129                last_name=last_name,
130                date_joined=date_joined,
131                is_staff=is_staff,
132                is_active=is_active,
133                is_superuser=is_superuser,
134                groups=groups,
135                user_permissions=user_permissions,
136            ),
137        )

Create a new user.

Arguments:
  • username: Login username. Must be unique.
  • email: Email address.
  • password: Password for the new account.
  • first_name: Given name.
  • last_name: Family name.
  • date_joined: Account creation timestamp.
  • is_staff: Grant staff (admin UI) access.
  • is_active: Whether the account is active.
  • is_superuser: Grant unrestricted superuser access.
  • groups: IDs of groups to assign the user to.
  • user_permissions: Directly assigned permission strings.
Returns:

The newly created ~easypaperless.models.users.User.

async def update( self, id: int, *, username: str | easypaperless.Unset = UNSET, email: str | easypaperless.Unset = UNSET, password: str | easypaperless.Unset = UNSET, first_name: str | easypaperless.Unset = UNSET, last_name: str | easypaperless.Unset = UNSET, date_joined: datetime.datetime | easypaperless.Unset = UNSET, is_staff: bool | easypaperless.Unset = UNSET, is_active: bool | easypaperless.Unset = UNSET, is_superuser: bool | easypaperless.Unset = UNSET, groups: Union[List[int], easypaperless.Unset] = UNSET, user_permissions: Union[List[str], easypaperless.Unset] = UNSET) -> easypaperless.User:
139    async def update(
140        self,
141        id: int,
142        *,
143        username: str | Unset = UNSET,
144        email: str | Unset = UNSET,
145        password: str | Unset = UNSET,
146        first_name: str | Unset = UNSET,
147        last_name: str | Unset = UNSET,
148        date_joined: datetime | Unset = UNSET,
149        is_staff: bool | Unset = UNSET,
150        is_active: bool | Unset = UNSET,
151        is_superuser: bool | Unset = UNSET,
152        groups: List[int] | Unset = UNSET,
153        user_permissions: List[str] | Unset = UNSET,
154    ) -> User:
155        """Partially update a user (PATCH semantics).
156
157        Only fields with a non-:data:`~easypaperless.UNSET` value are included
158        in the request body.  Omit a parameter (or pass
159        :data:`~easypaperless.UNSET`) to leave it unchanged.
160
161        Args:
162            id: Numeric ID of the user to update.
163            username: Login username.
164            email: Email address.
165            password: New password.
166            first_name: Given name.
167            last_name: Family name.
168            date_joined: Account creation timestamp.
169            is_staff: Grant or revoke staff access.
170            is_active: Activate or deactivate the account.
171            is_superuser: Grant or revoke superuser access.
172            groups: IDs of groups to assign the user to.
173            user_permissions: Directly assigned permission strings.
174
175        Returns:
176            The updated :class:`~easypaperless.models.users.User`.
177        """
178        logger.info("Updating user id=%d", id)
179        return cast(
180            User,
181            await self._core._update_resource(
182                "users",
183                id,
184                User,
185                username=username,
186                email=email,
187                password=password,
188                first_name=first_name,
189                last_name=last_name,
190                date_joined=date_joined,
191                is_staff=is_staff,
192                is_active=is_active,
193                is_superuser=is_superuser,
194                groups=groups,
195                user_permissions=user_permissions,
196            ),
197        )

Partially update a user (PATCH semantics).

Only fields with a non-~easypaperless.UNSET value are included in the request body. Omit a parameter (or pass ~easypaperless.UNSET) to leave it unchanged.

Arguments:
  • id: Numeric ID of the user to update.
  • username: Login username.
  • email: Email address.
  • password: New password.
  • first_name: Given name.
  • last_name: Family name.
  • date_joined: Account creation timestamp.
  • is_staff: Grant or revoke staff access.
  • is_active: Activate or deactivate the account.
  • is_superuser: Grant or revoke superuser access.
  • groups: IDs of groups to assign the user to.
  • user_permissions: Directly assigned permission strings.
Returns:

The updated ~easypaperless.models.users.User.

async def delete(self, id: int) -> None:
199    async def delete(self, id: int) -> None:
200        """Delete a user.
201
202        Args:
203            id: Numeric ID of the user to delete.
204
205        Raises:
206            ~easypaperless.exceptions.NotFoundError: If no user exists with
207                that ID.
208        """
209        logger.info("Deleting user id=%d", id)
210        await self._core._delete_resource("users", id)

Delete a user.

Arguments:
  • id: Numeric ID of the user to delete.
Raises:
class SyncUsersResource:
 17class SyncUsersResource:
 18    """Sync accessor for users: ``client.users``."""
 19
 20    def __init__(self, async_users: UsersResource, run: Any) -> None:
 21        self._async_users = async_users
 22        self._run = run
 23
 24    def list(
 25        self,
 26        *,
 27        username_contains: str | Unset = UNSET,
 28        username_exact: str | Unset = UNSET,
 29        ordering: str | Unset = UNSET,
 30        page: int | Unset = UNSET,
 31        page_size: int | Unset = UNSET,
 32    ) -> PagedResult[User]:
 33        """Return users defined in paperless-ngx.
 34
 35        When ``page`` is ``UNSET`` (the default), all pages are fetched
 36        automatically and ``next`` / ``previous`` in the result are always
 37        ``None``.  When ``page`` is set, only that page is fetched and
 38        ``next`` / ``previous`` reflect the raw API values.
 39
 40        Args:
 41            username_contains: Case-insensitive substring filter on username.
 42            username_exact: Case-insensitive exact match on username.
 43            ordering: Field to sort by.
 44            page: Return only this specific page (1-based).
 45            page_size: Number of results per page.
 46
 47        Returns:
 48            :class:`~easypaperless.models.paged_result.PagedResult` of
 49            :class:`~easypaperless.models.users.User` objects.
 50        """
 51        return cast(
 52            PagedResult[User],
 53            self._run(
 54                self._async_users.list(
 55                    username_contains=username_contains,
 56                    username_exact=username_exact,
 57                    ordering=ordering,
 58                    page=page,
 59                    page_size=page_size,
 60                )
 61            ),
 62        )
 63
 64    def get(self, id: int) -> User:
 65        """Fetch a single user by their ID.
 66
 67        Args:
 68            id: Numeric user ID.
 69
 70        Returns:
 71            The :class:`~easypaperless.models.users.User` with the given ID.
 72
 73        Raises:
 74            ~easypaperless.exceptions.NotFoundError: If no user exists with
 75                that ID.
 76        """
 77        return cast(User, self._run(self._async_users.get(id)))
 78
 79    def create(
 80        self,
 81        *,
 82        username: str,
 83        email: str | Unset = UNSET,
 84        password: str | Unset = UNSET,
 85        first_name: str | Unset = UNSET,
 86        last_name: str | Unset = UNSET,
 87        date_joined: datetime | Unset = UNSET,
 88        is_staff: bool | Unset = UNSET,
 89        is_active: bool | Unset = UNSET,
 90        is_superuser: bool | Unset = UNSET,
 91        groups: List[int] | Unset = UNSET,
 92        user_permissions: List[str] | Unset = UNSET,
 93    ) -> User:
 94        """Create a new user.
 95
 96        Args:
 97            username: Login username. Must be unique.
 98            email: Email address.
 99            password: Password for the new account.
100            first_name: Given name.
101            last_name: Family name.
102            date_joined: Account creation timestamp.
103            is_staff: Grant staff (admin UI) access.
104            is_active: Whether the account is active.
105            is_superuser: Grant unrestricted superuser access.
106            groups: IDs of groups to assign the user to.
107            user_permissions: Directly assigned permission strings.
108
109        Returns:
110            The newly created :class:`~easypaperless.models.users.User`.
111        """
112        return cast(
113            User,
114            self._run(
115                self._async_users.create(
116                    username=username,
117                    email=email,
118                    password=password,
119                    first_name=first_name,
120                    last_name=last_name,
121                    date_joined=date_joined,
122                    is_staff=is_staff,
123                    is_active=is_active,
124                    is_superuser=is_superuser,
125                    groups=groups,
126                    user_permissions=user_permissions,
127                )
128            ),
129        )
130
131    def update(
132        self,
133        id: int,
134        *,
135        username: str | Unset = UNSET,
136        email: str | Unset = UNSET,
137        password: str | Unset = UNSET,
138        first_name: str | Unset = UNSET,
139        last_name: str | Unset = UNSET,
140        date_joined: datetime | Unset = UNSET,
141        is_staff: bool | Unset = UNSET,
142        is_active: bool | Unset = UNSET,
143        is_superuser: bool | Unset = UNSET,
144        groups: List[int] | Unset = UNSET,
145        user_permissions: List[str] | Unset = UNSET,
146    ) -> User:
147        """Partially update a user (PATCH semantics).
148
149        Only fields with a non-:data:`~easypaperless.UNSET` value are included
150        in the request body.  Omit a parameter (or pass
151        :data:`~easypaperless.UNSET`) to leave it unchanged.
152
153        Args:
154            id: Numeric ID of the user to update.
155            username: Login username.
156            email: Email address.
157            password: New password.
158            first_name: Given name.
159            last_name: Family name.
160            date_joined: Account creation timestamp.
161            is_staff: Grant or revoke staff access.
162            is_active: Activate or deactivate the account.
163            is_superuser: Grant or revoke superuser access.
164            groups: IDs of groups to assign the user to.
165            user_permissions: Directly assigned permission strings.
166
167        Returns:
168            The updated :class:`~easypaperless.models.users.User`.
169        """
170        return cast(
171            User,
172            self._run(
173                self._async_users.update(
174                    id,
175                    username=username,
176                    email=email,
177                    password=password,
178                    first_name=first_name,
179                    last_name=last_name,
180                    date_joined=date_joined,
181                    is_staff=is_staff,
182                    is_active=is_active,
183                    is_superuser=is_superuser,
184                    groups=groups,
185                    user_permissions=user_permissions,
186                )
187            ),
188        )
189
190    def delete(self, id: int) -> None:
191        """Delete a user.
192
193        Args:
194            id: Numeric ID of the user to delete.
195
196        Raises:
197            ~easypaperless.exceptions.NotFoundError: If no user exists with
198                that ID.
199        """
200        self._run(self._async_users.delete(id))

Sync accessor for users: client.users.

SyncUsersResource( async_users: UsersResource, run: Any)
20    def __init__(self, async_users: UsersResource, run: Any) -> None:
21        self._async_users = async_users
22        self._run = run
def list( self, *, username_contains: str | easypaperless.Unset = UNSET, username_exact: str | easypaperless.Unset = UNSET, ordering: str | easypaperless.Unset = UNSET, page: int | easypaperless.Unset = UNSET, page_size: int | easypaperless.Unset = UNSET) -> easypaperless.PagedResult[User]:
24    def list(
25        self,
26        *,
27        username_contains: str | Unset = UNSET,
28        username_exact: str | Unset = UNSET,
29        ordering: str | Unset = UNSET,
30        page: int | Unset = UNSET,
31        page_size: int | Unset = UNSET,
32    ) -> PagedResult[User]:
33        """Return users defined in paperless-ngx.
34
35        When ``page`` is ``UNSET`` (the default), all pages are fetched
36        automatically and ``next`` / ``previous`` in the result are always
37        ``None``.  When ``page`` is set, only that page is fetched and
38        ``next`` / ``previous`` reflect the raw API values.
39
40        Args:
41            username_contains: Case-insensitive substring filter on username.
42            username_exact: Case-insensitive exact match on username.
43            ordering: Field to sort by.
44            page: Return only this specific page (1-based).
45            page_size: Number of results per page.
46
47        Returns:
48            :class:`~easypaperless.models.paged_result.PagedResult` of
49            :class:`~easypaperless.models.users.User` objects.
50        """
51        return cast(
52            PagedResult[User],
53            self._run(
54                self._async_users.list(
55                    username_contains=username_contains,
56                    username_exact=username_exact,
57                    ordering=ordering,
58                    page=page,
59                    page_size=page_size,
60                )
61            ),
62        )

Return users defined in paperless-ngx.

When page is UNSET (the default), all pages are fetched automatically and next / previous in the result are always None. When page is set, only that page is fetched and next / previous reflect the raw API values.

Arguments:
  • username_contains: Case-insensitive substring filter on username.
  • username_exact: Case-insensitive exact match on username.
  • ordering: Field to sort by.
  • page: Return only this specific page (1-based).
  • page_size: Number of results per page.
Returns:

~easypaperless.models.paged_result.PagedResult of ~easypaperless.models.users.User objects.

def get(self, id: int) -> easypaperless.User:
64    def get(self, id: int) -> User:
65        """Fetch a single user by their ID.
66
67        Args:
68            id: Numeric user ID.
69
70        Returns:
71            The :class:`~easypaperless.models.users.User` with the given ID.
72
73        Raises:
74            ~easypaperless.exceptions.NotFoundError: If no user exists with
75                that ID.
76        """
77        return cast(User, self._run(self._async_users.get(id)))

Fetch a single user by their ID.

Arguments:
  • id: Numeric user ID.
Returns:

The ~easypaperless.models.users.User with the given ID.

Raises:
def create( self, *, username: str, email: str | easypaperless.Unset = UNSET, password: str | easypaperless.Unset = UNSET, first_name: str | easypaperless.Unset = UNSET, last_name: str | easypaperless.Unset = UNSET, date_joined: datetime.datetime | easypaperless.Unset = UNSET, is_staff: bool | easypaperless.Unset = UNSET, is_active: bool | easypaperless.Unset = UNSET, is_superuser: bool | easypaperless.Unset = UNSET, groups: Union[List[int], easypaperless.Unset] = UNSET, user_permissions: Union[List[str], easypaperless.Unset] = UNSET) -> easypaperless.User:
 79    def create(
 80        self,
 81        *,
 82        username: str,
 83        email: str | Unset = UNSET,
 84        password: str | Unset = UNSET,
 85        first_name: str | Unset = UNSET,
 86        last_name: str | Unset = UNSET,
 87        date_joined: datetime | Unset = UNSET,
 88        is_staff: bool | Unset = UNSET,
 89        is_active: bool | Unset = UNSET,
 90        is_superuser: bool | Unset = UNSET,
 91        groups: List[int] | Unset = UNSET,
 92        user_permissions: List[str] | Unset = UNSET,
 93    ) -> User:
 94        """Create a new user.
 95
 96        Args:
 97            username: Login username. Must be unique.
 98            email: Email address.
 99            password: Password for the new account.
100            first_name: Given name.
101            last_name: Family name.
102            date_joined: Account creation timestamp.
103            is_staff: Grant staff (admin UI) access.
104            is_active: Whether the account is active.
105            is_superuser: Grant unrestricted superuser access.
106            groups: IDs of groups to assign the user to.
107            user_permissions: Directly assigned permission strings.
108
109        Returns:
110            The newly created :class:`~easypaperless.models.users.User`.
111        """
112        return cast(
113            User,
114            self._run(
115                self._async_users.create(
116                    username=username,
117                    email=email,
118                    password=password,
119                    first_name=first_name,
120                    last_name=last_name,
121                    date_joined=date_joined,
122                    is_staff=is_staff,
123                    is_active=is_active,
124                    is_superuser=is_superuser,
125                    groups=groups,
126                    user_permissions=user_permissions,
127                )
128            ),
129        )

Create a new user.

Arguments:
  • username: Login username. Must be unique.
  • email: Email address.
  • password: Password for the new account.
  • first_name: Given name.
  • last_name: Family name.
  • date_joined: Account creation timestamp.
  • is_staff: Grant staff (admin UI) access.
  • is_active: Whether the account is active.
  • is_superuser: Grant unrestricted superuser access.
  • groups: IDs of groups to assign the user to.
  • user_permissions: Directly assigned permission strings.
Returns:

The newly created ~easypaperless.models.users.User.

def update( self, id: int, *, username: str | easypaperless.Unset = UNSET, email: str | easypaperless.Unset = UNSET, password: str | easypaperless.Unset = UNSET, first_name: str | easypaperless.Unset = UNSET, last_name: str | easypaperless.Unset = UNSET, date_joined: datetime.datetime | easypaperless.Unset = UNSET, is_staff: bool | easypaperless.Unset = UNSET, is_active: bool | easypaperless.Unset = UNSET, is_superuser: bool | easypaperless.Unset = UNSET, groups: Union[List[int], easypaperless.Unset] = UNSET, user_permissions: Union[List[str], easypaperless.Unset] = UNSET) -> easypaperless.User:
131    def update(
132        self,
133        id: int,
134        *,
135        username: str | Unset = UNSET,
136        email: str | Unset = UNSET,
137        password: str | Unset = UNSET,
138        first_name: str | Unset = UNSET,
139        last_name: str | Unset = UNSET,
140        date_joined: datetime | Unset = UNSET,
141        is_staff: bool | Unset = UNSET,
142        is_active: bool | Unset = UNSET,
143        is_superuser: bool | Unset = UNSET,
144        groups: List[int] | Unset = UNSET,
145        user_permissions: List[str] | Unset = UNSET,
146    ) -> User:
147        """Partially update a user (PATCH semantics).
148
149        Only fields with a non-:data:`~easypaperless.UNSET` value are included
150        in the request body.  Omit a parameter (or pass
151        :data:`~easypaperless.UNSET`) to leave it unchanged.
152
153        Args:
154            id: Numeric ID of the user to update.
155            username: Login username.
156            email: Email address.
157            password: New password.
158            first_name: Given name.
159            last_name: Family name.
160            date_joined: Account creation timestamp.
161            is_staff: Grant or revoke staff access.
162            is_active: Activate or deactivate the account.
163            is_superuser: Grant or revoke superuser access.
164            groups: IDs of groups to assign the user to.
165            user_permissions: Directly assigned permission strings.
166
167        Returns:
168            The updated :class:`~easypaperless.models.users.User`.
169        """
170        return cast(
171            User,
172            self._run(
173                self._async_users.update(
174                    id,
175                    username=username,
176                    email=email,
177                    password=password,
178                    first_name=first_name,
179                    last_name=last_name,
180                    date_joined=date_joined,
181                    is_staff=is_staff,
182                    is_active=is_active,
183                    is_superuser=is_superuser,
184                    groups=groups,
185                    user_permissions=user_permissions,
186                )
187            ),
188        )

Partially update a user (PATCH semantics).

Only fields with a non-~easypaperless.UNSET value are included in the request body. Omit a parameter (or pass ~easypaperless.UNSET) to leave it unchanged.

Arguments:
  • id: Numeric ID of the user to update.
  • username: Login username.
  • email: Email address.
  • password: New password.
  • first_name: Given name.
  • last_name: Family name.
  • date_joined: Account creation timestamp.
  • is_staff: Grant or revoke staff access.
  • is_active: Activate or deactivate the account.
  • is_superuser: Grant or revoke superuser access.
  • groups: IDs of groups to assign the user to.
  • user_permissions: Directly assigned permission strings.
Returns:

The updated ~easypaperless.models.users.User.

def delete(self, id: int) -> None:
190    def delete(self, id: int) -> None:
191        """Delete a user.
192
193        Args:
194            id: Numeric ID of the user to delete.
195
196        Raises:
197            ~easypaperless.exceptions.NotFoundError: If no user exists with
198                that ID.
199        """
200        self._run(self._async_users.delete(id))

Delete a user.

Arguments:
  • id: Numeric ID of the user to delete.
Raises:
class TrashResource:
19class TrashResource:
20    """Accessor for the trash bin: ``client.trash``."""
21
22    def __init__(self, core: _ClientCore) -> None:
23        self._core = core
24
25    async def list(
26        self,
27        *,
28        page: int | Unset = UNSET,
29        page_size: int | Unset = UNSET,
30    ) -> PagedResult[Document]:
31        """Return all documents currently in the trash.
32
33        When ``page`` is ``UNSET`` (the default), all pages are fetched
34        automatically and ``next`` / ``previous`` in the result are always
35        ``None``.  When ``page`` is set, only that page is fetched and
36        ``next`` / ``previous`` reflect the raw API values.
37
38        Args:
39            page: Return only this specific page (1-based).
40            page_size: Number of results per page.
41
42        Returns:
43            :class:`~easypaperless.models.paged_result.PagedResult` of
44            :class:`~easypaperless.models.documents.Document` objects currently
45            in the trash.
46        """
47        logger.info("Listing trashed documents")
48        params: dict[str, Any] = {}
49        if not isinstance(page, Unset):
50            params["page"] = page
51        if not isinstance(page_size, Unset):
52            params["page_size"] = page_size
53        return cast(
54            PagedResult[Document],
55            await self._core._list_resource("trash", Document, params or None),
56        )
57
58    async def restore(self, document_ids: List[int]) -> None:
59        """Restore trashed documents back to active status.
60
61        Args:
62            document_ids: List of numeric document IDs to restore.
63        """
64        logger.info("Restoring %d trashed document(s)", len(document_ids))
65        await self._core._session.post(
66            "/trash/",
67            json={"documents": document_ids, "action": "restore"},
68        )
69
70    async def empty(self, document_ids: List[int]) -> None:
71        """Permanently delete trashed documents.
72
73        .. warning::
74            **This operation is irreversible and cannot be undone.**
75            The documents will be permanently removed and cannot be recovered.
76
77        Args:
78            document_ids: List of numeric document IDs to permanently delete.
79        """
80        logger.info("Permanently deleting %d trashed document(s)", len(document_ids))
81        await self._core._session.post(
82            "/trash/",
83            json={"documents": document_ids, "action": "empty"},
84        )

Accessor for the trash bin: client.trash.

TrashResource(core: easypaperless.client._ClientCore)
22    def __init__(self, core: _ClientCore) -> None:
23        self._core = core
async def list( self, *, page: int | easypaperless.Unset = UNSET, page_size: int | easypaperless.Unset = UNSET) -> easypaperless.PagedResult[Document]:
25    async def list(
26        self,
27        *,
28        page: int | Unset = UNSET,
29        page_size: int | Unset = UNSET,
30    ) -> PagedResult[Document]:
31        """Return all documents currently in the trash.
32
33        When ``page`` is ``UNSET`` (the default), all pages are fetched
34        automatically and ``next`` / ``previous`` in the result are always
35        ``None``.  When ``page`` is set, only that page is fetched and
36        ``next`` / ``previous`` reflect the raw API values.
37
38        Args:
39            page: Return only this specific page (1-based).
40            page_size: Number of results per page.
41
42        Returns:
43            :class:`~easypaperless.models.paged_result.PagedResult` of
44            :class:`~easypaperless.models.documents.Document` objects currently
45            in the trash.
46        """
47        logger.info("Listing trashed documents")
48        params: dict[str, Any] = {}
49        if not isinstance(page, Unset):
50            params["page"] = page
51        if not isinstance(page_size, Unset):
52            params["page_size"] = page_size
53        return cast(
54            PagedResult[Document],
55            await self._core._list_resource("trash", Document, params or None),
56        )

Return all documents currently in the trash.

When page is UNSET (the default), all pages are fetched automatically and next / previous in the result are always None. When page is set, only that page is fetched and next / previous reflect the raw API values.

Arguments:
  • page: Return only this specific page (1-based).
  • page_size: Number of results per page.
Returns:

~easypaperless.models.paged_result.PagedResult of ~easypaperless.models.documents.Document objects currently in the trash.

async def restore(self, document_ids: List[int]) -> None:
58    async def restore(self, document_ids: List[int]) -> None:
59        """Restore trashed documents back to active status.
60
61        Args:
62            document_ids: List of numeric document IDs to restore.
63        """
64        logger.info("Restoring %d trashed document(s)", len(document_ids))
65        await self._core._session.post(
66            "/trash/",
67            json={"documents": document_ids, "action": "restore"},
68        )

Restore trashed documents back to active status.

Arguments:
  • document_ids: List of numeric document IDs to restore.
async def empty(self, document_ids: List[int]) -> None:
70    async def empty(self, document_ids: List[int]) -> None:
71        """Permanently delete trashed documents.
72
73        .. warning::
74            **This operation is irreversible and cannot be undone.**
75            The documents will be permanently removed and cannot be recovered.
76
77        Args:
78            document_ids: List of numeric document IDs to permanently delete.
79        """
80        logger.info("Permanently deleting %d trashed document(s)", len(document_ids))
81        await self._core._session.post(
82            "/trash/",
83            json={"documents": document_ids, "action": "empty"},
84        )

Permanently delete trashed documents.

This operation is irreversible and cannot be undone. The documents will be permanently removed and cannot be recovered.

Arguments:
  • document_ids: List of numeric document IDs to permanently delete.
class SyncTrashResource:
16class SyncTrashResource:
17    """Sync accessor for the trash bin: ``client.trash``."""
18
19    def __init__(self, async_trash: TrashResource, run: Any) -> None:
20        self._async_trash = async_trash
21        self._run = run
22
23    def list(
24        self,
25        *,
26        page: int | Unset = UNSET,
27        page_size: int | Unset = UNSET,
28    ) -> PagedResult[Document]:
29        """Return all documents currently in the trash.
30
31        When ``page`` is ``UNSET`` (the default), all pages are fetched
32        automatically and ``next`` / ``previous`` in the result are always
33        ``None``.  When ``page`` is set, only that page is fetched and
34        ``next`` / ``previous`` reflect the raw API values.
35
36        Args:
37            page: Return only this specific page (1-based).
38            page_size: Number of results per page.
39
40        Returns:
41            :class:`~easypaperless.models.paged_result.PagedResult` of
42            :class:`~easypaperless.models.documents.Document` objects currently
43            in the trash.
44        """
45        return cast(
46            PagedResult[Document],
47            self._run(self._async_trash.list(page=page, page_size=page_size)),
48        )
49
50    def restore(self, document_ids: List[int]) -> None:
51        """Restore trashed documents back to active status.
52
53        Args:
54            document_ids: List of numeric document IDs to restore.
55        """
56        self._run(self._async_trash.restore(document_ids))
57
58    def empty(self, document_ids: List[int]) -> None:
59        """Permanently delete trashed documents.
60
61        .. warning::
62            **This operation is irreversible and cannot be undone.**
63            The documents will be permanently removed and cannot be recovered.
64
65        Args:
66            document_ids: List of numeric document IDs to permanently delete.
67        """
68        self._run(self._async_trash.empty(document_ids))

Sync accessor for the trash bin: client.trash.

SyncTrashResource( async_trash: TrashResource, run: Any)
19    def __init__(self, async_trash: TrashResource, run: Any) -> None:
20        self._async_trash = async_trash
21        self._run = run
def list( self, *, page: int | easypaperless.Unset = UNSET, page_size: int | easypaperless.Unset = UNSET) -> easypaperless.PagedResult[Document]:
23    def list(
24        self,
25        *,
26        page: int | Unset = UNSET,
27        page_size: int | Unset = UNSET,
28    ) -> PagedResult[Document]:
29        """Return all documents currently in the trash.
30
31        When ``page`` is ``UNSET`` (the default), all pages are fetched
32        automatically and ``next`` / ``previous`` in the result are always
33        ``None``.  When ``page`` is set, only that page is fetched and
34        ``next`` / ``previous`` reflect the raw API values.
35
36        Args:
37            page: Return only this specific page (1-based).
38            page_size: Number of results per page.
39
40        Returns:
41            :class:`~easypaperless.models.paged_result.PagedResult` of
42            :class:`~easypaperless.models.documents.Document` objects currently
43            in the trash.
44        """
45        return cast(
46            PagedResult[Document],
47            self._run(self._async_trash.list(page=page, page_size=page_size)),
48        )

Return all documents currently in the trash.

When page is UNSET (the default), all pages are fetched automatically and next / previous in the result are always None. When page is set, only that page is fetched and next / previous reflect the raw API values.

Arguments:
  • page: Return only this specific page (1-based).
  • page_size: Number of results per page.
Returns:

~easypaperless.models.paged_result.PagedResult of ~easypaperless.models.documents.Document objects currently in the trash.

def restore(self, document_ids: List[int]) -> None:
50    def restore(self, document_ids: List[int]) -> None:
51        """Restore trashed documents back to active status.
52
53        Args:
54            document_ids: List of numeric document IDs to restore.
55        """
56        self._run(self._async_trash.restore(document_ids))

Restore trashed documents back to active status.

Arguments:
  • document_ids: List of numeric document IDs to restore.
def empty(self, document_ids: List[int]) -> None:
58    def empty(self, document_ids: List[int]) -> None:
59        """Permanently delete trashed documents.
60
61        .. warning::
62            **This operation is irreversible and cannot be undone.**
63            The documents will be permanently removed and cannot be recovered.
64
65        Args:
66            document_ids: List of numeric document IDs to permanently delete.
67        """
68        self._run(self._async_trash.empty(document_ids))

Permanently delete trashed documents.

This operation is irreversible and cannot be undone. The documents will be permanently removed and cannot be recovered.

Arguments:
  • document_ids: List of numeric document IDs to permanently delete.