> 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 get a list of agreements

> Learn how to list all agreements for a given user with the Agreement Manager API.

This topic demonstrates how to get a list of agreements with the Agreement Manager API.

> **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), [PowerShell](https://github.com/docusign/code-examples-powershell).

## 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>/v1 Where \<domain> is api-d.docusign.com for the developer environment and api.docusign.com for production. |

## 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 OAuth grant types: Authorization Code Grant, Implicit Grant, and JSON Web Token (JWT) Grant. Choose the OAuth grant type appropriate for your scenario.

Agreement Manager OAuth access tokens are the same ones used for our [eSignature REST API](/docs/esign-rest-api/esign101/auth), although you must request one or more Agreement Manager scopes to call the Agreement Manager API. The endpoint calls made in this how-to require that you request the Agreement Manager-specific `adm_store_unified_repo_read` scope when obtaining your access token.

> **Note**
>
> See [Agreement Manager Authentication](/docs/agreement-manager-api/auth) for details and the full list of Agreement Manager scopes.

![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#"
private static IamClient CreateAuthenticatedClient(string basePath, string accessToken)
{
    return IamClient.Builder()
        .WithServerUrl(basePath)
        .WithAccessToken(accessToken)
        .Build();
}
```

**`Java`**

```java title="Java"
	private static IamClient createIamClient(String accessToken) {
		return IamClient.builder()
			.accessToken(accessToken)
			.build();
	}
```

**`Node.js`**

```javascript title="Node.js"
const client = new iam.IamClient({ accessToken: args.accessToken });
```

**`PowerShell`**

```text title="PowerShell"
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.add("Authorization", "Bearer $accessToken")
$headers.add("Content-Type", "application/json")
$headers.add("Accept", "application/json")
```

## Step 3. Call the Agreement Manager API

Now that you have constructed your API headers, make a GET request to the [Agreements:getAgreementsList](/docs/agreement-manager-api/reference/agreementmanager/agreements/getagreementslist) endpoint to get a list of all agreements associated with your user. Here’s how you make the call, but make sure to substitute your API account ID for `{ACCOUNT_ID}`. The calling user is identified by the access token used to make the API call.

> **Note**
>
> View the source code for this how-to on GitHub: [Bash](https://github.com/docusign/code-examples-bash/blob/master/examples/Navigator/eg001ListAgreements.sh), [C#](https://github.com/docusign/code-examples-csharp/blob/master/launcher-csharp/Navigator/Examples/NavigatorMethods.cs), [Java](https://github.com/docusign/code-examples-java/blob/master/src/main/java/com/docusign/controller/navigator/examples/Nav001ListAgreementsController.java), [Node.js](https://github.com/docusign/code-examples-node/blob/master/lib/navigator/examples/listAgreements.js), [PowerShell](https://github.com/docusign/code-examples-powershell/blob/master/examples/Navigator/eg001ListAgreements.ps1).

**`Bash`**

```bash title="Bash"
response=$(mktemp /tmp/response-cw.XXXXXX)
Status=$(curl -w '%{http_code}' -i --ssl-no-revoke --request GET ${base_path}/accounts/${ACCOUNT_ID}/agreements \
    "${Headers[@]}" \
    --output ${response})
```

**`C#`**

```csharp title="C#"
public static async Task<AgreementsResponse> ListAgreementsWithIamClient(
    string basePath, string accessToken, string accountId)
{
    var client = CreateAuthenticatedClient(basePath, accessToken);
    return await client.AgreementManager.Agreements.GetAgreementsListAsync(new GetAgreementsListRequest
    {
        AccountId = accountId,
    });
}
```

**`Java`**

```java title="Java"
protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws Exception {
    var accountId = session.getAccountId();
    var accessToken = user.getAccessToken();

    var agreements = NavigatorMethodsService.getAgreements(accountId, accessToken);
    var agreementsData = agreements.agreementsResponse().orElseThrow().data().orElseThrow();
    var jsonAgreements = NavigatorMethodsService.serializeObjectToJson(agreementsData);
```

**`Node.js`**

```javascript title="Node.js"
return await client.navigator.agreements.getAgreementsList({ accountId: args.accountId });
};

module.exports = { listAgreements };
```

**`PowerShell`**

```text title="PowerShell"
$response = New-TemporaryFile
Invoke-RestMethod `
    -Uri "${apiUri}/accounts/${accountId}/agreements" `
    -Method 'GET' `
    -Headers $headers `
    -OutFile $response

$responseContent = $(Get-Content $response | ConvertFrom-Json)
```

## Expected response

If you run this code example from our Quickstart or launcher projects, you should see a JSON response similar to the code shown.

**`Sample response`**

```json title="Sample response"
{
  "data": [
    {
      "id": "31005b43-xxxx-xxxx-xxxx-ce698f2b19a1",
      "file_name": "Lorem Ipsum",
      "type": "Miscellaneous agreement",
      "category": "Miscellaneous",
      "status": "COMPLETE",
      "provisions": {
        "effective_date": "0001-01-01",
        "expiration_date": "0001-01-01",
        "execution_date": "0001-01-01",
        "assignment_type": "SILENT",
        "assignment_termination_rights": "SILENT",
        "payment_terms_due_date": "SILENT",
        "can_charge_late_payment_fees": false
      },
      "related_agreement_documents": {},
      "languages": [
        "en"
      ],
      "source_name": "ESign",
      "source_id": "200c7caa-xxxx-xxxx-xxxx-092c75b2d7e9",
      "metadata": {
        "created_at": "2024-11-05T19:23:45.79375Z",
        "modified_at": "2024-11-05T19:27:26.72736Z"
      }
    },
    {
      "id": "a8c893b9-xxxx-xxxx-xxxx-333d80e4728f",
      "file_name": "Invoice.pdf",
      "type": "Miscellaneous agreement",
      "category": "Miscellaneous",
      "status": "COMPLETE",
      "parties": [
        {
          "id": "b6b55050-xxxx-xxxx-xxxx-ae05bb7f803e",
          "name_in_agreement": "Agreement Allison"
        },
        {
          "id": "87614888-xxxx-xxxx-xxxx-b33a4bb4c53a",
          "name_in_agreement": "COTTAGE ELECTRIC INC"
        }
      ],
      "provisions": {
        "effective_date": "2022-01-21",
        "expiration_date": "2022-02-10",
        "execution_date": "0001-01-01",
        "payment_terms_due_date": "OTHER"
      },
      "related_agreement_documents": {},
      "source_name": "UploadCenter",
      "source_id": "18d77b9d-xxxx-xxxx-xxxx-604887607b5d",
      "source_account_id": "58c5b238-xxxx-xxxx-xxxx-2085e9f577a8",
      "metadata": {
        "created_at": "2024-10-23T16:23:37.439571Z",
        "modified_at": "2024-10-23T16:23:53.736503Z"
      }
    }
  ],
  "metadata": {
    "total_items": 0,
    "response_timestamp": "2024-11-05T19:30:00.3945027Z",
    "response_duration_ms": 677
  }
}
```

## 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), [PowerShell](https://github.com/docusign/code-examples-powershell).
* Learn more about [Agreement Manager API use cases](/docs/agreement-manager-api/concepts/use-cases).
* See [How to get a specific agreement](/docs/agreement-manager-api/how-to/get-specific-agreement).