Skip to navigation

How to get a specific agreement

View as Markdown

This topic demonstrates how to get a specific agreement with the Agreement Manager API.

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

Required data

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

Data elementDescription
{AGREEMENT_ID}A GUID value that identifies a Docusign agreement. This value is automatically generated by Docusign for any agreement you create.
{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>/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, 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.

See Agreement Manager Authentication 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

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 Agreement Manager API

Now that you have constructed your API headers, make a GET request to the Agreements:getAgreement endpoint to get a specific agreement associated with your user. Here’s how you make the call, but make sure to substitute your API account ID for {ACCOUNT_ID} and the agreement ID for a specific agreement for {AGREEMENT_ID}.

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

response=$(mktemp /tmp/response-neg-002.XXXXXX)
Status=$(curl -w '%{http_code}' -i --request GET ${base_path}/accounts/${ACCOUNT_ID}/agreements/${AGREEMENT_ID} \
"${Headers[@]}" \
--output ${response})

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
{
"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"
}
}

Next steps