SDKs overview

DocuSign API provides Software Development Kits (SDKs) and libraries designed to facilitate the integration of its e-signature and document workflow capabilities into various applications. These SDKs abstract much of the complexity of interacting directly with the DocuSign eSignature REST API, handling details such as OAuth 2.0 authentication, request payload construction, and response parsing. By using an SDK, developers can focus on application logic rather than low-level HTTP client implementation.

DocuSign maintains official SDKs for several popular programming languages, ensuring compatibility and support for the latest API features. These official libraries are regularly updated to reflect changes and improvements in the DocuSign platform. Beyond official offerings, a community of developers contributes to and maintains various tools and libraries that can further extend integration possibilities, although these may not carry the same level of official support or guarantees.

The primary benefit of using an SDK is reduced development time and effort. For example, methods for creating an envelope, adding recipients, sending documents, and retrieving status updates are encapsulated within intuitive functions, requiring fewer lines of code compared to making raw HTTP requests. This standardization also helps ensure best practices for API usage and error handling are followed.

Official SDKs by language

DocuSign offers official SDKs for a range of programming languages, each providing a native-like interface to the DocuSign eSignature REST API. These SDKs are maintained by DocuSign and are the recommended path for integrating DocuSign functionality.

Language Package/Repository Install Command Example Maturity
C# DocuSign.eSign.dll (NuGet) dotnet add package DocuSign.eSign Generally Available
Java docusign-esign-java (Maven/Gradle) implementation 'com.docusign:docusign-esign-java:x.x.x' Generally Available
Node.js docusign-esign (npm) npm install docusign-esign Generally Available
PHP docusign/esign-client (Composer) composer require docusign/esign-client Generally Available
Python docusign-esign (pip) pip install docusign-esign Generally Available
Ruby docusign_esign (Gem) gem install docusign_esign Generally Available

Each SDK is designed to align with common developer practices for its respective ecosystem. For example, the Python SDK follows PEP 8 style guidelines, while the Java SDK adheres to standard Java coding conventions. This consistency helps developers onboard quickly and maintain code effectively. Detailed information and release notes for each SDK are available on the DocuSign Developer Center SDKs page.

Installation

Installation of DocuSign SDKs typically follows the standard package management procedures for each language. The examples below illustrate common installation methods.

C# (.NET)

For C# projects, the DocuSign eSign SDK is available via NuGet. You can install it using the .NET CLI or the NuGet Package Manager in Visual Studio.

dotnet add package DocuSign.eSign

Java

For Java projects, you can add the DocuSign eSign Java SDK as a dependency using Maven or Gradle.

Maven:

<dependency>
    <groupId>com.docusign</groupId>
    <artifactId>docusign-esign-java</artifactId>
    <version>x.x.x</version>
</dependency>

Gradle:

implementation 'com.docusign:docusign-esign-java:x.x.x'

Replace x.x.x with the latest stable version number, which can be found on the DocuSign eSignature SDKs documentation.

Node.js

The Node.js SDK is available on npm and can be installed using the npm package manager.

npm install docusign-esign

PHP

For PHP projects, the DocuSign eSign PHP Client is available via Composer.

composer require docusign/esign-client

Python

The Python SDK can be installed using pip, the Python package installer.

pip install docusign-esign

Ruby

For Ruby projects, the DocuSign eSign Ruby Gem is available via RubyGems.

gem install docusign_esign

After installation, you will need to configure your application with appropriate authentication credentials, typically obtained through the DocuSign developer sandbox or production environment. The DocuSign OAuth 2.0 overview details the supported authentication flows.

Quickstart example

This Python example demonstrates how to use the DocuSign eSign Python SDK to create and send an envelope with a document for signing. This assumes you have already set up OAuth 2.0 authentication and have an access token.

import docusign_esign as ds
from docusign_esign.client.api_exception import ApiException

# Configuration settings (replace with your actual values)
client_id = "YOUR_CLIENT_ID"
client_secret = "YOUR_CLIENT_SECRET"
private_key_file = "private.key"
account_id = "YOUR_ACCOUNT_ID"
user_id = "YOUR_USER_ID" # The API user's GUID
base_path = "https://demo.docusign.net/restapi" # Use demo for sandbox

