> You are reading the Docusign Developer Documentation. For clean Markdown of any page, append .md to the page URL.
>
> Documentation indexes by section:
> - APIs and SDKs: https://docusign.docs.buildwithfern.com/docs/llms.txt
> - Platform 101: https://docusign.docs.buildwithfern.com/platform/llms.txt
> - Extension Apps: https://docusign.docs.buildwithfern.com/extension-apps/llms.txt
> - Docusign CLI: https://docusign.docs.buildwithfern.com/docusign-cli/llms.txt
>
> Authentication (OAuth, JWT Grant, M2M): https://docusign.docs.buildwithfern.com/platform/auth
> Webhooks and Connect: https://docusign.docs.buildwithfern.com/platform/webhooks
>
> OpenAPI specifications: https://docusign.docs.buildwithfern.com/openapi.json
> MCP server: https://docusign.docs.buildwithfern.com/_mcp/server

# How to list envelope documents

> Demonstrates how to get data on the documents in an already-defined envelope.

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

> **Note**
>
> Run this code example from our [Quickstart](/docs/esign-rest-api/quickstart) or launcher projects: [Bash](https://github.com/docusign/code-examples-bash), [C#](https://github.com/docusign/code-examples-csharp), [Java](https://github.com/docusign/code-examples-java), [Node.js](https://github.com/docusign/code-examples-node), [PHP](https://github.com/docusign/code-examples-php), [PowerShell](https://github.com/docusign/code-examples-powershell), [Python](https://github.com/docusign/code-examples-python), or [Ruby](https://github.com/docusign/code-examples-ruby).

## Required data

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

| Data element      | Description                                                                                                                                                                                                                                                                                                            |
| ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| \{API_ACCOUNT_ID} | A [GUID](http://guid.one/) 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](https://admindemo.docusign.com/authenticate?goTo=appsAndKeys) 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](http://guid.one/) value that identifies a Docusign [envelope](/docs/esign-rest-api/esign101/concepts/envelopes). 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.

> **Note**
>
> See [Confidential Authorization Code Grant](/platform/auth/authcode#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](/_fern-files/_img/64f473773042ee439449a096bf7673292b1585b86a4ccc55f82ba0dda41f61a1.webp)

## 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}.

**`Bash`**

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

**`C#`**

```csharp title="C#"
var docuSignClient = new DocuSignClient(basePath);
docuSignClient.Configuration.DefaultHeader.Add("Authorization", "Bearer " + accessToken);
```

**`Java`**

```java title="Java"
ApiClient apiClient = createApiClient(session.getBasePath(), user.getAccessToken());
```

**`Node.js`**

```javascript title="Node.js"
let dsApiClient = new docusign.ApiClient();
dsApiClient.setBasePath(args.basePath);
dsApiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken);
```

**`PHP`**

```php title="PHP"
$config = new Configuration();
$config->setHost($args['base_path']);
$config->addDefaultHeader('Authorization', 'Bearer ' . $args['ds_access_token']);
$this->apiClient = new ApiClient($config);
```

**`PowerShell`**

```text title="PowerShell"
$headers = @{
    'Authorization' = "Bearer $accessToken";
    'Content-Type'  = "application/json";
  }
```

**`Python`**

```python title="Python"
api_client = create_api_client(base_path=args["base_path"], access_token=args["access_token"])
```

**`Ruby`**

```ruby title="Ruby"
configuration = DocuSign_eSign::Configuration.new
configuration.host = args[:base_path]
api_client = DocuSign_eSign::ApiClient.new configuration

api_client.default_headers['Authorization'] = "Bearer #{args[:access_token]}"
```

## Step 3. Call the eSignature REST API

Now that you have constructed your API headers, make a `GET` request to the [EnvelopeDocuments:list](/docs/esign-rest-api/reference/envelopes/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}.

> **Note**
>
> View the source code for this how-to on GitHub: [Bash](https://github.com/docusign/code-examples-bash/blob/master/examples/eSignature/eg006EnvelopeDocs.sh), [C#](https://github.com/docusign/code-examples-csharp/blob/master/launcher-csharp/eSignature/Examples/ListEnvelopeDocuments.cs), [Java](https://github.com/docusign/code-examples-java/blob/master/src/main/java/com/docusign/controller/eSignature/examples/EG006ControllerEnvelopeDocs.java), [Node.js](https://github.com/docusign/code-examples-node/blob/master/lib/eSignature/examples/envelopeDocs.js), [PHP](https://github.com/docusign/code-examples-php/blob/master/src/Services/Examples/eSignature/EnvelopeDocsService.php), [PowerShell](https://github.com/docusign/code-examples-powershell/blob/master/examples/eSignature/eg006EnvelopeDocs.ps1), [Python](https://github.com/docusign/code-examples-python/blob/master/app/eSignature/examples/eg006_envelope_docs.py), or [Ruby](https://github.com/docusign/code-examples-ruby/blob/main/app/services/e_sign/eg006_envelope_docs_service.rb).

**`Bash`**

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

**`C#`**

```csharp title="C#"
EnvelopesApi envelopesApi = new EnvelopesApi(docuSignClient);
var results = envelopesApi.ListDocumentsWithHttpInfo(accountId, envelopeId);
results.Headers.TryGetValue("X-RateLimit-Remaining", out string remaining);
results.Headers.TryGetValue("X-RateLimit-Reset", out string reset);

if (reset != null && remaining != null)
{
    DateTime resetDate = DateTimeOffset.FromUnixTimeSeconds(long.Parse(reset)).UtcDateTime;
    Console.WriteLine("API calls remaining: " + remaining);
    Console.WriteLine("Next Reset: " + resetDate);
}
```

**`Java`**

```java title="Java"
EnvelopeDocumentsResult envelopeDocumentsResult = EnvelopeDocsService.envelopeDocs(
        envelopesApi,
        session.getAccountId(),
        session.getEnvelopeId());
```

**`Node.js`**

```javascript title="Node.js"
let envelopesApi = new docusign.EnvelopesApi(dsApiClient);

let results = await envelopesApi.listDocuments(
  args.accountId,
  args.envelopeId,
  null,
  (error, data, response) => {
    const headers = response?.headers;

    const remaining = headers?.['x-ratelimit-remaining'];
    const reset = headers?.['x-ratelimit-reset'];

    if (remaining && reset) {
      const resetInstant = new Date(Number(reset) * 1000);

      console.log(`API calls remaining: ${remaining}`);
      console.log(`Next Reset: ${resetInstant.toISOString()}`);
    }
});
```

**`PHP`**

```php title="PHP"
$envelope_api = $clientService->getEnvelopeApi();
try {
    $listDocuments = $envelope_api->listDocumentsWithHttpInfo($args['account_id'], $args['envelope_id']);

    $remaining = $listDocuments[2]['X-RateLimit-Remaining'] ?? null;
    $reset = $listDocuments[2]['X-RateLimit-Reset'] ?? null;

    if ($remaining !== null && $reset !== null) {
        $resetInstant = (new DateTime())->setTimestamp((int)$reset);
        error_log("API calls remaining: $remaining");
        error_log("Next Reset: " . $resetInstant->format(\DateTime::ATOM));
    }
} catch (ApiException $e) {
    $clientService->showErrorTemplate($e);
    exit;
}
```

**`PowerShell`**

```text title="PowerShell"
Invoke-RestMethod `
  -Uri "${apiUri}/v2.1/accounts/${accountId}/envelopes/${envelopeId}/documents" `
  -Method 'GET' `
  -Headers $headers | ConvertTo-Json
```

**`Python`**

```python title="Python"
envelope_api = EnvelopesApi(api_client)
# Call the EnvelopeDocuments::list method
(data, status, headers) = envelope_api.list_documents_with_http_info(account_id=args["account_id"], envelope_id=args["envelope_id"])

remaining = headers.get("X-RateLimit-Remaining")
reset = headers.get("X-RateLimit-Reset")

if remaining is not None and reset is not None:
    reset_date = dt.fromtimestamp(int(reset), tz=timezone.utc)
    print(f"API calls remaining: {remaining}")
    print(f"Next Reset: {reset_date}")
```

**`Ruby`**

```ruby title="Ruby"
envelope_api = create_envelope_api(args)
results, _status, headers = envelope_api.list_documents_with_http_info args[:account_id], args[:envelope_id]

remaining = headers['X-RateLimit-Remaining']
reset = headers['X-RateLimit-Reset']

if remaining && reset
  reset_date = Time.at(reset.to_i).utc
  puts "API calls remaining: #{remaining}"
  puts "Next Reset: #{reset_date}"
end
```

## Expected response

You should see a JSON response similar to this.

**`Sample response`**

```json title="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

* Run this code example from our [Quickstart](/docs/esign-rest-api/quickstart) or launcher projects:    [Bash](https://github.com/docusign/code-examples-bash), [C#](https://github.com/docusign/code-examples-csharp), [Java](https://github.com/docusign/code-examples-java), [Node.js](https://github.com/docusign/code-examples-node), [PHP](https://github.com/docusign/code-examples-php), [PowerShell](https://github.com/docusign/code-examples-powershell), [Python](https://github.com/docusign/code-examples-python), or [Ruby](https://github.com/docusign/code-examples-ruby).
* Learn more about [documents](/docs/esign-rest-api/esign101/concepts/documents) or [envelopes](/docs/esign-rest-api/esign101/concepts/envelopes).
* See how to [Go-Live](/docs/esign-rest-api/go-live) with a completed app and find the base path for API calls in the production environment.