Skip to navigation

How to list envelope documents

View as Markdown

This topic demonstrates how to retrieve a list of all documents within a specific envelope.

Run this code example from our Quickstart or launcher projects: Bash, C#, Java, Node.js, PHP, PowerShell, Python, or Ruby.

Required data

Running the code in this how-to requires this data:

Data elementDescription
{API_ACCOUNT_ID}A GUID value that identifies your account. This value is automatically generated by Docusign for any account you create. Copy the value from the API Account ID field on the Apps and Keys page.
{BASE_PATH}A string value that forms the root of the URL required to make API calls. The base path value in the example code is set to target the developer environment at
https://<domain>/restapi
Where <domain> is demo.docusign.net for the developer environment and is the result of the GetUserInfo call in production.
{ENVELOPE_ID}A GUID value that identifies a Docusign envelope. This value is automatically generated by Docusign when the envelope is created.

Step 1. Obtain your OAuth token

To make the API call shown in this how-to, you need a valid OAuth access token. Docusign supports access tokens for three different recommended OAuth grant types: Public Authorization Code Grant, Confidential Authorization Code Grant, and JSON Web Token (JWT) Grant. Choose the OAuth grant type appropriate for your scenario.

See Confidential Authorization Code Grant for guidance on your options to get an Confidential Authorization Code Grant OAuth token.

Three icons that represent the three methods a user can use to obtain an OAuth token: JSON Web Token (JWT), Public Authorization Code Grant (ACG), and Confidential Authorization Code grant

Step 2. Construct your API headers

After you have a valid OAuth access token, you are ready to construct the API headers that you will pass to the API call. Construct your headers like this, but make sure to substitute your valid OAuth access token for {ACCESS_TOKEN}.

declare -a Headers=('--header' "Authorization: Bearer ${ACCESS_TOKEN}" \
'--header' "Accept: application/json" \
'--header' "Content-Type: application/json")

Step 3. Call the eSignature REST API

Now that you have constructed your API headers, make a GET request to the EnvelopeDocuments:list endpoint to retrieve a list of documents associated with the envelope. Here’s how you make the call, but make sure to substitute your API account ID for {ACCOUNT_ID}

and envelope ID for {ENVELOPE_ID}.

View the source code for this how-to on GitHub: Bash, C#, Java, Node.js, PHP, PowerShell, Python, or Ruby.

Status=$(curl -w '%{http_code}' -i --request GET ${base_path}/v2.1/accounts/${account_id}/envelopes/${envelope_id}/documents \
"${Headers[@]}" \
--output ${response})

Expected response

You should see a JSON response similar to this.

Sample response
{
envelopeDocuments: [
{
authoritativeCopy: "false",
availableDocumentTypes: [
{
isDefault: "true",
type: "electronic"
}
],
display: "inline",
documentId: "1",
documentIdGuid: "b6147d46-xxxx-xxxx-xxxx-7cd8da971230",
includeInDownload: "true",
name: "Order acknowledgement",
order: "1",
pages: [
{
dpi: "72",
height: "792",
pageId: "b2ebef6c-xxxx-xxxx-xxxx-eb4ed06f918b",
sequence: "1",
width: "612"
}
],
signerMustAcknowledge: "no_interaction",
templateRequired: "false",
type: "content",
uri: "/envelopes/81341b15-xxxx-xxxx-xxxx-b82494460f49/documents/1"
},
{
authoritativeCopy: "false",
availableDocumentTypes: [
{
isDefault: "true",
type: "electronic"
}
],
display: "inline",
documentId: "2",
documentIdGuid: "223999d0-xxxx-xxxx-xxxx-8e99cac3fded",
includeInDownload: "true",
name: "Battle Plan",
order: "2",
pages: [
{
dpi: "72",
height: "792",
pageId: "11f16d3e-xxxx-xxxx-xxxx-194f126a1638",
sequence: "1",
width: "612"
}
],
signerMustAcknowledge: "no_interaction",
templateRequired: "false",
type: "content",
uri: "/envelopes/81341b15-xxxx-xxxx-xxxx-b82494460f49/documents/2"
},
{
authoritativeCopy: "false",
availableDocumentTypes: [
{
isDefault: "true",
type: "electronic"
}
],
display: "inline",
documentId: "3",
documentIdGuid: "05152624-xxxx-xxxx-xxxx-a7e90fd97abc",
includeInDownload: "true",
name: "Lorem Ipsum",
order: "3",
pages: [
{
dpi: "72",
height: "792",
pageId: "acc3abe1-xxxx-xxxx-xxxx-557700b91e28",
sequence: "1",
width: "612"
}
],
signerMustAcknowledge: "no_interaction",
templateRequired: "false",
type: "content",
uri: "/envelopes/81341b15-xxxx-xxxx-xxxx-b82494460f49/documents/3"
},
{
authoritativeCopy: "false",
availableDocumentTypes: [
{
isDefault: "true",
type: "electronic"
}
],
display: "inline",
documentId: "certificate",
documentIdGuid: "426b93ef-xxxx-xxxx-xxxx-c4904f3da25b",
includeInDownload: "true",
name: "Summary",
order: "999",
signerMustAcknowledge: "no_interaction",
templateRequired: "false",
type: "summary",
uri: "/envelopes/81341b15-xxxx-xxxx-xxxx-b82494460f49/documents/certificate"
}
],
envelopeId: "81341b15-xxxx-xxxx-xxxx-b82494460f49"
}

Next steps