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.com and API calls go to https://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:

  1. Log in to your DocuSign account as an Administrator
    1. For Demo/Sandbox: https://account-d.docusign.com
    2. For Production: https://account.docusign.com
  2. Navigate to Apps and Keys:
    1. Click on Settings in the top menu bar
    2. Under Integrations, click Apps and Keys
  3. Create a New App:
    1. Click Add App and Integration Key
    2. Enter a descriptive name for your application (e.g., "Leena AI Integration")
    3. Click Create App
  4. Note the Integration Key:
    1. Copy the Integration Key (this is your Client ID)
    2. This is a GUID (32-digit hexadecimal number)
  5. Configure Authentication Settings based on your chosen method:

For OAuth 2.0 Authorization Code Grant:

  1. Under Authentication, ensure Authorization Code Grant is selected
  2. Click Add Secret Key to generate a Client Secret
  3. Copy and securely store the Secret Key (displayed only once)
  4. Under Redirect URIs, click Add URI
  5. Add the Redirect URI shown in the Leena AI connection form (see Add connection)

For OAuth 2.0 JWT Bearer:

  1. Under Service Integration, click Generate RSA
  2. Copy and securely store the RSA Private Key (displayed only once)
  3. Note your User ID (API Username):
    1. Go to Settings > Users and Groups > Users
    2. Select your user and copy the API Username (User ID)
  4. 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:

  1. On the Apps and Keys page, find My Account Information
  2. 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:

  1. Log in to your Leena AI workspace
  2. Navigate to Settings > Integrations
  3. Search for "DocuSign" and select it from the list to add its new connector
  4. Select Authentication Type:
    1. Auth type: Choose between "OAuth 2.0 authorization code grant" or "OAuth 2.0 JWT bearer"
  5. Select Environment:
    1. Environment: Choose Demo/sandbox for testing or Production for live use (defaults to Demo/sandbox)

For OAuth 2.0 Authorization Code Grant:

  1. Configure the connector:
    1. Redirect URI: Auto-generated and read-only. Copy it and add it to your DocuSign app's Redirect URIs.
    2. Integration key (client ID): Your DocuSign Integration Key
    3. Client secret: The Secret Key generated in DocuSign
    4. Account ID: Your DocuSign API Account ID
  2. Save the connector configuration
  3. Complete OAuth Flow:
    1. Click Connect or Authorize in Leena AI
    2. You'll be redirected to DocuSign authorization page
    3. Sign in to your DocuSign account if prompted
    4. Click Allow to grant permissions
    5. You'll be redirected back to Leena AI with a successful connection

For OAuth 2.0 JWT Bearer:

  1. Configure the connector:
    1. 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).
    2. Integration key (client ID): Your DocuSign Integration Key
    3. User ID (API username): The User ID for impersonation
    4. Account ID: Your DocuSign API Account ID
    5. RSA private key: The complete RSA private key in PEM format, including the -----BEGIN RSA PRIVATE KEY----- and -----END RSA PRIVATE KEY----- lines
  2. Save the connector configuration
  3. Grant Consent (required one-time):
    1. Click the authorization link provided
    2. Sign in and grant consent to the application
    3. 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

NameDescription
Email SubjectThe 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

NameDescription
Email MessageOptional message body included in the email to recipients (emailBlurb)
Brand IDBrand 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 signs
  • dateSignedTabs – auto-filled with the signing date
  • textTabs – text fields, with optional tabLabel, value, width and height

Tabs can be positioned in two ways:

  • Fixed coordinates: documentId, pageNumber, xPosition, yPosition
  • Anchor text: anchorString places the tab wherever that text appears in the document. Fine-tune with anchorXOffset, anchorYOffset and anchorUnits (pixels, inches, mms, cms). Set anchorIgnoreIfNotPresent to "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

NameDescription
Envelope IDThe 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

NameDescription
From DateStart date for filtering envelopes (Format: YYYY-MM-DD)

Optional

NameDescription
To DateEnd date for filtering envelopes (Format: YYYY-MM-DD)
Status FilterFilter by envelope status: sent, delivered, completed, declined, voided, created
CountNumber of records to return (default: 100)
Start PositionStarting 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

NameDescription
Envelope IDThe unique identifier of the envelope. Letters, numbers and hyphens only
DocumentWhich document to download (defaults to All documents – combined PDF). See options below

Document options

OptionValueDescription
All documents (combined PDF)combinedAll documents in the envelope merged into a single PDF
Certificate of completion (PDF)certificateDocuSign's certificate of completion (audit record)
All documents (ZIP archive)archiveAll documents as a ZIP file
Custom document IDcustomDownload one specific document; requires Document ID below

Optional

NameDescription
Document IDRequired 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 completionOnly 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..."
}

Did this page help you?