# Python > Use this guide to migrate to the new Dropbox Sign Python SDK, which is powered by our OpenAPI specification. Contains concepts and examples to help you migrate successfully. # Python Migration Guide ## Migrating the Python SDK from `hellosign-python-sdk` to `dropbox-sign` ## Architecture and Tooling ## 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:
  1. To install from PyPI run: ```curl python -m pip install dropbox-sign ```

  1. To install from GitHub run: ```curl 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.

Importing a single HSClient provided everything in a single client.

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

```python from hellosign_sdk import HSClient ``` ```python from dropbox_sign import \ ApiClient, ApiException, Configuration, apis, models ```
### Authentication New patterns were introduced for authentication and authorization, but use the same credentials.

Pass credentials to HSClient and access all of the SDK.

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

```python Legacy SDK - HSClient # 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") ``` ```python New SDK - Configuration 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** ```python 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 Reference | API Reference | | ------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------- | | [AccountApi](https://github.com/hellosign/dropbox-sign-python/blob/main/docs/AccountApi.md) | [/account/\* Endpoints](/api/account) | | [ApiAppApi](https://github.com/hellosign/dropbox-sign-python/blob/main/docs/ApiAppApi.md) | [/api\_app/\* Endpoints](/api/api-app) | | [BulkSendJobApi](https://github.com/hellosign/dropbox-sign-python/blob/main/docs/BulkSendJobApi.md) | [/bulk\_send\_job/\* Endpoints](/api/bulk-send-job) | | [EmbeddedApi](https://github.com/hellosign/dropbox-sign-python/blob/main/docs/EmbeddedApi.md) | [/embedded/\* Endpoints](/api/embedded) | | [OAuthApi](https://github.com/hellosign/dropbox-sign-python/blob/main/docs/OAuthApi.md) | [/oauth/\* Endpoints](/docs/guides/o-auth/overview) | | [ReportApi](https://github.com/hellosign/dropbox-sign-python/blob/main/docs/ReportApi.md) | [/report/\* Endpoints](/api/report) | | [SignatureRequestApi](https://github.com/hellosign/dropbox-sign-python/blob/main/docs/SignatureRequestApi.md) | [/signature\_request/\* Endpoints](/api/signature-request) | | [TeamApi](https://github.com/hellosign/dropbox-sign-python/blob/main/docs/TeamApi.md) | [/team/\* Endpoints](/api/team) | | [TemplateApi](https://github.com/hellosign/dropbox-sign-python/blob/main/docs/TemplateApi.md) | [/template/\* Endpoints](/api/template) | | [UnclaimedDraftApi](https://github.com/hellosign/dropbox-sign-python/blob/main/docs/UnclaimedDraftApi.md) | [/unclaimed\_draft/\* Endpoints](/api/unclaimed-draft) |
### 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.

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

