Skip to main content
Downloads a document from a DocuSign envelope, stores it, and returns a file_url. The typical use is filing a completed intake form into an EHR: this tool produces the PDF, and an EHR upload tool consumes the file_url it returns — on this platform that is advancedmd_op_ehr_upload_document, which ships separately from this tool. Read-only against DocuSign. Nothing is sent, voided or modified. See DocuSign integration for authentication and setup.

Inputs

Outputs

available_documents is returned on the same call as the download, so you do not need a separate listing step to discover what else the envelope holds. It is omitted if the listing call fails — the download is still attempted and reported.

Picking a document id

Only two ids are predictable: 1 is always the first document (the signed form), and combined is always the whole envelope merged. Everything else depends on how the template was built, so read available_documents rather than guessing. For a single-document intake packet, the default is what you want. For a multi-document envelope where the whole signed set should be filed as one attachment, use combined.

Check the envelope is completed first

Only an envelope with status completed contains signed content. Downloading from a sent or delivered envelope returns the unsigned form, which is rarely what you want and is easy to file into a chart by mistake. Call docusign_get_envelope and check is_completed before downloading.

Limits

  • 25 MB per document. Larger documents are refused rather than truncated — a clipped PDF filed into a patient record is worse than a failed step. Download oversized documents directly from DocuSign.
  • A document that arrives empty is reported as an error, not stored as a zero-byte file.

Expected errors

Storage and PHI

The document is written through the platform’s audited storage path, which emits the HIPAA S3 audit event and enforces the platform size ceiling. Signed intake forms routinely carry PHI, so this tool never bypasses that seam. If the file record cannot be created after upload, the stored object is deleted rather than left orphaned, and a failure to clean up is logged.