Python Migration Guide

Migrating the Python SDK from hellosign-python-sdk to dropbox-sign

Welcome! Dropbox Sign's new Python SDK is generated from our officially maintained OpenAPI spec. In this release, we've made important updates that introduce new functionality and create feature parity between the Dropbox Sign API and the Python SDK. However, some of these changes are considered "breaking" in the sense that they'll require you to update your existing code in order to continue using the SDK.

In this migration guide, we'll cover core concepts in the new SDK, highlight differences from legacy versions, and provide example code showing how past implementations map to the new version's syntax. We'll link out to supporting documents that offer more context behind the breaking changes and why we made them. We apologize for any inconvenience these changes may cause, but are confident the new features will add value to your integration.

Remember that we are here to help if you have any questions or need assistance along the way. Thank you for using Dropbox Sign's Python SDK. We hope you enjoy the improvements!

Architecture and Tooling

As mentioned above, the new Python SDK (dropbox-sign) is generated from our OpenAPI Spec. Some of the architectural changes impact the tools and locations you use to interact with the SDK.

SDK Resources

  • Download -- using this new PyPI repo. New Python SDK versions will now be published here.
  • Development -- active development against the Python SDK happens here: hellosign-openapi/sdks/python.
  • SDK GitHub Repo -- dropbox-sign-python is updated based on changes to hellosign-openapi/sdks/python, but no active development work happens there.
  • Reference Docs -- the automatically generated Reference Docs are a great way to explore the SDK.
  • Examples -- our full suite of ready to use examples will help you get started quickly.
  • Engagement -- use the OpenAPI repo to submit Issues or Pull Requests for the Python SDK.

Core Concepts and Patterns

This section contains the core concepts and patterns of the new SDK and highlights differences from the legacy SDK.

Installation

There are two methods for installing the new SDK:

Install from PyPI

  1. To install from PyPI run:
    python -m pip install dropbox-sign

Install from GitHub

  1. To install from GitHub run:
    python -m pip install git+https://github.com/hellosign/dropbox-sign-python.git

Importing the SDK

Bringing the Python SDK into your code became a bit more verbose.

Legacy Python SDK

Importing a single HSClient provided everything in a single client.

New Python SDK

You need to import separate classes for the client, errors, configuration, apis, and models.

Legacy SDK - ImportingNew SDK - Importing
Copy
Copied
from hellosign_sdk import HSClient
Copy
Copied
from dropbox_sign import \
    ApiClient, ApiException, Configuration, apis, models

Authentication

New patterns were introduced for authentication and authorization, but use the same credentials.

Legacy Python SDK

Pass credentials to HSClient and access all of the SDK.

New Python SDK

Pass credentials using Configuration class instance. Additional steps needed to use SDK (covered in section below).

Legacy SDK - HSClientNew SDK - Configuration
Copy
Copied
# Initialize using email and password
client = HSClient(email_address="api_user@example.com", password="your_password")

# Initialize using api key
client = HSClient(api_key="YOUR_API_KEY")

# Initialize using api token
client = HSClient(access_token="YOUR_ACCESS_TOKEN")
Copy
Copied
configuration = Configuration(
    # Configure HTTP basic authorization: api_key
    username="YOUR_API_KEY",

    # or, configure Bearer authorization: oauth2
    access_token="YOUR_ACCESS_TOKEN",
)

Endpoints Grouped into Classes

The new Python SDK requires using an ApiClient class to access the API's endpoints.

New SDK - ApiClient

Copy
Copied
configuration = Configuration(username="YOUR_API_KEY")

with ApiClient(configuration) as api_client:
    account_api = apis.AccountApi(api_client)

The new SDK divides endpoints across unique Classes:

