Bulk delete documents using a script

Important: The use of this script deletes all documents not connected to a process, including documents that are referenced in draft processes and process models, as the linking of documents to processes happens at publish. If the documents are deleted they cannot be recovered.

Promasters A Nintex Process Manager system administrator who administers a Nintex Promapp site and has rights to view and edit all areas of a Nintex Promapp site. can bulk delete documents in Process Manager. To use the bulk delete functionality, you must first use a script in Microsoft Excel to export a list of documents in your Process Manager tenant. You then use a tool like Postman to delete selected documents using the bulk delete API endpoint.

Export a list of documents in Process Manager

Note: You can use the bulk delete option only for documents that are not archived and those that are not attached to processes.

To get a list of your documents in Process Manager:

  1. Go to https://{{Tenant URL}}/exports/api/v1/reports/Documents/csv?includedGroups=true

    This downloads a CSV file that contains details of all the documents in your Process Manager tenant, including their unique IDs.

  2. In Microsoft Excel, open the file and click Format as Table to format the data.

  3. Under Automate, click New Script.

  4. Run the following script.

    The output provides all the document IDs in your tenant in a format that can be used by the bulk delete API.

    Note: The output lists 500 documents per page.

Bulk deleting documents using Postman

To use the Bulk Delete API, you can use any API management tool like Postman. For more information on downloading and using Postman, see the Postman help documentation.

Create a bulk delete request

  1. Open a new HTTP request.

  2. Create a DELETE request in the following format:

    DELETE: https://{{Tenant URL}}/documents/edit/BulkDeleteDocumentsAsync

  3. Under Authorization, select Bearer Token and enter the access_token.

  4. Under Body, for each document you want to delete, paste in the output from the script you ran in Excel.
    For example: {"DocumentItems":[{"DocumentUniqueId":"1bbbdfa9-f79b-4cbd-9dc0-bd2a0871ad6f"}, {"DocumentUniqueId":"8a52b855-fc90-49a1-8da0-3c3e3a543f81"}]}

    You can copy and paste the entire page output from Excel to delete up to 500 documents from the tenant at a time.

  5. Click Send

    The documents are deleted and the response lists the number of documents deleted under 'RecordsDeleted'. If any of the selected documents are attached to a process, they will not be deleted and the number will be included under 'ExcludedDocuments' in the response.