def create_envelope_definition(signer_email, signer_name, cc_email, cc_name, doc_base64):
    # Create a document model
    document = ds.Document(
        document_base64=doc_base64,
        document_id="1",
        file_extension="pdf",
        name="Test Document"
    )

    # Create a signer recipient model
    signer = ds.Signer(
        email=signer_email,
        name=signer_name,
        recipient_id="1",
        routing_order="1"
    )

    # Create a carbon copy recipient model
    cc = ds.CarbonCopy(
        email=cc_email,
        name=cc_name,
        recipient_id="2",
        routing_order="2"
    )

    # Create a sign_here tab model
    sign_here = ds.SignHere(document_id="1", page_number="1", x_position="100", y_position="100")
    signer.tabs = ds.Tabs(sign_here_tabs=[sign_here])

    # Add the recipients and document to the envelope
    recipients = ds.Recipients(signers=[signer], carbon_copies=[cc])
    envelope_definition = ds.EnvelopeDefinition(
        email_subject="Please sign this document",
        documents=[document],
        recipients=recipients,
        status="sent" # Set to 'sent' to send the envelope immediately
    )

    return envelope_definition

def send_envelope():
    try:
        # 1. Obtain an access token (example using JWT Grant flow, actual implementation more complex)
        # For a full JWT Grant example, refer to the DocuSign Python SDK examples
        # This simplified snippet assumes you have a valid access token.
        # More details on JWT Grant are available in the DocuSign developer documentation.
        # A typical JWT flow involves creating a JWT, requesting a token, and then refreshing it.
        # Example of getting an access token (simplified placeholder for this quickstart)
        # In a real application, you'd use a robust OAuth client library.
        # This would involve: jwt_grant_token = get_jwt_access_token(client_id, user_id, private_key_file, base_path)
        access_token = "YOUR_ACCESS_TOKEN" # Replace with a valid, obtained access token

        # 2. Configure the API client
        api_client = ds.ApiClient(host=base_path)
        api_client.set_default_header("Authorization", f"Bearer {access_token}")

        # 3. Create envelope definition
        # In a real scenario, doc_base64 would come from reading a file.
        # Example: with open("path/to/document.pdf", "rb") as file: doc_base64 = base64.b64encode(file.read()).decode('utf-8')
        sample_pdf_content = "JVBERi0xLjQKJ..."
        envelope_definition = create_envelope_definition(
            signer_email="[email protected]",
            signer_name="John Doe",
            cc_email="[email protected]",
            cc_name="Jane Smith",
            doc_base64=sample_pdf_content # Replace with actual base64 encoded document
        )

        # 4. Instantiate EnvelopesApi
        envelopes_api = ds.EnvelopesApi(api_client)

        # 5. Call the create_envelope method
        results = envelopes_api.create_envelope(account_id, envelope_definition=envelope_definition)

        print(f"Envelope sent successfully! Envelope ID: {results.envelope_id}")

    except ApiException as e:
        print(f"Error sending envelope: {e}")
    except Exception as e:
        print(f"An unexpected error occurred: {e}")

if __name__ == "__main__":
    send_envelope()

This example demonstrates the core steps: configuring the API client with an access token, defining the envelope with documents and recipients, and then making the API call to send it. For a complete, runnable example, including how to obtain an access token using various OAuth flows, refer to the DocuSign Python SDK documentation and examples.

Real-world applications would typically involve more robust error handling, dynamic document loading, and potentially more complex recipient workflows and tab placements. The DocuSign how-to guide for sending documents provides further patterns and best practices.

Community libraries

While DocuSign provides and maintains a suite of official SDKs, the developer community sometimes creates and shares additional libraries and tools that can complement or extend DocuSign API integrations. These community-driven projects can offer specialized functionalities, integrations with other platforms, or alternative approaches to common tasks.

Examples of community contributions might include:

  • Specific framework integrations: Libraries tailored for frameworks like Django, Ruby on Rails, or particular front-end JavaScript frameworks that streamline DocuSign integration within those ecosystems.
  • Utility wrappers: Simplified wrappers around specific common API calls, reducing boilerplate code for very particular workflows (e.g., a simple library just for checking envelope status).
  • Tooling for development: CLI tools or helper scripts that aid in tasks like managing templates, fetching account information, or testing webhooks.

Developers interested in exploring community libraries should exercise due diligence, as these are not officially supported by DocuSign. It is advisable to review the project's documentation, community activity, and licensing, similar to how one would evaluate any open-source dependency. Resources like GitHub and developer forums are good places to discover such contributions. While DocuSign provides extensive official resources, third-party platforms like Tray.io's DocuSign connector also offer different integration paradigms for specific use cases.

For the most up-to-date and officially supported integration methods, always refer to the official DocuSign Developer Center.