docusignapidocusigncompositetmplts

Replacing a document in compositeTempleate of an envelope already sent


I have an envelope that consists of compositeTemplate. There are 2 inlinteTemplates, first one contain some documents. I want to replace one of the documents. Is there any REST API that I can use and send JSON to replace the document? Example: Documents 1, 2, 3 are in a composite template. Envelope has been sent to recipient. Document 3 is a HTML document which needs to be replaced by another HTML document. I found a post that says how to replace but I don't know which REST API to call to implement this. DocuSign Rest API to replace single template document

With no clue to replace, I have tried following but did not work PUT /v2.1/accounts/{accountId}/envelopes/{envelopeId}/attachments


Solution

  • You do need a PUT but to a slightly different endpoint.

    see documentation here - https://developers.docusign.com/esign-rest-api/reference/Envelopes/EnvelopeDocuments/update

    PUT /v2.1/accounts/{accountId}/envelopes/{envelopeId}/documents/{documentId}
    

    Now finding the documentId may require you to make a GET call first to retrieve the envelope and all the documents.