agent: |
OyNZsjzqOdYfhVKUhzrFList All Docusign Templates
List All Docusign Templates
There was a problem that the LLM was not able to address. Please rephrase your prompt and try again.
Fetch and display a list of all templates available in the specified DocuSign account.
inputs
outputs
import requests
# Configuration
base_url = "https://demo.docusign.net/restapi" # For production, use https://www.docusign.net/restapi
# Endpoint to list templates
url = f"{base_url}/v2.1/accounts/{account_id}/templates"
# Headers with the access token
headers = {
"Authorization": f"Bearer {access_token}",
"Content-Type": "application/json"
}
# Make the API call
response = requests.get(url, headers=headers)
# Handle the response
if response.status_code == 200:
templates = response.json()
envelope_templates = templates.get("envelopeTemplates", [])
if envelope_templates:
print("Templates List:")
for template in envelope_templates:
print(f"ID: {template['templateId']}, Name: {template['name']}")
else:
print("No templates found in the account.")
else:
print("Error:", response.json())
copied