Python Migration Guide

View as Markdown

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:

    1 python -m pip install dropbox-sign

Install from GitHub

  1. To install from GitHub run:

    1 python -m pip install git+
    2 https://github.com/hellosign
    3 /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.

1from hellosign_sdk import HSClient

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).

1# Initialize using email and password
2client = HSClient(email_address="api_user@example.com", password="your_password")
3
4# Initialize using api key
5client = HSClient(api_key="YOUR_API_KEY")
6
7# Initialize using api token
8client = HSClient(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

1configuration = Configuration(username="YOUR_API_KEY")
2
3with ApiClient(configuration) as api_client:
4 account_api = apis.AccountApi(api_client)

The new SDK divides endpoints across unique Classes:


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.

1hs_client.send_signature_request_embedded(
2 test_mode=True,
3 client_id="b6b8e7deaf8f0b95c029dca049356d4a2cf9710a",
4 title="NDA with Acme Co.",
5 subject="The NDA we talked about",
6 message="Please sign this NDA and then we can discuss more. Let me know if you have any questions.",
7 signers=[
8 { "email_address": "jack@example.com", "name": "Jack", "order": 0 },
9 { "email_address": "jill@example.com", "name": "Jill", "order": 1 }
10 ],
11 cc_email_addresses=["lawyer@dropboxsign.com", "lawyer@example.com"],
12 files=["NDA.pdf", "ApendixA.pdf"]
13)

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

1hs_client.remind_signature_request(
2 signature_request_id="2f9781e1a8e2045224d808c153c2e1d3df6f8f2f",
3 email_address="john@example.com"
4)

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

1from pprint import pprint
2
3from dropbox_sign import \
4 ApiClient, ApiException, Configuration, apis, models
5
6configuration = Configuration(
7 username="YOUR_API_KEY",
8)
9
10with ApiClient(configuration) as api_client:
11 signature_request_api = apis.SignatureRequestApi(api_client)
12
13 data = models.SignatureRequestRemindRequest(
14 email_address="john@example.com",
15 )
16
17 signature_request_id = "2f9781e1a8e2045224d808c153c2e1d3df6f8f2f"
18
19 try:
20 response = signature_request_api.signature_request_remind(signature_request_id, data)
21 pprint(response)
22 except ApiException as e:
23 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

New SDK - Error Handling
1from pprint import pprint
2
3from dropbox_sign import \
4 ApiClient, ApiException, Configuration, apis
5
6configuration = Configuration(
7 username="YOUR_API_KEY",
8)
9
10with ApiClient(configuration) as api_client:
11 api = apis.AccountApi(api_client)
12
13 try:
14 response = api.account_get(email_address="jack@example.com")
15 pprint(response)
16 except ApiException as e:
17 print("Exception when calling Dropbox Sign API: %s\n" % e)

Warnings

Warnings are a list of WarningResponse.

New SDK - Warnings

1from pprint import pprint
2
3from dropbox_sign import \
4 ApiClient, ApiException, Configuration, apis, models
5
6configuration = Configuration(
7 username="YOUR_API_KEY",
8)
9
10with ApiClient(configuration) as api_client:
11 api = apis.AccountApi(api_client)
12
13 data = models.AccountCreateRequest(
14 email_address="newuser@dropboxsign.com",
15 )
16
17 try:
18 response = api.account_create(data)
19 pprint(response)
20
21 # warning loop
22 for warning in response.warnings:
23 print("Warning Name: %s\n" % warning.warning_name)
24 print("Warning Message: %s\n" % warning.warning_msg)
25 except ApiException as e:
26 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
1signer_1 = models.SubSignatureRequestSigner(
2 email_address="jack@example.com",
3 name="Jack",
4 order=0,
5)
6
7attachment_1 = models.SubAttachment(
8 name="Attachment 1",
9 instructions="Please download this file",
10 signer_index=0,
11 required=True
12)
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

$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

1{
2 "event": {
3 "event_type": "account_confirmed",
4 "event_time": "1669926463",
5 "event_hash": "ff8b03439122f9160500c3fb855bdee5a9ccba5fff27d3b258745d8f3074832f",
6 "event_metadata": {
7 "related_signature_id": null,
8 "reported_for_account_id": "6421d70b9bd45059fa207d03ab8d1b96515b472c",
9 "reported_for_app_id": null,
10 "event_message": null
11 }
12 }
13}

How to use the EventCallbackHelper

1from dropbox_sign import EventCallbackHelper
2from dropbox_sign.models import EventCallbackRequest
3
4import json
5
6# use your API key
7api_key = "324e3b0840f065eb51f3fd63231d0d33daa35d4ed10d27718839e81737065782"
8
9# callback_data represents data we send to you
10callback_data = json.loads(request.POST.get('json', ''))
11
12callback_event = EventCallbackRequest.init(callback_data)
13
14# verify that a callback came from HelloSign.com
15if EventCallbackHelper.is_valid(api_key, callback_event):
16 # one of "account_callback" or "api_app_callback"
17 callback_type = EventCallbackHelper.get_callback_type(callback_event)
18
19 # 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.

1hs_client.send_signature_request(
2 test_mode=True,
3 files=["NDA.pdf", "AppendixA.pdf"],
4 title="NDA with Acme Co.",
5 subject="The NDA we talked about",
6 message="Please sign this NDA and then we can discuss more.",
7 signers=[
8 {
9 "email_address": "jill@example.com",
10 "name": "Jill",
11 "order": 1
12 }
13 ],
14 form_fields_per_document=[
15 [
16 {
17 "api_id": "abcd",
18 "name": "signer_signature",
19 "type": "signature",
20 "x": 200,
21 "y": 300,
22 "page": 1,
23 "width": 280,
24 "height": 72,
25 "required": True,
26 "signer": 0
27 }
28 ]
29 ]
30)

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:

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

1# instantiates a new `SubFormFieldsPerDocumentSignature` object
2form_fields_per_document_signature = models.SubFormFieldsPerDocumentBase(
3 type="signature",
4 document_index=0,
5 api_id="4688957689",
6 name="signature1",
7 x=5,
8 y=7,
9 width=60,
10 height=30,
11 required=True,
12 signer=0,
13 page=1,
14)

You can use .init()

1# instantiates a new `SignatureRequestSendRequest` object
2data = models.SignatureRequestSendRequest.init({
3 "test_mode": True,
4 "files": [open("pdf-sample.pdf", "rb")],
5 "title": "NDA with Acme Co.",
6 "subject": "The NDA we talked about",
7 "message": "Please sign this NDA and then we can discuss more.",
8 "signers": [
9 {
10 "email_address": "jill@example.com",
11 "name": "Jill",
12 "order": 1
13 }
14 ],
15 # instantiates a new `SubFormFieldsPerDocumentSignature` object
16 "form_fields_per_document": [
17 {
18 "type": "signature",
19 "document_index": 0,
20 "api_id": "4688957689",
21 "name": "signature1",
22 "x": 5,
23 "y": 7,
24 "width": 60,
25 "height": 30,
26 "required": True,
27 "signer": 0,
28 "page": 1,
29 }
30 ]
31})

You can instantiate the class directly

1# instantiates a new `SubFormFieldsPerDocumentSignature` object
2form_fields_per_document_signature = models.SubFormFieldsPerDocumentSignature(
3 type="signature",
4 document_index=0,
5 api_id="4688957689",
6 name="signature1",
7 x=5,
8 y=7,
9 width=60,
10 height=30,
11 required=True,
12 signer=0,
13 page=1,
14)

Form Fields per Document Examples using the new SDK:

1form_fields_per_document_signature = models.SubFormFieldsPerDocumentSignature(
2 type="signature",
3 document_index=0,
4 api_id="4688957689",
5 name="signature1",
6 x=5,
7 y=7,
8 width=60,
9 height=30,
10 required=True,
11 signer=0,
12 page=1
13)

“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:

1{
2 "signers": {
3 "Client": {
4 "name": "George",
5 "email_address": "george@example.com"
6 },
7 "Manager": {
8 "name": "Bob",
9 "email_address": "bob@example.com"
10 }
11 }
12}

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

1from pprint import pprint
2
3from dropbox_sign import \
4 ApiClient, ApiException, Configuration, apis, models
5
6configuration = Configuration(
7 username="YOUR_API_KEY",
8)
9
10with ApiClient(configuration) as api_client:
11 signature_request_api = apis.SignatureRequestApi(api_client)
12
13 data = models.SignatureRequestSendWithTemplateRequest.init({
14 "template_ids": ["c26b8a16784a872da37ea946b9ddec7c1e11dff6"],
15 "subject": "Purchase Order",
16 "message": "Glad we could come to an agreement.",
17 "signers": [
18 {
19 "role": "Client",
20 "name": "George",
21 "email_address": "george@example.com"
22 },
23 {
24 "role": "Manager",
25 "name": "Bob",
26 "email_address": "bob@example.com"
27 }
28 ],
29 })
30
31 try:
32 response = signature_request_api.signature_request_send_with_template(data)
33 pprint(response)
34 except ApiException as e:
35 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:

1{
2 "ccs": {
3 "Client": "george@example.com",
4 "Manager": "bob@example.com"
5 }
6}

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

1from pprint import pprint
2
3from dropbox_sign import \
4 ApiClient, ApiException, Configuration, apis, models
5
6configuration = Configuration(
7 username="YOUR_API_KEY",
8)
9
10with ApiClient(configuration) as api_client:
11 signature_request_api = apis.SignatureRequestApi(api_client)
12
13 data = models.SignatureRequestSendWithTemplateRequest.init({
14 "template_ids": ["c26b8a16784a872da37ea946b9ddec7c1e11dff6"],
15 "subject": "Purchase Order",
16 "message": "Glad we could come to an agreement.",
17 "signers": [
18 {
19 "role": "Client",
20 "name": "George",
21 "email_address": "george@example.com"
22 },
23 {
24 "role": "Manager",
25 "name": "Bob",
26 "email_address": "bob@example.com"
27 }
28 ],
29 "ccs": [
30 {
31 "role": "Client",
32 "email_address": "george@example.com"
33 },
34 {
35 "role": "Manager",
36 "email_address": "bob@example.com"
37 }
38 ]
39 })
40
41 try:
42 response = signature_request_api.signature_request_send_with_template(data)
43 pprint(response)
44 except ApiException as e:
45 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:

1{
2 "custom_fields": {
3 "company": {
4 "value": "ABC Corp",
5 "required": true
6 }
7 }
8}

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

1from pprint import pprint
2
3from dropbox_sign import \
4 ApiClient, ApiException, Configuration, apis, models
5
6configuration = Configuration(
7 username="YOUR_API_KEY",
8)
9
10with ApiClient(configuration) as api_client:
11 signature_request_api = apis.SignatureRequestApi(api_client)
12
13 data = models.SignatureRequestSendWithTemplateRequest.init({
14 "template_ids": ["c26b8a16784a872da37ea946b9ddec7c1e11dff6"],
15 "subject": "Purchase Order",
16 "message": "Glad we could come to an agreement.",
17 "signers": [
18 {
19 "role": "Client",
20 "name": "George",
21 "email_address": "george@example.com"
22 },
23 {
24 "role": "Manager",
25 "name": "Bob",
26 "email_address": "bob@example.com"
27 }
28 ],
29 "custom_fields": [
30 {
31 "name": "company",
32 "value": "ABC Corp",
33 "required": True
34 },
35 ]
36 })
37
38 try:
39 response = signature_request_api.signature_request_send_with_template(data)
40 pprint(response)
41 except ApiException as e:
42 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

1from pprint import pprint
2
3from dropbox_sign import \
4 ApiClient, ApiException, Configuration, apis, models
5
6configuration = Configuration(
7 # Configure HTTP basic authorization: api_key
8 username="YOUR_API_KEY",
9)
10
11with ApiClient(configuration) as api_client:
12 signature_request_api = apis.SignatureRequestApi(api_client)
13
14 signer = models.SubSignatureRequestSigner(
15 email_address="jack@example.com",
16 name="Jack",
17 )
18 # Reads file in binary format. File pointer placed at start of file.
19 your_file = open("YOUR_FULL_FILE_PATH", "rb")
20
21 data = models.SignatureRequestSendRequest(
22 title="NDA with Acme Co.",
23 subject="The NDA we talked about",
24 message="Please sign this NDA and then we can discuss more. Let me know if you have any questions.",
25 signers=[signer],
26 files=[your_file],
27 test_mode=True,
28 )
29
30 try:
31 response = signature_request_api.signature_request_send(data)
32 # closes the file
33 your_file.close()
34 pprint(response)
35 except ApiException as e:
36 print("Exception when calling Dropbox Sign API: %s\n" % e)
37 # closes the file
38 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
1hs_client = HSClient(api_key="YOUR_API_KEY")
2hs_client.get_signature_request_file(
3 signature_request_id="fa5c8a0b0f492d768749333ad6fcc214c111e967",
4 filename="files.pdf",
5 file_type="pdf"
6)

Downloading Templates

1hs_client = HSClient(api_key="SIGN_IN_AND_CREATE_API_KEY_FIRST")
2hs_client.get_template_files("5de8179668f2033afac48da1868d0093bf133266", "download.pdf")

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

1hs_client = HSClient(api_key="your_api_key")
2account = hs_client.get_account_info()
3
4print hs_client.account.email_address

Create API App

New Python SDK

This feature was introduced in the new Python SDK.

1// unavailable in legacy SDK

Get API App

1hs_client = HSClient(api_key="api_key")
2hs_client.get_api_app_info(
3 client_id="client_id"
4)

Get Bulk Send Job

New Python SDK

This feature was introduced in the new Python SDK.

1// Feature unavailable in legacy SDK

Get Embedded Sign Url

1hs_client.get_embedded_object("50e3542f738adfa7ddd4cbd4c00d2a8ab6e4194b")

Get Embedded Template Edit Url

1embeddedObj = hs_client.get_template_edit_url("5de8179668f2033afac48da1868d0093bf133266")
2edit_url = embeddedObj.edit_url

Get Signature Request

1hs_client.get_signature_request("fa5c8a0b0f492d768749333ad6fcc214c111e967")

List Signature Requests

1hs_client.get_signature_request_list(
2 page=1,
3 page_size= 30
4)

Cancel Incomplete Signature Requests

1hs_client.cancel_signature_request("2f9781e1a8e2045224d808c153c2e1d3df6f8f2f")

Send Signature Request

1hs_client.send_signature_request(
2 test_mode=True,
3 title="NDA with Acme Co.",
4 subject="The NDA we talked about",
5 message="Please sign this NDA and then we can discuss more. Let me know if you have any questions.",
6 signers=[
7 { "email_address": "jack@example.com", "name": "Jack", "order": 0 },
8 { "email_address": "jill@example.com", "name": "Jill", "order": 1 }
9 ],
10 cc_email_addresses=["lawyer@dropboxsign.com", "lawyer@example.com"],
11 files=["NDA.pdf", "AppendixA.pdf"],
12 metadata={
13 "client_id" : "1234",
14 "custom_text" : "NDA #9"
15 }
16)

Send with Template

1hs_client.send_signature_request_with_template(
2 test_mode=True,
3 template_id="c26b8a16784a872da37ea946b9ddec7c1e11dff6",
4 subject="Purchase Order",
5 message="Glad we could come to an agreement.",
6 signers=[{ "role_name": "Client", "name": "George", "email_address": "george@example.com" }],
7 ccs=[{ "role_name": "Accounting", "email_address": "accounting@dropboxsign.com" }],
8 custom_fields=[{ "Cost": "$20,000" }]
9)

Create Embedded Signature Request

1hs_client.send_signature_request_embedded(
2 test_mode=True,
3 client_id="b6b8e7deaf8f0b95c029dca049356d4a2cf9710a",
4 title="NDA with Acme Co.",
5 subject="The NDA we talked about",
6 message="Please sign this NDA and then we can discuss more. Let me know if you have any questions.",
7 signers=[
8 { "email_address": "jack@example.com", "name": "Jack", "order": 0 },
9 { "email_address": "jill@example.com", "name": "Jill", "order": 1 }
10 ],
11 cc_email_addresses=["lawyer@dropboxsign.com", "lawyer@example.com"],
12 files=["NDA.pdf", "AppendixA.pdf"]
13)

Create Embedded Signature Request with Template

1hs_client.send_signature_request_embedded_with_template(
2 test_mode=True,
3 client_id="b6b8e7deaf8f0b95c029dca049356d4a2cf9710a",
4 template_id="c26b8a16784a872da37ea946b9ddec7c1e11dff6",
5 title="NDA with Acme Co.",
6 subject="The NDA we talked about",
7 message="Please sign this NDA and then we can discuss more. Let me know if you have any questions.",
8 signers=[
9 { "role_name": "Client", "email_address": "jack@example.com", "name": "Jack", "order": 0 },
10 { "role_name": "Client", "email_address": "jill@example.com", "name": "Jill", "order": 1 }
11 ],
12 ccs=[{ "role_name": "Accounting", "email_address": "lawyer@dropboxsign.com" }],
13 custom_fields=[{ "Cost": "$20,000" }]
14)

Send Request Reminder

1hs_client.remind_signature_request(
2 signature_request_id="2f9781e1a8e2045224d808c153c2e1d3df6f8f2f",
3 email_address="john@example.com"
4)

Remove Signature Request Access

1hs_client.remove_signature_request_access("signature_request_id")

Update Signature Request

1hs_client.update_signature_request(
2 signature_request_id="signature_request_id",
3 signature_id="signature_id",
4 email_address="new_email_address@example.com"
5)

Get Team

1client.get_team_info()

Get Templates

1hs_client.get_template("f57db65d3f933b5316d398057a36176831451a35")

List Templates

1hs_client.get_template_list(page=1)

Create Embedded Template Draft

1files = ["/docs/nda.pdf"]
2signer_roles = [
3 {"name": "Baltar", "order": 1},
4 {"name": "Madame President", "order": 2},
5 {"name": "Lee Adama", "order": 3},
6]
7cc_roles = ["Deck Chief", "Admiral","Starbuck"]
8merge_fields = [{"name":"mymerge", "type":"text"}]
9
10template_draft = hs_client.create_embedded_template_draft(
11 client_id="26916815c3fbd2622de90ce9b0b115cc",
12 signer_roles=signer_roles,
13 test_mode=True,
14 files=files,
15 title="Battlestar Test Draft",
16 subject="There are cylons onboard",
17 message="Halp",
18 cc_roles=cc_roles,
19 merge_fields=merge_fields
20)
21
22template_id = template_draft.template_id

Get Template Files

1hs_client.get_template_files("5de8179668f2033afac48da1868d0093bf133266", "download.pdf")

Create Embedded Unclaimed Draft

1hs_client.create_embedded_unclaimed_draft(
2 test_mode=True,
3 client_id="ca1209bc08912a8a881234def21352ab",
4 draft_type="signature_request",
5 requester_email_address="jack@dropboxsign.com",
6 is_for_embedded_signing=True,
7 subject="The NDA we talked about",
8 files=["NDA.pdf"]
9)

Create Embedded Unclaimed Draft with Template

1signers = [{
2 "name": "Signer Name",
3 "email_address": "signer@example.com",
4 "role_name": "Signer"
5}]
6metadata = {
7 "account_id": "123",
8 "company_name": "Acme Co."
9}
10
11templateDraft = hs_client.create_embedded_unclaimed_draft_with_template(
12 test_mode=True,
13 client_id="26916815c3fbd2622de90ce9b0b115cc",
14 is_for_embedded_signing=True,
15 template_id="d3a772a6955a8f97f6b1d4f127a2f485d5546299",
16 requester_email_address="user@example.com",
17 title="MyDraft",
18 subject="Unclaimed Draft Email Subject",
19 message="Email Message",
20 signers=signers,
21 signing_redirect_url="http://url.com",
22 requesting_redirect_url="http://url.com",
23 metadata=metadata
24)
25url = templateDraft.claim_url

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.