DocuSign
Overview
The DocuSign connector enables your AI Colleagues to integrate with your organization's DocuSign platform, facilitating automated electronic signature workflows, envelope management, and document signing processes.
DocuSign is the leading electronic signature and agreement cloud platform that enables organizations to automate the agreement process by preparing, signing, acting on, and managing documents digitally. The DocuSign connector allows Leena AI to automate signature workflows, send documents for signing, track envelope status, download signed documents, and manage digital signing processes seamlessly.
API Details
Leena AI integrates with DocuSign via the eSignature REST API v2.1.
Documentation link: https://developers.docusign.com/docs/esign-rest-api/
Environments and base URLs
- Demo/Sandbox: Authentication uses
https://account-d.docusign.comand API calls go tohttps://demo.docusign.net. - Production: Authentication uses
https://account.docusign.com. Production accounts are hosted on different regional servers (for example, NA1, NA3, EU), so Leena AI automatically looks up the correct base URL for your Account ID on every request. You do not need to enter a base URL.
OAuth scopes requested: signature impersonation
Setup
The DocuSign connector supports two OAuth 2.0 authentication methods:
- OAuth 2.0 Authorization Code Grant: Recommended when a user is present and able to authenticate interactively
- OAuth 2.0 JWT Bearer: Recommended for server-to-server integrations without user interaction
Prerequisites
Before setting up the DocuSign connector, ensure you have:
- Administrator access to your DocuSign account
- A DocuSign Developer account (for testing) or Production account
- Access to DocuSign Admin Settings > Apps and Keys
- Access to your Leena AI workspace with connector management permissions
Get credentials
Here is how to create an Integration Key (App) in DocuSign:
- Log in to your DocuSign account as an Administrator
- For Demo/Sandbox: https://account-d.docusign.com
- For Production: https://account.docusign.com
- Navigate to Apps and Keys:
- Click on Settings in the top menu bar
- Under Integrations, click Apps and Keys
- Create a New App:
- Click Add App and Integration Key
- Enter a descriptive name for your application (e.g., "Leena AI Integration")
- Click Create App
- Note the Integration Key:
- Copy the Integration Key (this is your Client ID)
- This is a GUID (32-digit hexadecimal number)
- Configure Authentication Settings based on your chosen method:
For OAuth 2.0 Authorization Code Grant:
- Under Authentication, ensure Authorization Code Grant is selected
- Click Add Secret Key to generate a Client Secret
- Copy and securely store the Secret Key (displayed only once)
- Under Redirect URIs, click Add URI
- Add the Redirect URI shown in the Leena AI connection form (see Add connection)
For OAuth 2.0 JWT Bearer:
- Under Service Integration, click Generate RSA
- Copy and securely store the RSA Private Key (displayed only once)
- Note your User ID (API Username):
- Go to Settings > Users and Groups > Users
- Select your user and copy the API Username (User ID)
- Under Redirect URIs, click Add URI and add the Redirect URI shown in the Leena AI connection form. This is required only for the one-time consent grant; JWT authentication itself does not use it.
Note Your Account ID:
- On the Apps and Keys page, find My Account Information
- Copy the API Account ID
Use the API Account ID (GUID)The Account ID must be the GUID API Account ID from Apps and Keys, not the numeric account number. The authorizing user (or the impersonated User ID for JWT) must have access to this account. If it does not, actions return an error listing the accounts available to that user.
Add connection
Here is how to add a connection on Leena AI:
- Log in to your Leena AI workspace
- Navigate to Settings > Integrations
- Search for "DocuSign" and select it from the list to add its new connector
- Select Authentication Type:
- Auth type: Choose between "OAuth 2.0 authorization code grant" or "OAuth 2.0 JWT bearer"
- Select Environment:
- Environment: Choose Demo/sandbox for testing or Production for live use (defaults to Demo/sandbox)
For OAuth 2.0 Authorization Code Grant:
- Configure the connector:
- Redirect URI: Auto-generated and read-only. Copy it and add it to your DocuSign app's Redirect URIs.
- Integration key (client ID): Your DocuSign Integration Key
- Client secret: The Secret Key generated in DocuSign
- Account ID: Your DocuSign API Account ID
- Save the connector configuration
- Complete OAuth Flow:
- Click Connect or Authorize in Leena AI
- You'll be redirected to DocuSign authorization page
- Sign in to your DocuSign account if prompted
- Click Allow to grant permissions
- You'll be redirected back to Leena AI with a successful connection
For OAuth 2.0 JWT Bearer:
- Configure the connector:
- Redirect URI: Auto-generated and read-only. Copy it and add it to your DocuSign app's Redirect URIs (used only for the consent step).
- Integration key (client ID): Your DocuSign Integration Key
- User ID (API username): The User ID for impersonation
- Account ID: Your DocuSign API Account ID
- RSA private key: The complete RSA private key in PEM format, including the
-----BEGIN RSA PRIVATE KEY-----and-----END RSA PRIVATE KEY-----lines
- Save the connector configuration
- Grant Consent (required one-time):
- Click the authorization link provided
- Sign in and grant consent to the application
- Until consent is granted, the connection stays unauthenticated and actions return an authorization error
Test connection
The DocuSign connector supports Test connection:
- OAuth 2.0 JWT bearer: Validates the RSA private key, requests an access token, and verifies it against DocuSign. On success it shows the DocuSign user the connection is authenticated as. Common errors include an invalid private key format, missing consent (
consent_required/ invalid grant), or an invalid scope. - OAuth 2.0 authorization code grant: Validates the Integration Key and Client Secret and checks that the DocuSign OAuth endpoint for the selected environment is reachable.
Actions
The following actions are supported for the DocuSign connector:
Send Envelope for Signature
Sends an envelope containing documents for electronic signature. The Agent can leverage the tool (workflow), which has been designed to send documents for signature through DocuSign, once the user provides the document details and recipient information.
Input Parameters
Here are the input parameters required to set up this action:
Mandatory
| Name | Description |
|---|---|
| Email Subject | The subject line of the email sent to recipients |
| Documents (JSON Array) | Array of documents to be signed. Each document requires documentBase64, name, fileExtension (without the dot) and documentId |
| Recipients (JSON Object) | Object containing recipient information: signers (must sign) and optional carbonCopies (receive a copy) |
| Envelope Status | "Send now" (sent) sends immediately; "Save as draft" (created) saves the envelope without sending. Defaults to Send now |
Optional
| Name | Description |
|---|---|
| Email Message | Optional message body included in the email to recipients (emailBlurb) |
| Brand ID | Brand identifier for customizing the envelope appearance (brandId, JSON input only) |
Placing signature fields (tabs)
Each signer can have a tabs object with the following tab types:
signHereTabs– where the signer signsdateSignedTabs– auto-filled with the signing datetextTabs– text fields, with optionaltabLabel,value,widthandheight
Tabs can be positioned in two ways:
- Fixed coordinates:
documentId,pageNumber,xPosition,yPosition - Anchor text:
anchorStringplaces the tab wherever that text appears in the document. Fine-tune withanchorXOffset,anchorYOffsetandanchorUnits(pixels,inches,mms,cms). SetanchorIgnoreIfNotPresentto"true"to skip the tab when the text isn't found.
Here is a sample JSON input:
{
"emailSubject": "Please sign this agreement",
"emailBlurb": "Please review and sign the attached document at your earliest convenience.",
"documents": [
{
"documentBase64": "JVBERi0xLjQKJeLjz9M...",
"name": "Employment_Agreement.pdf",
"fileExtension": "pdf",
"documentId": "1"
}
],
"recipients": {
"signers": [
{
"email": "[email protected]",
"name": "John Doe",
"recipientId": "1",
"routingOrder": "1",
"tabs": {
"signHereTabs": [
{
"anchorString": "/sig1/",
"anchorUnits": "pixels",
"anchorXOffset": "0",
"anchorYOffset": "0",
"anchorIgnoreIfNotPresent": "false"
}
],
"dateSignedTabs": [
{
"documentId": "1",
"pageNumber": "1",
"xPosition": "200",
"yPosition": "450"
}
],
"textTabs": [
{
"documentId": "1",
"pageNumber": "1",
"xPosition": "200",
"yPosition": "500",
"tabLabel": "employee_title",
"value": "Software Engineer"
}
]
}
}
],
"carbonCopies": [
{
"email": "[email protected]",
"name": "HR Department",
"recipientId": "2",
"routingOrder": "2"
}
]
},
"status": "sent"
}Response
Upon successful creation, the action returns the envelope details including:
- Envelope ID
- Envelope URI
- Status (sent, created)
- Status date/time
Get Envelope Status
Retrieves the current status and details of a specific envelope. The Agent can leverage this tool to check the signing progress, view recipient status, and track document completion. Here are some common use cases:
- Track Signing Progress: Check if recipients have signed
- Monitor Completion: Verify when all signatures are collected
- Audit Trail: Review envelope history and status changes
- Reminder Triggers: Identify envelopes pending action
Input Parameters
Here are the input parameters required to set up this action:
Mandatory
| Name | Description |
|---|---|
| Envelope ID | The unique identifier of the envelope to retrieve status for |
Here is a sample JSON input:
{
"envelopeId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}Response
The action returns detailed envelope information including:
- Envelope ID
- Status (sent, delivered, completed, declined, voided)
- Status changed date/time
- Sender information
- Recipients and their status
- Documents included
- Created and sent timestamps
- Expiration date (if applicable)
List Envelopes
Retrieves a list of envelopes from your DocuSign account based on specified criteria. This action can be leveraged by Leena AI Orchestrator/Agent to list envelopes within a date range, filter by status, or paginate through results. Here are some common use cases:
- Daily Reports: Get all envelopes sent today
- Status Monitoring: Find all pending or completed envelopes
- Compliance Audits: Retrieve envelopes within a specific period
- Dashboard Data: Populate envelope statistics and metrics
Input Parameters
Here are the input parameters required to set up this action:
Mandatory
| Name | Description |
|---|---|
| From Date | Start date for filtering envelopes (Format: YYYY-MM-DD) |
Optional
| Name | Description |
|---|---|
| To Date | End date for filtering envelopes (Format: YYYY-MM-DD) |
| Status Filter | Filter by envelope status: sent, delivered, completed, declined, voided, created |
| Count | Number of records to return (default: 100) |
| Start Position | Starting position for pagination (default: 0) |
Here is a sample JSON input:
{
"fromDate": "2025-01-01",
"toDate": "2025-01-31",
"status": "completed",
"count": "50",
"startPosition": "0"
}Response
The action returns a list of envelopes, each containing:
- Envelope ID
- Status
- Email subject
- Sender information
- Sent date/time
- Completed date/time (if applicable)
- Recipient information summary
- Total result set size
- Next page URI (for pagination)
Get Signed Document
Downloads a document from an envelope as base64-encoded content. The Agent can leverage this tool to fetch the signed copy of an agreement once all recipients have signed, or to retrieve the certificate of completion for audit purposes. Here are some common use cases:
- Archive Signed Agreements: Store the final signed PDF in an HRIS, DMS or ticket
- Share with Employees: Send the signed copy back to the employee after signing
- Compliance Records: Retrieve the certificate of completion as the audit trail
- Bulk Export: Download all envelope documents as a single ZIP archive
Input Parameters
Here are the input parameters required to set up this action:
Mandatory
| Name | Description |
|---|---|
| Envelope ID | The unique identifier of the envelope. Letters, numbers and hyphens only |
| Document | Which document to download (defaults to All documents – combined PDF). See options below |
Document options
| Option | Value | Description |
|---|---|---|
| All documents (combined PDF) | combined | All documents in the envelope merged into a single PDF |
| Certificate of completion (PDF) | certificate | DocuSign's certificate of completion (audit record) |
| All documents (ZIP archive) | archive | All documents as a ZIP file |
| Custom document ID | custom | Download one specific document; requires Document ID below |
Optional
| Name | Description |
|---|---|
| Document ID | Required when Document is "Custom document ID". The document's ID within the envelope as returned by Get Envelope Status (e.g. 1) |
| Include certificate of completion | Only for "All documents (combined PDF)". Appends the certificate of completion to the combined PDF (default: false) |
Availability rules
- Signed documents (combined, archive or a specific document) are available only when the envelope status is completed. For envelopes that are still in progress, the action returns an error with the current status instead of an unsigned copy.
- For declined or voided envelopes there is no signed document; request the certificate of completion instead.
- The certificate of completion is available once the envelope reaches a final state: completed, declined or voided.
Here is a sample JSON input:
{
"envelopeId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"documentId": "combined",
"includeCertificate": true
}To download a specific document:
{
"envelopeId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"documentId": "custom",
"customDocumentId": "1"
}Response
The action returns:
- Envelope ID
- Envelope status
- Completed date/time
- Document ID
- File name
- Content type (e.g.
application/pdf,application/zip) - Content (base64-encoded file)
Here is a sample response:
{
"envelopeId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"envelopeStatus": "completed",
"completedDateTime": "2025-01-15T10:32:11.0000000Z",
"documentId": "combined",
"fileName": "Employment_Agreement.pdf",
"contentType": "application/pdf",
"content": "JVBERi0xLjQKJeLjz9M..."
}Updated 22 days ago