[Models](https://github.com/hellosign/dropbox-sign-python/blob/main/README.md#documentation-for-models) are used to define the structure and value of the parameters being passed. The fully assembled model is passed to the method.

```python Legacy SDK - No Models Needed 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"] ) ``` ```python New SDK - Using Models 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** ```python 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** ```python 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](https://github.com/hellosign/dropbox-sign-python/blob/main/dropbox_sign/exceptions.py#L100-L125) with its `body` parameter being an instance of [ErrorResponse](https://github.com/hellosign/dropbox-sign-python/blob/main/dropbox_sign/model/error_response.py) class and should be handled using Try/Except blocks. **New SDK - Error Handling** ```python New SDK - Error Handling 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](https://github.com/hellosign/dropbox-sign-python/blob/main/dropbox_sign/model/warning_response.py). **New SDK - Warnings** ```python 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 ```python New SDK - Using Constructor Arguments 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 ) ``` ```python New SDK - Using init() Static Method 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 }) ``` `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](https://github.com/hellosign/dropbox-sign-python/blob/main/dropbox_sign/event_callback_helper.py) 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** ```bash 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** ```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 } } } ``` **How to use the EventCallbackHelper** ```python 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](/docs/sd-ks/open-api/form-fields-per-document). ```python Legacy SDK - Form Fields Per Document 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 } ] ] ) ``` ```python New SDK - Form Fields Per Document 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 Type | Class | | -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | checkbox | [SubFormFieldsPerDocumentCheckbox](https://github.com/hellosign/dropbox-sign-python/blob/main/dropbox_sign/model/sub_form_fields_per_document_checkbox.py) | | checkbox-merge | [SubFormFieldsPerDocumentCheckboxMerge](https://github.com/hellosign/dropbox-sign-python/blob/main/dropbox_sign/model/sub_form_fields_per_document_checkbox_merge.py) | | date\_signed | [SubFormFieldsPerDocumentDateSigned](https://github.com/hellosign/dropbox-sign-python/blob/main/dropbox_sign/model/sub_form_fields_per_document_date_signed.py) | | dropdown | [SubFormFieldsPerDocumentDropdown](https://github.com/hellosign/dropbox-sign-python/blob/main/dropbox_sign/model/sub_form_fields_per_document_dropdown.py) | | hyperlink | [SubFormFieldsPerDocumentHyperlink](https://github.com/hellosign/dropbox-sign-python/blob/main/dropbox_sign/model/sub_form_fields_per_document_hyperlink.py) | | initials | [SubFormFieldsPerDocumentInitials](https://github.com/hellosign/dropbox-sign-python/blob/main/dropbox_sign/model/sub_form_fields_per_document_initials.py) | | radio | [SubFormFieldsPerDocumentRadio](https://github.com/hellosign/dropbox-sign-python/blob/main/dropbox_sign/model/sub_form_fields_per_document_radio.py) | | signature | [SubFormFieldsPerDocumentSignature](https://github.com/hellosign/dropbox-sign-python/blob/main/dropbox_sign/model/sub_form_fields_per_document_signature.py) | | text | [SubFormFieldsPerDocumentText](https://github.com/hellosign/dropbox-sign-python/blob/main/dropbox_sign/model/sub_form_fields_per_document_text.py) | | text-merge | [SubFormFieldsPerDocumentTextMerge](https://github.com/hellosign/dropbox-sign-python/blob/main/dropbox_sign/model/sub_form_fields_per_document_text_merge.py) | **You can use `SubFormFieldsPerDocumentBase` and it will instantiate the correct class for you** ```python # 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()`** ```python # 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** ```python # 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:** ```python Signature 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 ) ``` ```python Initials 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 ) ``` ```python Date Signed 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 ) ``` ```python Text 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 ) ``` ```python Text Merge 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 ) ``` ```python Checkbox 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 ) ``` ```python Checkbox Merge 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 ) ``` ```python Dropdown 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 ) ``` ```python Hyperlink 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 ) ``` ```python Radio 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](/api/signature-request/send-with-template) endpoint the `signers` property could be represented as: ```json Legacy SDK - signers with Roles { "signers": { "Client": { "name": "George", "email_address": "george@example.com" }, "Manager": { "name": "Bob", "email_address": "bob@example.com" } } } ``` ```json New SDK - signers with Roles { "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: ```python New SDK - signers with Roles Example #1 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) ``` ```python New SDK - signers with Roles Example #2 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](/api/signature-request/send-with-template) endpoint the `ccs` property could be represented as: ```json Legacy SDK - ccs { "ccs": { "Client": "george@example.com", "Manager": "bob@example.com" } } ``` ```json New SDK - ccs { "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: ```python New SDK - ccs Example #1 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) ``` ```python New SDK - ccs Example #2 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](/api/signature-request/send-with-template) endpoint the `custom_fields` property could be represented as: ```json Legacy SDK - custom_fields { "custom_fields": { "company": { "value": "ABC Corp", "required": true } } } ``` ```json New SDK - custom_fields { "custom_fields": [ { "name": "company", "value": "ABC Corp", "required": true } ] } ``` Using the new SDK you would now send this data as follows: ```python New SDK - custom_fields Example #1 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) ``` ```python New SDK - custom_fields Example #2 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 version | New 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](/docs/sd-ks/open-api/interacting-with-files). #### Uploading Files Passing a file with with your API request using the `files` parameter is different: | Legacy SDK version | New SDK Version | | ----------------------------------------------- | ------------------------------ | | Accepts a file binary or a path to a local file | **Only** accepts a file binary | **New SDK - File Parameter** ```python 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 Version | New SDK version | | ------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Download Files is a single endpoint and the return is configured by parameters. | Download Files spread across three endpoints
| ```python Legacy SDK - Download Files hs_client = HSClient(api_key="YOUR_API_KEY") hs_client.get_signature_request_file( signature_request_id="fa5c8a0b0f492d768749333ad6fcc214c111e967", filename="files.pdf", file_type="pdf" ) ``` ```python New SDK - Download Files 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) ``` ```python New SDK - Download as Data Uri 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) ``` ```python New SDK - File File Url 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** ```python Legacy SDK - Get Template Files hs_client = HSClient(api_key="SIGN_IN_AND_CREATE_API_KEY_FIRST") hs_client.get_template_files("5de8179668f2033afac48da1868d0093bf133266", "download.pdf") ``` ```python New SDK - Download Template Files 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) ``` ```python New SDK - Template File as Data Uri 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) ``` ```python New SDK - Template File as File Url 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](https://faq.hellosign.com/hc/en-us/requests/new) if you think we're missing an important example. ### Get Account ```python Legacy SDK - Get Account hs_client = HSClient(api_key="your_api_key") account = hs_client.get_account_info() print hs_client.account.email_address ``` ```python New SDK - Get Account 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

This feature was introduced in the new Python SDK.

```python Legacy SDK - Create API App // unavailable in legacy SDK ``` ```python New SDK - Create API App 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 ```python Legacy SDK - Get API App hs_client = HSClient(api_key="api_key") hs_client.get_api_app_info( client_id="client_id" ) ``` ```python New SDK - Get API App 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

This feature was introduced in the new Python SDK.

```python Legacy SDK - Get Bulk Send Job // Feature unavailable in legacy SDK ``` ```python New SDK - Get Bulk Send Job 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 ```python Legacy SDK - Get Embedded Sign Url hs_client.get_embedded_object("50e3542f738adfa7ddd4cbd4c00d2a8ab6e4194b") ``` ```python New SDK - Get Embedded Sign Url 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 ```python Legacy SDK - Get Embedded Template Edit Url embeddedObj = hs_client.get_template_edit_url("5de8179668f2033afac48da1868d0093bf133266") edit_url = embeddedObj.edit_url ``` ```python New SDK - Get Embedded Template Edit Url 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 ```python Legacy SDK - Get Signature Request hs_client.get_signature_request("fa5c8a0b0f492d768749333ad6fcc214c111e967") ``` ```python New SDK - Get Signature Request 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 ```python Legacy SDK - List Signature Requests hs_client.get_signature_request_list( page=1, page_size= 30 ) ``` ```python New SDK - List Signature Requests 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 ```python Legacy SDK - Cancel Incomplete Signature Requests hs_client.cancel_signature_request("2f9781e1a8e2045224d808c153c2e1d3df6f8f2f") ``` ```python New SDK - Cancel Incomplete Signature Requests 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 ```python Legacy SDK - Send Signature Request 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" } ) ``` ```python New SDK - Send Signature Request 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) ``` ```python New SDK - Send Signature Request with Form Fields per Document 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 ```python Legacy SDK - Send with Template 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" }] ) ``` ```python New SDK - Send with Template 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 ```python Legacy SDK - Create Embedded Signature Request 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"] ) ``` ```python New SDK - Create Embedded Signature Request 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 ```python Legacy SDK - Create Embedded Signature Request with Template 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" }] ) ``` ```python New SDK - Create Embedded Signature Request with Template 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 ```python Legacy SDK - Send Request Reminder hs_client.remind_signature_request( signature_request_id="2f9781e1a8e2045224d808c153c2e1d3df6f8f2f", email_address="john@example.com" ) ``` ```python New SDK - Send Request Reminder 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 ```python Legacy SDK - Remove Signature Request Access hs_client.remove_signature_request_access("signature_request_id") ``` ```python New SDK - Remove Signature Request Access 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 ```python Legacy SDK - Update Signature Request hs_client.update_signature_request( signature_request_id="signature_request_id", signature_id="signature_id", email_address="new_email_address@example.com" ) ``` ```python New SDK - Update Signature Request 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 ```python Legacy SDK - Get Team client.get_team_info() ``` ```python New SDK - Get Team 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 ```python Legacy SDK - Get Templates hs_client.get_template("f57db65d3f933b5316d398057a36176831451a35") ``` ```python New SDK - Get Templates 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 ```python Legacy SDK - List Templates hs_client.get_template_list(page=1) ``` ```python New SDK - List Templates 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 ```python Legacy SDK - Create Embedded Template Draft 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 ``` ```python New SDK - Create Embedded Template Draft 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 ```python Legacy SDK - Get Template Files hs_client.get_template_files("5de8179668f2033afac48da1868d0093bf133266", "download.pdf") ``` ```python New SDK - Get Template Files 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 ```python Legacy SDK - Create Embedded Unclaimed Draft 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"] ) ``` ```python New SDK - Create Embedded Unclaimed Draft 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 ```python Legacy SDK - Create Embedded Unclaimed Draft with Template 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 ``` ```python New SDK - Create Embedded Unclaimed Draft with Template 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 *** ## Feedback and Assistance