PYTHON SDK Getting started
Authenticating with API Key
To prepare for sending a document for signing, you can authenticate using an API key or a Bearer token after importing the BoldSign SDK. This example demonstrates the authentication process using an API key.
import boldsign configuration = boldsign.Configuration( api_key = "***your_api_key***" ) with boldsign.ApiClient(configuration) as api_client: # Create an instance of the DocumentApi class document_api = boldsign.DocumentApi(api_client)
Adding form fields
Now, define the signature field that will be added to your document. This involves specifying the field type (Signature), page number, and the bounds (position and size) of the field on the page.
# Define the signature field to be added to the document signatureField = boldsign.FormField( fieldType="Signature",# Field type is Signature pageNumber=1,# Specify the page number bounds=boldsign.Rectangle(x=100, y=100, width=100, height=50), )
Adding Signers
The document and its form fields require signing. So, specify the signer to sign the form fields, including their name and email address.
# Define the signer with a name and email address signer = boldsign.DocumentSigner( name="David", emailAddress="david@example.com", signerType="Signer", formFields=[signatureField] )
Prepare the Document for Signing
Now, prepare the document you want to send for signature. Specify the title of the document, the signers involved, and the file(s) to be signed. In this case, we are sending a PDF document.
# Prepare the request body for sending the document for signature send_for_sign = boldsign.SendForSign( title="Agreement", signers=[signer], files=["/documents/agreement.pdf"] )
Send the Document for Signature
The last step is to send the document for signing with the defined document, form fields and signer.
# Send the document for signature and capture the response api_response = document_api.send_document(send_for_sign=send_for_sign)
The return type api_response
will contain the document ID of the document created, which can be used in later stages to get the particular document related operations.