Skip to navigation

PurgeDocuments

View as Markdown

PurgeDocuments

This method can be used to purge completed documents from the Docusign system. When the PurgeDocuments method is used, the envelope documents are placed in a purge queue for deletion in 14 days. A warning email notification is sent to the sender and recipients associated with the envelope notifying them that the envelope document will be deleted in 14 days and providing a link to the documents. Another email is sent 7 days later with the same message. At the end of the 14-day period, the envelope documents are deleted from the system. The envelope information for the document will remain, but the documents are removed.

Note: If you set up a Document Retention policy for your account, by specifying the number of days to retain documents in the Account Preferences Features section, at the end of the retention period the documents are placed on that 14-day purge queue and the warning emails are sent. So in effect, setting Document Retention policy is the same as setting a schedule for calling PurgeDocuments.

// Create and send envelope as shown in linked code
DocuSignWeb.EnvelopeStatus status = <create and send envelope>;
// Purge the documents from the envelope
DocuSignWeb.PurgeDocumentStatus pStatus = _apiClient.PurgeDocuments(status.EnvelopeID);
// Confirm that the purge succeeded
Console.WriteLine("Purging the envelope worked? {0}", pStatus.PurgeDocumentSuccess);

Schema

NameSchema TypeDescription
EnvelopeIdDSXIdEnvelope ID to purge the documents from.

This method returns PurgeDocumentStatus upon execution completion.

PurgeDocumentsStatus

Schema

NameSchema TypeDescription
PurgeDocumentSuccessBooleanTrue if successful.
PurgeDocumentErrorStringIf PurgeDocumentSuccess is false an error description is returned.

Rules and Exceptions for PurgeDocuments

  • Envelope_Does_Not_Exist – invalid envelope ID passed. This exception will be thrown.

  • User_Lacks_Permissions - The user making the API calls must have permissions to export Authoritative Copy Documents. This exception will be thrown.

  • If PurgeDocumentSuccess returns false one of the following error conditions occurred:

  • Only the sender may remove the envelope documents.

    • Envelope is an authoritative copy, documents cannot be removed.
    • Envelope is not complete, documents cannot be removed.