Class Name and ReferenceAPI Reference
AccountApi/account/* Endpoints
ApiAppApi/api_app/* Endpoints
BulkSendJobApi/bulk_send_job/* Endpoints
EmbeddedApi/embedded/* Endpoints
OAuthApi/oauth/* Endpoints
ReportApi/report/* Endpoints
SignatureRequestApi/signature_request/* Endpoints
TeamApi/team/* Endpoints
TemplateApi/template/* Endpoints
UnclaimedDraftApi/unclaimed_draft/* Endpoints

Using Models to Pass Parameters

The Dropbox Sign API uses parameters to pass values, configure behavior, and use features. The new SDK introduces some new patterns around that.

Legacy Python SDK

Values are defined as parameters which get passed as arguments inside each endpoint-specific method.

New Python SDK

Models are used to define the structure and value of the parameters being passed. The fully assembled model is passed to the method.

Legacy SDK - No Models NeededNew SDK - Using Models
Copy
Copied
hs_client.send_signature_request_embedded(
    test_mode=True,
    client_id="b6b8e7deaf8f0b95c029dca049356d4a2cf9710a",
    title="NDA with Acme Co.",
    subject="The NDA we talked about",
    message="Please sign this NDA and then we can discuss more. Let me know if you have any questions.",
    signers=[
        { "email_address": "jack@example.com", "name": "Jack", "order": 0 },
        { "email_address": "jill@example.com", "name": "Jill", "order": 1 }
    ],
    cc_email_addresses=["lawyer@dropboxsign.com", "lawyer@example.com"],
    files=["NDA.pdf", "ApendixA.pdf"]
)
Copy
Copied
from pprint import pprint

from dropbox_sign import \
    ApiClient, ApiException, Configuration, apis, models

configuration = Configuration(
    username="YOUR_API_KEY",
)

with ApiClient(configuration) as api_client:
    signature_request_api = apis.SignatureRequestApi(api_client)

    signer_1 = models.SubSignatureRequestSigner(
        email_address="jack@example.com",
        name="Jack",
        order=0,
    )

    signer_2 = models.SubSignatureRequestSigner(
        email_address="jill@example.com",
        name="Jill",
        order=1,
    )

    signing_options = models.SubSigningOptions(
        draw=True,
        type=True,
        upload=True,
        phone=True,
        default_type="draw",
    )

    data = models.SignatureRequestCreateEmbeddedRequest(
        client_id="ec64a202072370a737edf4a0eb7f4437",
        title="NDA with Acme Co.",
        subject="The NDA we talked about",
        message="Please sign this NDA and then we can discuss more. Let me know if you have any questions.",
        signers=[signer_1, signer_2],
        file_urls=["https://app.hellosign.com/docs/example_signature_request.pdf"],
        signing_options=signing_options,
        test_mode=True,
    )

    try:
        response = signature_request_api.signature_request_create_embedded(data)
        pprint(response)
    except ApiException as e:
        print("Exception when calling Dropbox Sign API: %s\n" % e)

Path and Query Parameters

In the legacy SDK you would pass Path and Query parameters alongside any POST data to the API endpoint:

Legacy SDK - Path and Query Parameters

Copy
Copied
hs_client.remind_signature_request(
    signature_request_id="2f9781e1a8e2045224d808c153c2e1d3df6f8f2f",
    email_address="john@example.com"
)

The new SDK now requires POST data be an object when calling any API endpoint. Path and Query parameters must be passed individually to these methods.

New SDK - Path, Query, and Post Data

Copy
Copied
from pprint import pprint

from dropbox_sign import \
    ApiClient, ApiException, Configuration, apis, models

configuration = Configuration(
    username="YOUR_API_KEY",
)

with ApiClient(configuration) as api_client:
    signature_request_api = apis.SignatureRequestApi(api_client)

    data = models.SignatureRequestRemindRequest(
        email_address="john@example.com",
    )

    signature_request_id = "2f9781e1a8e2045224d808c153c2e1d3df6f8f2f"

    try:
        response = signature_request_api.signature_request_remind(signature_request_id, data)
        pprint(response)
    except ApiException as e:
        print("Exception when calling Dropbox Sign API: %s\n" % e)

Error Handling and Warnings

The New SDK handles errors and warnings differently.

Error Handling

Errors are an instance of ApiException with its body parameter being an instance of ErrorResponse class and should be handled using Try/Except blocks.

New SDK - Error Handling

Copy
Copied
from pprint import pprint

from dropbox_sign import \
    ApiClient, ApiException, Configuration, apis

configuration = Configuration(
    username="YOUR_API_KEY",
)

with ApiClient(configuration) as api_client:
    api = apis.AccountApi(api_client)

    try:
        response = api.account_get(email_address="jack@example.com")
        pprint(response)
    except ApiException as e:
        print("Exception when calling Dropbox Sign API: %s\n" % e)

Warnings

Warnings are a list of WarningResponse.

New SDK - Warnings

Copy
Copied
from pprint import pprint

from dropbox_sign import \
    ApiClient, ApiException, Configuration, apis, models

configuration = Configuration(
    username="YOUR_API_KEY",
)

with ApiClient(configuration) as api_client:
    api = apis.AccountApi(api_client)

    data = models.AccountCreateRequest(
        email_address="newuser@dropboxsign.com",
    )

    try:
        response = api.account_create(data)
        pprint(response)

        # warning loop
        for warning in response.warnings:
            print("Warning Name: %s\n" % warning.warning_name)
            print("Warning Message: %s\n" % warning.warning_msg)
    except ApiException as e:
        print("Exception when calling Dropbox Sign API: %s\n" % e)

Instantiating Objects From Data

There are two ways to instantiate an object.

  • You can instantiate a class directly and use constructor arguments
  • You can use the init() static method
New SDK - Using Constructor ArgumentsNew SDK - Using init() Static Method
Copy
Copied
signer_1 = models.SubSignatureRequestSigner(
    email_address="jack@example.com",
    name="Jack",
    order=0,
)

attachment_1 = models.SubAttachment(
    name="Attachment 1",
    instructions="Please download this file",
    signer_index=0,
    required=True
)
Copy
Copied
signer_1 = models.SubSignatureRequestSigner.init({
    "email_address": "jack@example.com",
    "name": "Jack",
    "order": 0,
})

attachment_1 = models.SubAttachment.init({
    "name": "Attachment 1",
    "instructions": "Please download this file",
    "signer_index": 0,
    "required": True
})
Note
init() creates a full object using all the data you pass, including nested data to instantiate nested objects. Any parameters that you do not pass data for will be set to their default value (including null).

Event Callback Helper

A callback helper class is included in the New SDK repo to assist in verifying callbacks. The helper simplifies:

  1. Checking event authenticity with built in event hash check
  2. Displaying event types (account callback vs. app callback)
  3. Displaying event messages
The EventCallbackHelper and EventCallbackRequest classes facilitate parsing of event data and assist in validating that a callback originated from Dropbox Sign.We will send event callback payloads to you as a multipart/form-data request with a single json formfield that contains your event callback as a JSON string.

Example Event Callback Request From US to YOU

Copy
Copied
curl -X POST 'https://example.com/YOUR_EVENT_CALLBACK_URL' \
  -F 'json={"event":{"event_type":"account_confirmed","event_time":"1669926463","event_hash":"ff8b03439122f9160500c3fb855bdee5a9ccba5fff27d3b258745d8f3074832f","event_metadata":{"related_signature_id":null,"reported_for_account_id":"6421d70b9bd45059fa207d03ab8d1b96515b472c","reported_for_app_id":null,"event_message":null}}}'

Example JSON Payload

Copy
Copied
{
  "event": {
    "event_type": "account_confirmed",
    "event_time": "1669926463",
    "event_hash": "ff8b03439122f9160500c3fb855bdee5a9ccba5fff27d3b258745d8f3074832f",
    "event_metadata": {
      "related_signature_id": null,
      "reported_for_account_id": "6421d70b9bd45059fa207d03ab8d1b96515b472c",
      "reported_for_app_id": null,
      "event_message": null
    }
  }
}

How to use the EventCallbackHelper

Copy
Copied
from dropbox_sign import EventCallbackHelper
from dropbox_sign.models import EventCallbackRequest

import json

# use your API key
api_key = "324e3b0840f065eb51f3fd63231d0d33daa35d4ed10d27718839e81737065782"

# callback_data represents data we send to you
callback_data = json.loads(request.POST.get('json', ''))

callback_event = EventCallbackRequest.init(callback_data)

# verify that a callback came from HelloSign.com
if EventCallbackHelper.is_valid(api_key, callback_event):
    # one of "account_callback" or "api_app_callback"
    callback_type = EventCallbackHelper.get_callback_type(callback_event)

    # do your magic below!

Differences from Legacy SDK

This section highlights larger changes to be aware of when migrating to the new SDK.

Form Fields per Document

The Form Fields per Document parameter has changed from a two dimensional array, to a one dimensional array—allowing you to designate which file you to add the field to using document_index. You can learn more about this change here: Form Fields per Document.
Legacy SDK - Form Fields Per DocumentNew SDK - Form Fields Per Document
Copy
Copied
hs_client.send_signature_request(
    test_mode=True,
    files=["NDA.pdf", "AppendixA.pdf"],
    title="NDA with Acme Co.",
    subject="The NDA we talked about",
    message="Please sign this NDA and then we can discuss more.",
    signers=[
        {
            "email_address": "jill@example.com",
            "name": "Jill",
            "order": 1
        }
    ],
    form_fields_per_document=[
        [
            {
                "api_id": "abcd",
                "name": "signer_signature",
                "type": "signature",
                "x": 200,
                "y": 300,
                "page": 1,
                "width": 280,
                "height": 72,
                "required": True,
                "signer": 0
            }
        ]
    ]
)
Copy
Copied
from pprint import pprint

from dropbox_sign import \
    ApiClient, ApiException, Configuration, apis, models

configuration = Configuration(
    username="YOUR_API_KEY",
)

with ApiClient(configuration) as api_client:
    signature_request_api = apis.SignatureRequestApi(api_client)

    signer_1 = models.SubSignatureRequestSigner(
        email_address="jill@example.com",
        name="Jill",
        order=1
    )

    form_field_1 = models.SubFormFieldsPerDocumentSignature(
        document_index=0,
        api_id="abcd",
        name="signer_signature",
        type="signature",
        x=200,
        y=300,
        page=1,
        width=280,
        height=72,
        required=True,
        signer=0
    )

    data = models.SignatureRequestSendRequest(
        test_mode=True,
        files=[open("pdf-sample.pdf", "rb")],
        title="NDA with Acme Co.",
        subject="The NDA we talked about",
        message="Please sign this NDA and then we can discuss more.",
        signers=[signer_1],
        form_fields_per_document=[form_field_1]
    )

    try:
        response = signature_request_api.signature_request_send(data)
        pprint(response)
    except ApiException as e:
        print("Exception when calling Dropbox Sign API: %s\n" % e)

Instantiating the Correct Field Class

There are several different types of form fields you can define, identified by the value of the type field and a few ways to instantiate the correct object when making an API request.

The different classes for each type are:

Field TypeClass
checkboxSubFormFieldsPerDocumentCheckbox
checkbox-mergeSubFormFieldsPerDocumentCheckboxMerge
date_signedSubFormFieldsPerDocumentDateSigned
dropdownSubFormFieldsPerDocumentDropdown
hyperlinkSubFormFieldsPerDocumentHyperlink
initialsSubFormFieldsPerDocumentInitials
radioSubFormFieldsPerDocumentRadio
signatureSubFormFieldsPerDocumentSignature
textSubFormFieldsPerDocumentText
text-mergeSubFormFieldsPerDocumentTextMerge

You can use SubFormFieldsPerDocumentBase and it will instantiate the correct class for you

Copy
Copied
# instantiates a new `SubFormFieldsPerDocumentSignature` object
form_fields_per_document_signature = models.SubFormFieldsPerDocumentBase(
    type="signature",
    document_index=0,
    api_id="4688957689",
    name="signature1",
    x=5,
    y=7,
    width=60,
    height=30,
    required=True,
    signer=0,
    page=1,
)

You can use .init()

Copy
Copied
# instantiates a new `SignatureRequestSendRequest` object
data = models.SignatureRequestSendRequest.init({
    "test_mode": True,
    "files": [open("pdf-sample.pdf", "rb")],
    "title": "NDA with Acme Co.",
    "subject": "The NDA we talked about",
    "message": "Please sign this NDA and then we can discuss more.",
    "signers": [
        {
            "email_address": "jill@example.com",
            "name": "Jill",
            "order": 1
        }
    ],
    # instantiates a new `SubFormFieldsPerDocumentSignature` object
    "form_fields_per_document": [
        {
            "type": "signature",
            "document_index": 0,
            "api_id": "4688957689",
            "name": "signature1",
            "x": 5,
            "y": 7,
            "width": 60,
            "height": 30,
            "required": True,
            "signer": 0,
            "page": 1,
        }
    ]
})

You can instantiate the class directly

Copy
Copied
# instantiates a new `SubFormFieldsPerDocumentSignature` object
form_fields_per_document_signature = models.SubFormFieldsPerDocumentSignature(
    type="signature",
    document_index=0,
    api_id="4688957689",
    name="signature1",
    x=5,
    y=7,
    width=60,
    height=30,
    required=True,
    signer=0,
    page=1,
)

Form Fields per Document Examples using the new SDK:

SignatureInitialsDate SignedTextText MergeCheckboxCheckbox MergeDropdownHyperlinkRadio
Copy
Copied
form_fields_per_document_signature = models.SubFormFieldsPerDocumentSignature(
    type="signature",
    document_index=0,
    api_id="4688957689",
    name="signature1",
    x=5,
    y=7,
    width=60,
    height=30,
    required=True,
    signer=0,
    page=1
)
Copy
Copied
form_fields_per_document_initials = models.SubFormFieldsPerDocumentInitials(
    type="initials",
    document_index=0,
    api_id="135146356",
    name="initials1",
    x=50,
    y=120,
    width=60,
    height=30,
    required=True,
    signer=0,
    page=1
)
Copy
Copied
form_fields_per_document_date_signed = models.SubFormFieldsPerDocumentDateSigned(
    type="date_signed",
    document_index=0,
    api_id="537468579",
    name="date_signed1",
    x=50,
    y=170,
    width=60,
    height=30,
    required=True,
    signer=0,
    page=1
)
Copy
Copied
form_fields_per_document_text = models.SubFormFieldsPerDocumentText(
    type="text",
    document_index=0,
    api_id="4686488468",
    name="text1",
    x=50,
    y=220,
    width=60,
    height=30,
    required=True,
    signer=0,
    page=1
)
Copy
Copied
first_name = models.SubCustomField(
    name="first_name",
    value="John"
)

form_fields_per_document_text_merge = models.SubFormFieldsPerDocumentTextMerge(
    type="text-merge",
    document_index=0,
    api_id="37879768",
    name="first_name",
    x=50,
    y=270,
    width=60,
    height=30,
    required=True,
    signer=0,
    page=1
)
Copy
Copied
form_fields_per_document_checkbox = models.SubFormFieldsPerDocumentCheckbox(
    type="checkbox",
    document_index=0,
    api_id="58579089",
    name="checkbox1",
    x=50,
    y=320,
    width=16,
    height=16,
    required=True,
    signer=0,
    page=1
)
Copy
Copied
is_registered = models.SubCustomField(
    name="is_registered",
    value="1"
)

form_fields_per_document_checkbox_merge = models.SubFormFieldsPerDocumentCheckboxMerge(
    type="checkbox-merge",
    document_index=0,
    api_id="95865877",
    name="is_registered",
    x=50,
    y=370,
    width=16,
    height=16,
    required=True,
    signer=0,
    page=1
)
Copy
Copied
form_fields_per_document_dropdown = models.SubFormFieldsPerDocumentDropdown(
    type="dropdown",
    document_index=0,
    api_id="358674636",
    name="dropdown1",
    options=["Option 1","Option 2"],
    content="Option 2",
    x=50,
    y=420,
    width=80,
    height=30,
    required=True,
    signer=0,
    page=1
)
Copy
Copied
form_fields_per_document_hyperlink = models.SubFormFieldsPerDocumentHyperlink(
    type="hyperlink",
    document_index=0,
    api_id="4786796568",
    name="hyperlink1",
    content="Click me!",
    content_url="http://example.com",
    x=50,
    y=470,
    width=60,
    height=30,
    page=1
)
Copy
Copied
form_fields_per_document_radio1 = models.SubFormFieldsPerDocumentRadio(
    type="radio",
    document_index=0,
    api_id="7697869",
    name="radio1",
    x=50,
    y=500,
    width=16,
    height=16,
    group="RadioItemGroup1",
    is_checked=True,
    signer=0,
    page=1
)

form_fields_per_document_radio2 = models.SubFormFieldsPerDocumentRadio(
    type="radio",
    document_index=0,
    api_id="46876587",
    name="radio1",
    x=100,
    y=500,
    width=16,
    height=16,
    group="RadioItemGroup1",
    is_checked=False,
    signer=0,
    page=1
)

form_field_group_value = models.SubFormFieldGroup(
    group_id="RadioItemGroup1",
    group_label="Radio Item Group 1",
    requirement="require_0-1"
)

"role" Value in signers Object

In the Legacy SDK when making a Signature Request using a Template the signers property was an object with the role name as the key. In the new SDK the role value has been moved into the signer object itself.For example for the /signature_request/send_with_template endpoint the signers property could be represented as:
Legacy SDK - signers with RolesNew SDK - signers with Roles
Copy
Copied
{
  "signers": {
    "Client": {
      "name": "George",
      "email_address": "george@example.com"
    },
    "Manager": {
      "name": "Bob",
      "email_address": "bob@example.com"
    }
  }
}
Copy
Copied
{
  "signers": [
    {
      "role": "Client",
      "name": "George",
      "email_address": "george@example.com"
    },
    {
      "role": "Manager",
      "name": "Bob",
      "email_address": "bob@example.com"
    }
  ]
}

Using the new SDK you would now send this data as follows:

New SDK - signers with Roles Example #1New SDK - signers with Roles Example #2
Copy
Copied
from pprint import pprint

from dropbox_sign import \
    ApiClient, ApiException, Configuration, apis, models

configuration = Configuration(
    username="YOUR_API_KEY",
)

with ApiClient(configuration) as api_client:
    signature_request_api = apis.SignatureRequestApi(api_client)

    data = models.SignatureRequestSendWithTemplateRequest.init({
        "template_ids": ["c26b8a16784a872da37ea946b9ddec7c1e11dff6"],
        "subject": "Purchase Order",
        "message": "Glad we could come to an agreement.",
        "signers": [
            {
              "role": "Client",
              "name": "George",
              "email_address": "george@example.com"
            },
            {
              "role": "Manager",
              "name": "Bob",
              "email_address": "bob@example.com"
            }
        ],
    })

    try:
        response = signature_request_api.signature_request_send_with_template(data)
        pprint(response)
    except ApiException as e:
        print("Exception when calling Dropbox Sign API: %s\n" % e)
Copy
Copied
from pprint import pprint

from dropbox_sign import \
    ApiClient, ApiException, Configuration, apis, models

configuration = Configuration(
    username="YOUR_API_KEY",
)

with ApiClient(configuration) as api_client:
    signature_request_api = apis.SignatureRequestApi(api_client)

    signer_1 = models.SubSignatureRequestTemplateSigner(
        role="Client",
        email_address="george@example.com",
        name="George",
    )

    signer_2 = models.SubSignatureRequestTemplateSigner(
        role="Manager",
        name="Bob",
        email_address="bob@example.com",
    )

    data = models.SignatureRequestSendWithTemplateRequest(
        template_ids=["c26b8a16784a872da37ea946b9ddec7c1e11dff6"],
        subject="Purchase Order",
        message="Glad we could come to an agreement.",
        signers=[signer_1, signer_2],
    )

    try:
        response = signature_request_api.signature_request_send_with_template(data)
        pprint(response)
    except ApiException as e:
        print("Exception when calling Dropbox Sign API: %s\n" % e)

"role" Value in ccs Property

In the Legacy SDK when making a Signature Request using a Template the ccs property was an object with the role name as the key. In the new SDK the role value has been moved into the cc object itself, alongside a new email_address property.For example for the /signature_request/send_with_template endpoint the ccs property could be represented as:
Legacy SDK - ccsNew SDK - ccs
Copy
Copied
{
  "ccs": {
    "Client": "george@example.com",
    "Manager": "bob@example.com"
  }
}
Copy
Copied
{
  "ccs": [
    {
      "role": "Client",
      "email_address": "george@example.com"
    },
    {
      "role": "Manager",
      "email_address": "bob@example.com"
    }
  ]
}

Using the new SDK you would now send this data as follows:

New SDK - ccs Example #1New SDK - ccs Example #2
Copy
Copied
from pprint import pprint

from dropbox_sign import \
    ApiClient, ApiException, Configuration, apis, models

configuration = Configuration(
    username="YOUR_API_KEY",
)

with ApiClient(configuration) as api_client:
    signature_request_api = apis.SignatureRequestApi(api_client)

    data = models.SignatureRequestSendWithTemplateRequest.init({
        "template_ids": ["c26b8a16784a872da37ea946b9ddec7c1e11dff6"],
        "subject": "Purchase Order",
        "message": "Glad we could come to an agreement.",
        "signers": [
            {
              "role": "Client",
              "name": "George",
              "email_address": "george@example.com"
            },
            {
              "role": "Manager",
              "name": "Bob",
              "email_address": "bob@example.com"
            }
        ],
        "ccs": [
            {
                "role": "Client",
                "email_address": "george@example.com"
            },
            {
                "role": "Manager",
                "email_address": "bob@example.com"
            }
        ]
    })

    try:
        response = signature_request_api.signature_request_send_with_template(data)
        pprint(response)
    except ApiException as e:
        print("Exception when calling Dropbox Sign API: %s\n" % e)
Copy
Copied
from pprint import pprint

from dropbox_sign import \
    ApiClient, ApiException, Configuration, apis, models

configuration = Configuration(
    username="YOUR_API_KEY",
)

with ApiClient(configuration) as api_client:
    signature_request_api = apis.SignatureRequestApi(api_client)

    signer_1 = models.SubSignatureRequestTemplateSigner(
        role="Client",
        email_address="george@example.com",
        name="George",
    )

    signer_2 = models.SubSignatureRequestTemplateSigner(
        role="Manager",
        name="Bob",
        email_address="bob@example.com",
    )

    cc_1 = models.SubCC(
        role="Client",
        email_address="george@example.com"
    )

    cc_2 = models.SubCC(
        role="Manager",
        email_address="bob@example.com"
    )

    data = models.SignatureRequestSendWithTemplateRequest(
        template_ids=["c26b8a16784a872da37ea946b9ddec7c1e11dff6"],
        subject="Purchase Order",
        message="Glad we could come to an agreement.",
        signers=[signer_1, signer_2],
        ccs=[cc_1, cc_2]
    )

    try:
        response = signature_request_api.signature_request_send_with_template(data)
        pprint(response)
    except ApiException as e:
        print("Exception when calling Dropbox Sign API: %s\n" % e)

"name" Value in custom_fields Property

In the Legacy SDK when making a Signature Request with the custom_fields property it was an object with the name as the key. In the new SDK the name value has been moved into the custom_field object itself.For example for the /signature_request/send_with_template endpoint the custom_fields property could be represented as:
Legacy SDK - custom_fieldsNew SDK - custom_fields
Copy
Copied
{
  "custom_fields": {
    "company": {
      "value": "ABC Corp",
      "required": true
    }
  }
}
Copy
Copied
{
  "custom_fields": [
    {
      "name": "company",
      "value": "ABC Corp",
      "required": true
    }
  ]
}

Using the new SDK you would now send this data as follows:

New SDK - custom_fields Example #1New SDK - custom_fields Example #2
Copy
Copied
from pprint import pprint

from dropbox_sign import \
    ApiClient, ApiException, Configuration, apis, models

configuration = Configuration(
    username="YOUR_API_KEY",
)

with ApiClient(configuration) as api_client:
    signature_request_api = apis.SignatureRequestApi(api_client)

    data = models.SignatureRequestSendWithTemplateRequest.init({
        "template_ids": ["c26b8a16784a872da37ea946b9ddec7c1e11dff6"],
        "subject": "Purchase Order",
        "message": "Glad we could come to an agreement.",
        "signers": [
            {
              "role": "Client",
              "name": "George",
              "email_address": "george@example.com"
            },
            {
              "role": "Manager",
              "name": "Bob",
              "email_address": "bob@example.com"
            }
        ],
        "custom_fields": [
            {
                "name": "company",
                "value": "ABC Corp",
                "required": True
            },
        ]
    })

    try:
        response = signature_request_api.signature_request_send_with_template(data)
        pprint(response)
    except ApiException as e:
        print("Exception when calling Dropbox Sign API: %s\n" % e)
Copy
Copied
from pprint import pprint

from dropbox_sign import \
    ApiClient, ApiException, Configuration, apis, models

configuration = Configuration(
    username="YOUR_API_KEY",
)

with ApiClient(configuration) as api_client:
    signature_request_api = apis.SignatureRequestApi(api_client)

    signer_1 = models.SubSignatureRequestTemplateSigner(
        role="Client",
        email_address="george@example.com",
        name="George",
    )

    signer_2 = models.SubSignatureRequestTemplateSigner(
        role="Manager",
        name="Bob",
        email_address="bob@example.com",
    )

    custom_field_1 = models.SubCustomField(
        name="company",
        value="ABC Corp",
        required=True,
    )

    data = models.SignatureRequestSendWithTemplateRequest(
        template_ids=["c26b8a16784a872da37ea946b9ddec7c1e11dff6"],
        subject="Purchase Order",
        message="Glad we could come to an agreement.",
        signers=[signer_1, signer_2],
        custom_fields=[custom_field_1]
    )

    try:
        response = signature_request_api.signature_request_send_with_template(data)
        pprint(response)
    except ApiException as e:
        print("Exception when calling Dropbox Sign API: %s\n" % e)

template_id to template_ids

The template_id parameter has been removed. You must now use template_ids.
Legacy SDK versionNew SDK Version
Template ID (template_id) is passed as a singular string:
template_id : "1234567890"
Template ID is passed as an array of strings (template_ids):
template_ids:["1234567890"]

file to files

The file parameter has been renamed to files. Usage remains the same.

file_url to file_urls

The file_url parameter has been renamed to file_urls. Usage remains the same.

Interacting with Files

The new SDK version introduces some new patterns around uploading and downloading files. You can read about them more in depth here: Interacting with Files.

Uploading Files

Passing a file with with your API request using the files parameter is different:
Legacy SDK versionNew SDK Version
Accepts a file binary or a path to a local fileOnly accepts a file binary

New SDK - File Parameter

Copy
Copied
from pprint import pprint

from dropbox_sign import \
    ApiClient, ApiException, Configuration, apis, models

configuration = Configuration(
    # Configure HTTP basic authorization: api_key
    username="YOUR_API_KEY",
)

with ApiClient(configuration) as api_client:
    signature_request_api = apis.SignatureRequestApi(api_client)

    signer = models.SubSignatureRequestSigner(
        email_address="jack@example.com",
        name="Jack",
    )
    # Reads file in binary format. File pointer placed at start of file.
    your_file = open("YOUR_FULL_FILE_PATH", "rb")

    data = models.SignatureRequestSendRequest(
        title="NDA with Acme Co.",
        subject="The NDA we talked about",
        message="Please sign this NDA and then we can discuss more. Let me know if you have any questions.",
        signers=[signer],
        files=[your_file],
        test_mode=True,
    )

    try:
        response = signature_request_api.signature_request_send(data)
        # closes the file
        your_file.close()
        pprint(response)
    except ApiException as e:
        print("Exception when calling Dropbox Sign API: %s\n" % e)
        # closes the file
        your_file.close()

Downloading Files

Download functionality is now spread across multiple endpoints.

Legacy SDK VersionNew SDK version
Download Files is a single endpoint and the return is configured by parameters.Download Files spread across three endpoints
Legacy SDK - Download FilesNew SDK - Download FilesNew SDK - Download as Data UriNew SDK - File File Url
Copy
Copied
hs_client = HSClient(api_key="YOUR_API_KEY")
hs_client.get_signature_request_file(
    signature_request_id="fa5c8a0b0f492d768749333ad6fcc214c111e967",
    filename="files.pdf",
    file_type="pdf"
)
Copy
Copied
from dropbox_sign import \
    ApiClient, ApiException, Configuration, apis

configuration = Configuration(
    username="YOUR_API_KEY",
)

with ApiClient(configuration) as api_client:
    api = apis.SignatureRequestApi(api_client)

    signature_request_id = "1b6ad73dfc8ff4f9ba7190a40be39d8b660f1885"

    try:
        response = api.signature_request_files(signature_request_id, file_type="pdf")
        open("file_response.pdf", "wb").write(response.read())
    except ApiException as e:
        print("Exception when calling Dropbox Sign API: %s\n" % e)
Copy
Copied
from pprint import pprint

from dropbox_sign import \
    ApiClient, ApiException, Configuration, apis

configuration = Configuration(
    username="YOUR_API_KEY",
)

with ApiClient(configuration) as api_client:
    signature_request_api = apis.SignatureRequestApi(api_client)

    signature_request_id = "fa5c8a0b0f492d768749333ad6fcc214c111e967"

    try:
        response = signature_request_api.signature_request_files_as_data_uri(signature_request_id)
        pprint(response)
    except ApiException as e:
        print("Exception when calling Dropbox Sign API: %s\n" % e)
Copy
Copied
from pprint import pprint

from dropbox_sign import \
    ApiClient, ApiException, Configuration, apis

configuration = Configuration(
    username="YOUR_API_KEY",
)

with ApiClient(configuration) as api_client:
    signature_request_api = apis.SignatureRequestApi(api_client)

    signature_request_id = "fa5c8a0b0f492d768749333ad6fcc214c111e967"

    try:
        response = signature_request_api.signature_request_files_as_file_url(signature_request_id)
        pprint(response)
    except ApiException as e:
        print("Exception when calling Dropbox Sign API: %s\n" % e)

Downloading Templates

Legacy SDK - Get Template FilesNew SDK - Download Template FilesNew SDK - Template File as Data UriNew SDK - Template File as File Url
Copy
Copied
hs_client = HSClient(api_key="SIGN_IN_AND_CREATE_API_KEY_FIRST")
hs_client.get_template_files("5de8179668f2033afac48da1868d0093bf133266", "download.pdf")
Copy
Copied
from pprint import pprint

from dropbox_sign import \
    ApiClient, ApiException, Configuration, apis

configuration = Configuration(
    username="YOUR_API_KEY",
)

with ApiClient(configuration) as api_client:
    template_api = apis.TemplateApi(api_client)

    template_id = "5de8179668f2033afac48da1868d0093bf133266"

    try:
        response = template_api.template_files(template_id, file_type="pdf")
        open("file_response.pdf", "wb").write(response.read())
    except ApiException as e:
        print("Exception when calling Dropbox Sign API: %s\n" % e)
Copy
Copied
from pprint import pprint

from dropbox_sign import \
    ApiClient, ApiException, Configuration, apis

configuration = Configuration(
    username="YOUR_API_KEY",
)

with ApiClient(configuration) as api_client:
    template_api = apis.TemplateApi(api_client)

    template_id = "5de8179668f2033afac48da1868d0093bf133266"

    try:
        response = template_api.template_files_as_data_uri(template_id)
        pprint(response)
    except ApiException as e:
        print("Exception when calling Dropbox Sign API: %s\n" % e)
Copy
Copied
from pprint import pprint

from dropbox_sign import \
    ApiClient, ApiException, Configuration, apis

configuration = Configuration(
    username="YOUR_API_KEY",
)

with ApiClient(configuration) as api_client:
    template_api = apis.TemplateApi(api_client)

    template_id = "5de8179668f2033afac48da1868d0093bf133266"

    try:
        response = template_api.template_files_as_file_url(template_id)
        pprint(response)
    except ApiException as e:
        print("Exception when calling Dropbox Sign API: %s\n" % e)

Endpoint Mapping

This section shows you how endpoints in the legacy SDK map to the new SDK. It doesn't cover all endpoints, but gives you an idea of mapping implementations between the two SDKs. Please reach out if you think we're missing an important example.

Get Account

Legacy SDK - Get AccountNew SDK - Get Account
Copy
Copied
hs_client = HSClient(api_key="your_api_key")
account = hs_client.get_account_info()

print hs_client.account.email_address
Copy
Copied
from pprint import pprint

from dropbox_sign import \
    ApiClient, ApiException, Configuration, apis

configuration = Configuration(
    username="YOUR_API_KEY",
)

with ApiClient(configuration) as api_client:
    account_api = apis.AccountApi(api_client)

    try:
        response = account_api.account_get()
        pprint(response)
    except ApiException as e:
        print("Exception when calling Dropbox Sign API: %s\n" % e)

Create API App

New Python SDK

This feature was introduced in the new Python SDK.

Legacy SDK - Create API AppNew SDK - Create API App
Copy
Copied
// unavailable in legacy SDK
Copy
Copied
from pprint import pprint

from dropbox_sign import \
    ApiClient, ApiException, Configuration, apis, models

configuration = Configuration(
    username="YOUR_API_KEY",
)

with ApiClient(configuration) as api_client:
    api_app_api = apis.ApiAppApi(api_client)

    oauth = models.SubOAuth(
        callback_url="https://example.com/oauth",
        scopes=["basic_account_info", "request_signature"],
    )

    white_labeling_options = models.SubWhiteLabelingOptions(
        primary_button_color="#00b3e6",
        primary_button_text_color="#ffffff",
    )

    custom_logo_file = open("./CustomLogoFile.png", "rb")

    data = models.ApiAppCreateRequest(
        name="My Production App",
        domains=["example.com"],
        oauth=oauth,
        white_labeling_options=white_labeling_options,
        custom_logo_file=custom_logo_file,
    )

    try:
        response = api_app_api.api_app_create(data)
        pprint(response)
    except ApiException as e:
        print("Exception when calling Dropbox Sign API: %s\n" % e)

Get API App

Legacy SDK - Get API AppNew SDK - Get API App
Copy
Copied
hs_client = HSClient(api_key="api_key")
hs_client.get_api_app_info(
    client_id="client_id"
)
Copy
Copied
from pprint import pprint

from dropbox_sign import \
    ApiClient, ApiException, Configuration, apis, models

configuration = Configuration(
    username="YOUR_API_KEY",
)

with ApiClient(configuration) as api_client:
    api_app_api = apis.ApiAppApi(api_client)

    client_id = "0dd3b823a682527788c4e40cb7b6f7e9"

    try:
        response = api_app_api.api_app_get(client_id)
        pprint(response)
    except ApiException as e:
        print("Exception when calling Dropbox Sign API: %s\n" % e)

Get Bulk Send Job

New Python SDK

This feature was introduced in the new Python SDK.

Legacy SDK - Get Bulk Send JobNew SDK - Get Bulk Send Job
Copy
Copied
// Feature unavailable in legacy SDK
Copy
Copied
from pprint import pprint

from dropbox_sign import \
    ApiClient, ApiException, Configuration, apis, models

configuration = Configuration(
    username="YOUR_API_KEY",
)

with ApiClient(configuration) as api_client:
    bulk_job_api = apis.BulkSendJobApi(api_client)

    bulk_send_job_id = "6e683bc0369ba3d5b6f43c2c22a8031dbf6bd174"

    try:
        response = bulk_job_api.bulk_send_job_get(bulk_send_job_id)
        pprint(response)
    except ApiException as e:
        print("Exception when calling Dropbox Sign API: %s\n" % e)

Get Embedded Sign Url

Legacy SDK - Get Embedded Sign UrlNew SDK - Get Embedded Sign Url
Copy
Copied
hs_client.get_embedded_object("50e3542f738adfa7ddd4cbd4c00d2a8ab6e4194b")
Copy
Copied
from pprint import pprint

from dropbox_sign import \
    ApiClient, ApiException, Configuration, apis, models

configuration = Configuration(
    username="YOUR_API_KEY",
)

with ApiClient(configuration) as api_client:
    embedded_api = apis.EmbeddedApi(api_client)

    signature_id = "50e3542f738adfa7ddd4cbd4c00d2a8ab6e4194b"

    try:
        response = embedded_api.embedded_sign_url(signature_id)
        pprint(response)
    except ApiException as e:
        print("Exception when calling Dropbox Sign API: %s\n" % e)

Get Embedded Template Edit Url

Legacy SDK - Get Embedded Template Edit UrlNew SDK - Get Embedded Template Edit Url
Copy
Copied
embeddedObj = hs_client.get_template_edit_url("5de8179668f2033afac48da1868d0093bf133266")
edit_url = embeddedObj.edit_url
Copy
Copied
from pprint import pprint

from dropbox_sign import \
    ApiClient, ApiException, Configuration, apis, models

configuration = Configuration(
    username="YOUR_API_KEY",
)

with ApiClient(configuration) as api_client:
    embedded_api = apis.EmbeddedApi(api_client)

    data = models.EmbeddedEditUrlRequest(
        cc_roles=[""],
        merge_fields=[],
    )

    template_id = "5de8179668f2033afac48da1868d0093bf133266"

    try:
        response = embedded_api.embedded_edit_url(template_id, data)
        pprint(response)
    except ApiException as e:
        print("Exception when calling Dropbox Sign API: %s\n" % e)

Get Signature Request

Legacy SDK - Get Signature RequestNew SDK - Get Signature Request
Copy
Copied
hs_client.get_signature_request("fa5c8a0b0f492d768749333ad6fcc214c111e967")
Copy
Copied
from pprint import pprint

from dropbox_sign import \
    ApiClient, ApiException, Configuration, apis, models

configuration = Configuration(
    username="YOUR_API_KEY",
)

with ApiClient(configuration) as api_client:
    signature_request_api = apis.SignatureRequestApi(api_client)

    signature_request_id = "fa5c8a0b0f492d768749333ad6fcc214c111e967"

    try:
        response = signature_request_api.signature_request_get(signature_request_id)
        pprint(response)
    except ApiException as e:
        print("Exception when calling Dropbox Sign API: %s\n" % e)

List Signature Requests

Legacy SDK - List Signature RequestsNew SDK - List Signature Requests
Copy
Copied
hs_client.get_signature_request_list(
  page=1,
  page_size= 30
)
Copy
Copied
from pprint import pprint

from dropbox_sign import \
    ApiClient, ApiException, Configuration, apis, models

configuration = Configuration(
    username="YOUR_API_KEY",
)

with ApiClient(configuration) as api_client:
    signature_request_api = apis.SignatureRequestApi(api_client)

    account_id = None
    page = 1

    try:
        response = signature_request_api.signature_request_list(
            account_id=account_id,
            page=page,
        )
        pprint(response)
    except ApiException as e:
        print("Exception when calling Dropbox Sign API: %s\n" % e)

Cancel Incomplete Signature Requests

Legacy SDK - Cancel Incomplete Signature RequestsNew SDK - Cancel Incomplete Signature Requests
Copy
Copied
hs_client.cancel_signature_request("2f9781e1a8e2045224d808c153c2e1d3df6f8f2f")
Copy
Copied
from pprint import pprint

from dropbox_sign import \
    ApiClient, ApiException, Configuration, apis, models

configuration = Configuration(
    username="YOUR_API_KEY",
)

with ApiClient(configuration) as api_client:
    signature_request_api = apis.SignatureRequestApi(api_client)

    signature_request_id = "2f9781e1a8e2045224d808c153c2e1d3df6f8f2f"

    try:
        response = signature_request_api.signature_request_cancel(signature_request_id)
        pprint(response)
    except ApiException as e:
        print("Exception when calling Dropbox Sign API: %s\n" % e)

Send Signature Request

Legacy SDK - Send Signature RequestNew SDK - Send Signature RequestNew SDK - Send Signature Request with Form Fields per Document
Copy
Copied
hs_client.send_signature_request(
    test_mode=True,
    title="NDA with Acme Co.",
    subject="The NDA we talked about",
    message="Please sign this NDA and then we can discuss more. Let me know if you have any questions.",
    signers=[
        { "email_address": "jack@example.com", "name": "Jack", "order": 0 },
        { "email_address": "jill@example.com", "name": "Jill", "order": 1 }
    ],
    cc_email_addresses=["lawyer@dropboxsign.com", "lawyer@example.com"],
    files=["NDA.pdf", "AppendixA.pdf"],
    metadata={
        "client_id" : "1234",
        "custom_text" : "NDA #9"
    }
)
Copy
Copied
from pprint import pprint

from dropbox_sign import \
    ApiClient, ApiException, Configuration, apis, models

configuration = Configuration(
    username="YOUR_API_KEY",
)

with ApiClient(configuration) as api_client:
    signature_request_api = apis.SignatureRequestApi(api_client)

    signer_1 = models.SubSignatureRequestSigner(
        email_address="jack@example.com",
        name="Jack",
        order=0,
    )

    signer_2 = models.SubSignatureRequestSigner(
        email_address="jill@example.com",
        name="Jill",
        order=1,
    )

    signing_options = models.SubSigningOptions(
        draw=True,
        type=True,
        upload=True,
        phone=True,
        default_type="draw",
    )

    field_options = models.SubFieldOptions(
        date_format="DD - MM - YYYY",
    )

    data = models.SignatureRequestSendRequest(
        title="NDA with Acme Co.",
        subject="The NDA we talked about",
        message="Please sign this NDA and then we can discuss more. Let me know if you have any questions.",
        signers=[signer_1, signer_2],
        cc_email_addresses=[
            "lawyer@dropboxsign.com",
            "lawyer@example.com",
        ],
        file_urls=["https://www.dropbox.com/s/6a82hbnac76smik/Testing%20Document%203%20pages.pdf?dl=1"],
        metadata={
            "custom_id": 1234,
            "custom_text": "NDA #9",
        },
        signing_options=signing_options,
        field_options=field_options,
        test_mode=True,
    )

    try:
        response = signature_request_api.signature_request_send(data)
        pprint(response)
    except ApiException as e:
        print("Exception when calling Dropbox Sign API: %s\n" % e)
Copy
Copied
from pprint import pprint

from dropbox_sign import \
    ApiClient, ApiException, Configuration, apis, models

configuration = Configuration(
    username="YOUR_API_KEY",
)

with ApiClient(configuration) as api_client:
    api = apis.SignatureRequestApi(api_client)

    signer_1 = models.SubSignatureRequestSigner(
        email_address="hnguyen+openapi@dropbox.com",
        name="Jack",
        order=0,
    )

    signing_options = models.SubSigningOptions(
        draw=True,
        type=True,
        upload=True,
        phone=True,
        default_type="draw",
    )

    field_options = models.SubFieldOptions(
        date_format="DD - MM - YYYY",
    )

    first_name = models.SubCustomField(
        name="first_name",
        value="John"
    )

    is_registered = models.SubCustomField(
        name="is_registered",
        value="1"
    )

    form_fields_per_document_signature = models.SubFormFieldsPerDocumentSignature(
        type="signature",
        document_index=0,
        api_id="4688957689",
        name="signature1",
        x=50,
        y=70,
        width=60,
        height=30,
        required=True,
        signer=0,
        page=1
    )

    form_fields_per_document_initials = models.SubFormFieldsPerDocumentInitials(
        type="initials",
        document_index=0,
        api_id="135146356",
        name="initials1",
        x=50,
        y=120,
        width=60,
        height=30,
        required=True,
        signer=0,
        page=1
    )

    form_fields_per_document_date_signed = models.SubFormFieldsPerDocumentDateSigned(
        type="date_signed",
        document_index=0,
        api_id="537468579",
        name="date_signed1",
        x=50,
        y=170,
        width=60,
        height=30,
        required=True,
        signer=0,
        page=1
    )

    form_fields_per_document_text = models.SubFormFieldsPerDocumentText(
        type="text",
        document_index=0,
        api_id="4686488468",
        name="text1",
        x=50,
        y=220,
        width=60,
        height=30,
        required=True,
        signer=0,
        page=1
    )

    form_fields_per_document_text_merge = models.SubFormFieldsPerDocumentTextMerge(
        type="text-merge",
        document_index=0,
        api_id="37879768",
        name="first_name",
        x=50,
        y=270,
        width=60,
        height=30,
        required=True,
        signer=0,
        page=1
    )

    form_fields_per_document_checkbox = models.SubFormFieldsPerDocumentCheckbox(
        type="checkbox",
        document_index=0,
        api_id="58579089",
        name="checkbox1",
        x=50,
        y=320,
        width=16,
        height=16,
        required=True,
        signer=0,
        page=1
    )

    form_fields_per_document_checkbox_merge = models.SubFormFieldsPerDocumentCheckboxMerge(
        type="checkbox-merge",
        document_index=0,
        api_id="95865877",
        name="is_registered",
        x=50,
        y=370,
        width=16,
        height=16,
        required=True,
        signer=0,
        page=1
    )

    form_fields_per_document_dropdown = models.SubFormFieldsPerDocumentDropdown(
        type="dropdown",
        document_index=0,
        api_id="358674636",
        name="dropdown1",
        options=["Option 1", "Option 2"],
        content="Option 2",
        x=50,
        y=420,
        width=80,
        height=30,
        required=True,
        signer=0,
        page=1
    )

    form_fields_per_document_hyperlink = models.SubFormFieldsPerDocumentHyperlink(
        type="hyperlink",
        document_index=0,
        api_id="4786796568",
        name="hyperlink1",
        content="Click me!",
        content_url="http://example.com",
        x=50,
        y=470,
        width=60,
        height=30,
        page=1
    )

    form_fields_per_document_radio1 = models.SubFormFieldsPerDocumentRadio(
        type="radio",
        document_index=0,
        api_id="7697869",
        name="radio1",
        x=50,
        y=500,
        width=16,
        height=16,
        group="RadioItemGroup1",
        is_checked=True,
        signer=0,
        page=1
    )

    form_fields_per_document_radio2 = models.SubFormFieldsPerDocumentRadio(
        type="radio",
        document_index=0,
        api_id="46876587",
        name="radio1",
        x=100,
        y=500,
        width=16,
        height=16,
        group="RadioItemGroup1",
        is_checked=False,
        signer=0,
        page=1
    )

    form_field_group_value = models.SubFormFieldGroup(
        group_id="RadioItemGroup1",
        group_label="Radio Item Group 1",
        requirement="require_0-1"
    )

    data = models.SignatureRequestSendRequest(
        title="NDA with Acme Co.",
        subject="The NDA we talked about",
        message="Please sign this NDA and then we can discuss more. Let me know if you have any questions.",
        signers=[signer_1],
        files=[open("example_signature_request.pdf", "rb")],
        form_field_groups = [form_field_group_value],
        metadata={
            "custom_id": 1234,
            "custom_text": "NDA #9",
        },
        signing_options=signing_options,
        field_options=field_options,
        test_mode=True,
        custom_fields=[first_name, is_registered],
        form_fields_per_document=[
            form_fields_per_document_signature,
            form_fields_per_document_initials,
            form_fields_per_document_text,
            form_fields_per_document_text_merge,
            form_fields_per_document_checkbox,
            form_fields_per_document_checkbox_merge,
            form_fields_per_document_date_signed,
            form_fields_per_document_dropdown,
            form_fields_per_document_hyperlink,
            form_fields_per_document_radio1,
            form_fields_per_document_radio2
        ]
    )
    try:
        response = api.signature_request_send(data)
        pprint(response)
    except ApiException as e:
        print("Exception when calling Dropbox Sign API: %s\n" % e)

Send with Template

Legacy SDK - Send with TemplateNew SDK - Send with Template
Copy
Copied
hs_client.send_signature_request_with_template(
    test_mode=True,
    template_id="c26b8a16784a872da37ea946b9ddec7c1e11dff6",
    subject="Purchase Order",
    message="Glad we could come to an agreement.",
    signers=[{ "role_name": "Client", "name": "George", "email_address": "george@example.com" }],
    ccs=[{ "role_name": "Accounting", "email_address": "accounting@dropboxsign.com" }],
    custom_fields=[{ "Cost": "$20,000" }]
)
Copy
Copied
from pprint import pprint

from dropbox_sign import \
    ApiClient, ApiException, Configuration, apis, models

configuration = Configuration(
    username="YOUR_API_KEY",
)

with ApiClient(configuration) as api_client:
    signature_request_api = apis.SignatureRequestApi(api_client)

    signer_1 = models.SubSignatureRequestTemplateSigner(
        role="Client",
        email_address="george@example.com",
        name="George",
    )

    cc_1 = models.SubCC(
        role="Accounting",
        email_address="accounting@example.com",
    )

    custom_field_1 = models.SubCustomField(
        name="Cost",
        value="$20,000",
        editor="Client",
        required=True,
    )

    signing_options = models.SubSigningOptions(
        draw=True,
        type=True,
        upload=True,
        phone=False,
        default_type="draw",
    )

    data = models.SignatureRequestSendWithTemplateRequest(
        template_ids=["c26b8a16784a872da37ea946b9ddec7c1e11dff6"],
        subject="Purchase Order",
        message="Glad we could come to an agreement.",
        signers=[signer_1],
        ccs=[cc_1],
        custom_fields=[custom_field_1],
        signing_options=signing_options,
        test_mode=True,
    )

    try:
        response = signature_request_api.signature_request_send_with_template(data)
        pprint(response)
    except ApiException as e:
        print("Exception when calling Dropbox Sign API: %s\n" % e)

Create Embedded Signature Request

Legacy SDK - Create Embedded Signature RequestNew SDK - Create Embedded Signature Request
Copy
Copied
hs_client.send_signature_request_embedded(
    test_mode=True,
    client_id="b6b8e7deaf8f0b95c029dca049356d4a2cf9710a",
    title="NDA with Acme Co.",
    subject="The NDA we talked about",
    message="Please sign this NDA and then we can discuss more. Let me know if you have any questions.",
    signers=[
        { "email_address": "jack@example.com", "name": "Jack", "order": 0 },
        { "email_address": "jill@example.com", "name": "Jill", "order": 1 }
    ],
    cc_email_addresses=["lawyer@dropboxsign.com", "lawyer@example.com"],
    files=["NDA.pdf", "AppendixA.pdf"]
)
Copy
Copied
from pprint import pprint

from dropbox_sign import \
    ApiClient, ApiException, Configuration, apis, models

configuration = Configuration(
    username="YOUR_API_KEY",
)

with ApiClient(configuration) as api_client:
    signature_request_api = apis.SignatureRequestApi(api_client)

    signer_1 = models.SubSignatureRequestSigner(
        email_address="jack@example.com",
        name="Jack",
        order=0,
    )

    signer_2 = models.SubSignatureRequestSigner(
        email_address="jill@example.com",
        name="Jill",
        order=1,
    )

    signing_options = models.SubSigningOptions(
        draw=True,
        type=True,
        upload=True,
        phone=True,
        default_type="draw",
    )

    data = models.SignatureRequestCreateEmbeddedRequest(
        client_id="ec64a202072370a737edf4a0eb7f4437",
        title="NDA with Acme Co.",
        subject="The NDA we talked about",
        message="Please sign this NDA and then we can discuss more. Let me know if you have any questions.",
        signers=[signer_1, signer_2],
        cc_email_addresses=["lawyer@dropboxsign.com", "lawyer@example.com"],
        file_urls=["https://app.hellosign.com/docs/example_signature_request.pdf"],
        signing_options=signing_options,
        test_mode=True,
    )

    try:
        response = signature_request_api.signature_request_create_embedded(data)
        pprint(response)
    except ApiException as e:
        print("Exception when calling Dropbox Sign API: %s\n" % e)

Create Embedded Signature Request with Template

Legacy SDK - Create Embedded Signature Request with TemplateNew SDK - Create Embedded Signature Request with Template
Copy
Copied
hs_client.send_signature_request_embedded_with_template(
    test_mode=True,
    client_id="b6b8e7deaf8f0b95c029dca049356d4a2cf9710a",
    template_id="c26b8a16784a872da37ea946b9ddec7c1e11dff6",
    title="NDA with Acme Co.",
    subject="The NDA we talked about",
    message="Please sign this NDA and then we can discuss more. Let me know if you have any questions.",
    signers=[
        { "role_name": "Client", "email_address": "jack@example.com", "name": "Jack", "order": 0 },
        { "role_name": "Client", "email_address": "jill@example.com", "name": "Jill", "order": 1 }
    ],
    ccs=[{ "role_name": "Accounting", "email_address": "lawyer@dropboxsign.com" }],
    custom_fields=[{ "Cost": "$20,000" }]
)
Copy
Copied
from pprint import pprint

from dropbox_sign import \
    ApiClient, ApiException, Configuration, apis, models

configuration = Configuration(
    username="YOUR_API_KEY",
)

with ApiClient(configuration) as api_client:
    signature_request_api = apis.SignatureRequestApi(api_client)

    signer_1 = models.SubSignatureRequestTemplateSigner(
        role="Client",
        email_address="jack@example.com",
        name="Jack",
    )

    signing_options = models.SubSigningOptions(
        draw=True,
        type=True,
        upload=True,
        phone=True,
        default_type="draw",
    )

    data = models.SignatureRequestCreateEmbeddedWithTemplateRequest(
        client_id="ec64a202072370a737edf4a0eb7f4437",
        template_ids=["c26b8a16784a872da37ea946b9ddec7c1e11dff6"],
        subject="Purchase Order",
        message="Glad we could come to an agreement.",
        signers=[signer_1],
        signing_options=signing_options,
        test_mode=True,
    )

    try:
        response = signature_request_api.signature_request_create_embedded_with_template(data)
        pprint(response)
    except ApiException as e:
        print("Exception when calling Dropbox Sign API: %s\n" % e)

Send Request Reminder

Legacy SDK - Send Request ReminderNew SDK - Send Request Reminder
Copy
Copied
hs_client.remind_signature_request(
    signature_request_id="2f9781e1a8e2045224d808c153c2e1d3df6f8f2f",
    email_address="john@example.com"
)
Copy
Copied
from pprint import pprint

from dropbox_sign import \
    ApiClient, ApiException, Configuration, apis, models

configuration = Configuration(
    username="YOUR_API_KEY",
)

with ApiClient(configuration) as api_client:
    signature_request_api = apis.SignatureRequestApi(api_client)

    data = models.SignatureRequestRemindRequest(
        email_address="john@example.com",
    )

    signature_request_id = "2f9781e1a8e2045224d808c153c2e1d3df6f8f2f"

    try:
        response = signature_request_api.signature_request_remind(signature_request_id, data)
        pprint(response)
    except ApiException as e:
        print("Exception when calling Dropbox Sign API: %s\n" % e)

Remove Signature Request Access

Legacy SDK - Remove Signature Request AccessNew SDK - Remove Signature Request Access
Copy
Copied
hs_client.remove_signature_request_access("signature_request_id")
Copy
Copied
from pprint import pprint

from dropbox_sign import \
    ApiClient, ApiException, Configuration, apis, models

configuration = Configuration(
    username="YOUR_API_KEY",
)

with ApiClient(configuration) as api_client:
    signature_request_api = apis.SignatureRequestApi(api_client)

    signature_request_id = "2f9781e1a8e2045224d808c153c2e1d3df6f8f2f"

    try:
        response = signature_request_api.signature_request_remove(signature_request_id)
        pprint(response)
    except ApiException as e:
        print("Exception when calling Dropbox Sign API: %s\n" % e)

Update Signature Request

Legacy SDK - Update Signature RequestNew SDK - Update Signature Request
Copy
Copied
hs_client.update_signature_request(
    signature_request_id="signature_request_id",
    signature_id="signature_id",
    email_address="new_email_address@example.com"
)
Copy
Copied
from pprint import pprint

from dropbox_sign import \
    ApiClient, ApiException, Configuration, apis, models

configuration = Configuration(
    username="YOUR_API_KEY",
)

with ApiClient(configuration) as api_client:
    signature_request_api = apis.SignatureRequestApi(api_client)

    data = models.SignatureRequestUpdateRequest(
        email_address="john@example.com",
        signature_id="78caf2a1d01cd39cea2bc1cbb340dac3",
    )

    signature_request_id = "2f9781e1a8e2045224d808c153c2e1d3df6f8f2f"

    try:
        response = signature_request_api.signature_request_update(signature_request_id, data)
        pprint(response)
    except ApiException as e:
        print("Exception when calling Dropbox Sign API: %s\n" % e)

Get Team

Legacy SDK - Get TeamNew SDK - Get Team
Copy
Copied
client.get_team_info()
Copy
Copied
from pprint import pprint

from dropbox_sign import \
    ApiClient, ApiException, Configuration, apis, models

configuration = Configuration(
    username="YOUR_API_KEY",
)

with ApiClient(configuration) as api_client:
    team_api = apis.TeamApi(api_client)

    try:
        response = team_api.team_get()
        pprint(response)
    except ApiException as e:
        print("Exception when calling Dropbox Sign API: %s\n" % e)

Get Templates

Legacy SDK - Get TemplatesNew SDK - Get Templates
Copy
Copied
hs_client.get_template("f57db65d3f933b5316d398057a36176831451a35")
Copy
Copied
from pprint import pprint

from dropbox_sign import \
    ApiClient, ApiException, Configuration, apis, models

configuration = Configuration(
    username="YOUR_API_KEY",
)

with ApiClient(configuration) as api_client:
    template_api = apis.TemplateApi(api_client)

    template_id = "f57db65d3f933b5316d398057a36176831451a35"

    try:
        response = template_api.template_get(template_id)
        pprint(response)
    except ApiException as e:
        print("Exception when calling Dropbox Sign API: %s\n" % e)

List Templates

Legacy SDK - List TemplatesNew SDK - List Templates
Copy
Copied
hs_client.get_template_list(page=1)
Copy
Copied
from pprint import pprint

from dropbox_sign import \
    ApiClient, ApiException, Configuration, apis, models

configuration = Configuration(
    username="YOUR_API_KEY",
)

with ApiClient(configuration) as api_client:
    template_api = apis.TemplateApi(api_client)

    account_id = "f57db65d3f933b5316d398057a36176831451a35"

    try:
        response = template_api.template_list(
            account_id=account_id,
        )
        pprint(response)
    except ApiException as e:
        print("Exception when calling Dropbox Sign API: %s\n" % e)

Create Embedded Template Draft

Legacy SDK - Create Embedded Template DraftNew SDK - Create Embedded Template Draft
Copy
Copied
files = ["/docs/nda.pdf"]
signer_roles = [
    {"name": "Baltar", "order": 1},
    {"name": "Madame President", "order": 2},
    {"name": "Lee Adama", "order": 3},
]
cc_roles = ["Deck Chief", "Admiral","Starbuck"]
merge_fields = [{"name":"mymerge", "type":"text"}]

template_draft = hs_client.create_embedded_template_draft(
    client_id="26916815c3fbd2622de90ce9b0b115cc",
    signer_roles=signer_roles,
    test_mode=True,
    files=files,
    title="Battlestar Test Draft",
    subject="There are cylons onboard",
    message="Halp",
    cc_roles=cc_roles,
    merge_fields=merge_fields
)

template_id = template_draft.template_id
Copy
Copied
from pprint import pprint

from dropbox_sign import \
    ApiClient, ApiException, Configuration, apis, models

configuration = Configuration(
    username="YOUR_API_KEY",
)

with ApiClient(configuration) as api_client:
    template_api = apis.TemplateApi(api_client)

    role_1 = models.SubTemplateRole(
        name="Client",
        order=0,
    )

    role_2 = models.SubTemplateRole(
        name="Witness",
        order=1,
    )

    merge_field_1 = models.SubMergeField(
        name="Full Name",
        type="text",
    )

    merge_field_2 = models.SubMergeField(
        name="Is Registered?",
        type="checkbox",
    )

    field_options = models.SubFieldOptions(
        date_format="DD - MM - YYYY",
    )

    data = models.TemplateCreateEmbeddedDraftRequest(
        client_id="37dee8d8440c66d54cfa05d92c160882",
        file_urls=["https://app.hellosign.com/docs/example_signature_request.pdf"],
        title="Test Template",
        subject="Please sign this document",
        message="For your approval",
        signer_roles=[role_1, role_2],
        cc_roles=["Manager"],
        merge_fields=[merge_field_1, merge_field_2],
        field_options=field_options,
        test_mode=True,
    )

    try:
        response = template_api.template_create_embedded_draft(data)
        pprint(response)
    except ApiException as e:
        print("Exception when calling Dropbox Sign API: %s\n" % e)

Get Template Files

Legacy SDK - Get Template FilesNew SDK - Get Template Files
Copy
Copied
hs_client.get_template_files("5de8179668f2033afac48da1868d0093bf133266", "download.pdf")
Copy
Copied
from pprint import pprint

from dropbox_sign import \
    ApiClient, ApiException, Configuration, apis, models

configuration = Configuration(
    username="YOUR_API_KEY",
)

with ApiClient(configuration) as api_client:
    template_api = apis.TemplateApi(api_client)

    template_id = "5de8179668f2033afac48da1868d0093bf133266"

    try:
        response = template_api.template_files(template_id)
        pprint(response)
    except ApiException as e:
        print("Exception when calling Dropbox Sign API: %s\n" % e)

Create Embedded Unclaimed Draft

Legacy SDK - Create Embedded Unclaimed DraftNew SDK - Create Embedded Unclaimed Draft
Copy
Copied
hs_client.create_embedded_unclaimed_draft(
    test_mode=True,
    client_id="ca1209bc08912a8a881234def21352ab",
    draft_type="signature_request",
    requester_email_address="jack@dropboxsign.com",
    is_for_embedded_signing=True,
    subject="The NDA we talked about",
    files=["NDA.pdf"]
)
Copy
Copied
from pprint import pprint

from dropbox_sign import \
    ApiClient, ApiException, Configuration, apis, models

configuration = Configuration(
    username="YOUR_API_KEY",
)

with ApiClient(configuration) as api_client:
    unclaimed_draft_api = apis.UnclaimedDraftApi(api_client)

    data = models.UnclaimedDraftCreateEmbeddedRequest(
        client_id="ec64a202072370a737edf4a0eb7f4437",
        file_urls=["https://app.hellosign.com/docs/example_signature_request.pdf"],
        requester_email_address="jack@dropboxsign.com",
        test_mode=True,
    )

    try:
        response = unclaimed_draft_api.unclaimed_draft_create_embedded(data)
        pprint(response)
    except ApiException as e:
        print("Exception when calling Dropbox Sign API: %s\n" % e)

Create Embedded Unclaimed Draft with Template

Legacy SDK - Create Embedded Unclaimed Draft with TemplateNew SDK - Create Embedded Unclaimed Draft with Template
Copy
Copied
signers = [{
    "name": "Signer Name",
    "email_address": "signer@example.com",
    "role_name": "Signer"
}]
metadata = {
    "account_id": "123",
    "company_name": "Acme Co."
}

templateDraft = hs_client.create_embedded_unclaimed_draft_with_template(
    test_mode=True,
    client_id="26916815c3fbd2622de90ce9b0b115cc",
    is_for_embedded_signing=True,
    template_id="d3a772a6955a8f97f6b1d4f127a2f485d5546299",
    requester_email_address="user@example.com",
    title="MyDraft",
    subject="Unclaimed Draft Email Subject",
    message="Email Message",
    signers=signers,
    signing_redirect_url="http://url.com",
    requesting_redirect_url="http://url.com",
    metadata=metadata
)
url = templateDraft.claim_url
Copy
Copied
from pprint import pprint

from dropbox_sign import \
    ApiClient, ApiException, Configuration, apis, models

configuration = Configuration(
    username="YOUR_API_KEY",
)

with ApiClient(configuration) as api_client:
    unclaimed_draft_api = apis.UnclaimedDraftApi(api_client)

    signer_1 = models.SubUnclaimedDraftTemplateSigner(
        role="Client",
        name="George",
        email_address="george@example.com",
    )

    cc_1 = models.SubCC(
        role="Accounting",
        email_address="accounting@example.com",
    )

    data = models.UnclaimedDraftCreateEmbeddedWithTemplateRequest(
        client_id="ec64a202072370a737edf4a0eb7f4437",
        template_ids=["61a832ff0d8423f91d503e76bfbcc750f7417c78"],
        requester_email_address="jack@dropboxsign.com",
        signers=[signer_1],
        ccs=[cc_1],
        test_mode=True,
    )

    try:
        response = unclaimed_draft_api.unclaimed_draft_create_embedded_with_template(data)
        pprint(response)
    except ApiException as e:
        print("Exception when calling Dropbox Sign API: %s\n" % e)

Supporting Legacy SDKs

Following the official release of the new SDK version, we'll be preparing to deprecate all legacy versions of the Python SDK for one year after launch. That means, once fully launched, we'll only support critical vulnerabilities and bug fixes for legacy SDK versions 4.0.0 for 12 months. After that, legacy versions are considered officially deprecated and are no longer supported. You can find more information in our SDK Versioning Policy.

We encourage you to start migrating (or planning to migrate) to the new SDK as soon as possible. Please don't hesitate to reach out if you have questions or need assistance.


Feedback and Assistance

We know that dealing with "breaking" changes is inconvenient for those of you currently using the legacy SDK, but believe the new SDK offers a better experience while providing access to more features. If you need help or get stuck, please reach out to API support: Submit a Ticket

We warmly welcome your feedback, feature requests, and bug reports in our OpenAPI repo. All of the engineering work on the Python SDK happens in the Python folder of the repo.