Skip to main content

Python SDK for eSignBase – eIDAS-compliant digital signatures and GDPR-ready electronic signing via REST API.

Project description

eSignBase Python SDK

Official Python SDK for integrating eIDAS-compliant digital signatures into your application using the eSignBase REST API.

eSignBase provides GDPR-ready electronic signatures with EU-based infrastructure and flexible pay-as-you-go pricing — no subscriptions, no per-seat licenses.

This SDK offers a simple, synchronous client for creating signing requests, managing templates, and retrieving signed documents programmatically.

Why eSignBase?

  • ✅ eIDAS-compliant electronic signatures
  • ✅ GDPR-aligned EU data hosting
  • ✅ Simple REST API
  • ✅ No subscriptions — pay-as-you-go credits
  • ✅ Lightweight and easy to integrate

Documentation

Full REST API documentation: https://esignbase.com/en/api_documentation

A step-by-step integration guide: https://esignbase.com/en/blog/rest-api-guide

Classes

GrantType (Enum)

Defines the available OAuth2 grant types:

  • CLIENT_CREDENTIALS: For server-to-server authentication
  • AUTHORIZATION_CODE: For user-specific authentication

Scope (Enum)

Defines the available API permission scopes:

  • ALL: Full access to all API endpoints
  • READ: Read-only access
  • CREATE_DOCUMENT: Permission to create documents
  • DELETE: Permission to delete documents
  • SANDBOX: Access to the sandbox environment, use this scope for testing

OAuth2Client

Main client class that stores authentication credentials and state.

Attributes:

id (str) # Client ID from ESignBase
secret (str) # Client secret from ESignBase
grant_type (GrantType) # OAuth2 grant type to use
user_name (Optional[str]) # Username (required AUTHORIZATION_CODE)
password (Optional[str]) # Password (required AUTHORIZATION_CODE)
scope (list[Scope]) # List of requested API scopes

Retrieve your Client ID and Client Secret at https://app.esignbase.com/oauth2/client by creating an OAuth2 Client Configuration.

Recipient

Represents a document recipient/signer. role_name value is defined during template creation in the template editor.

Attributes:

email (str) # Recipient's email address
first_name (str) # Recipient's first name
last_name (str) # Recipient's last name
role_name (str) # Role name (e.g., "Signer", "Viewer")
locale (str) # Locale code ("de", "en", "es")

ESignBaseSDKError (Exception)

Custom exception class for API-related errors.

Functions

def connect(client: OAuth2Client) -> None

Authenticates with the ESignBase API

Parameters:

client: Configured OAuth2Client instance

Raises:

ESignBaseSDKError: If authentication fails or validation fails

Example:

client = OAuth2Client(
    id="your_client_id",
    secret="your_client_secret",
    grant_type=GrantType.CLIENT_CREDENTIALS,
    scope=[Scope.ALL],
)
connect(client)

def get_templates(client: OAuth2Client) -> list[dict[str, Any]]

Retrieves a list of available document templates.

Parameters:

client: Authenticated OAuth2Client instance

Returns A list of dictionaries containing template data.

Raises:

ESignBaseSDKError: If the API request fails

def get_template(client: OAuth2Client, template_id: str) -> dict[str, Any]

Retrieves details of a specific template.

Parameters:

client: Authenticated OAuth2Client instance
template_id: Unique identifier of the template

Returns: Dictionary containing template details

Raises: ESignBaseSDKError: If the API request fails


def get_documents(client: OAuth2Client, limit: int, offset: int) -> dict[str, Any]

Retrieves a paginated list of documents.

Parameters:

client: Authenticated OAuth2Client instance
limit: Maximum number of documents to return
offset: Pagination offset

Returns:

Dictionary containing document list and pagination info `{documents: [...]}`

Raises:

ESignBaseSDKError: If the API request fails

def get_document(client: OAuth2Client, document_id: str) -> dict[str, Any]

Retrieves details of a specific document.

Parameters:

client: Authenticated OAuth2Client instance
document_id: Unique identifier of the document

Returns:

Dictionary containing document details

Raises:

ESignBaseSDKError: If the API request fails

def create_document(
    client: OAuth2Client,
    template_id: str,
    document_name: str,
    recipients: list[Recipient],
    user_defined_metadata: Optional[dict[str, str | int]] = None,
    expiration_date: Optional[datetime] = None
) -> dict[str, Any]

Creates a new document from a template.

Parameters:

client: Authenticated OAuth2Client instance
template_id: ID of the template to use
document_name: Name for the new document
recipients: List of Recipient objects
user_defined_metadata: Optional metadata to attach to the document
expiration_date: Optional expiration date for the document

Returns:

Dictionary containing the created document id and current document status

Raises:

ESignBaseSDKError: If the API request fails

Example:

recipients = [
    Recipient(
        email="signer@example.com",
        first_name="John",
        last_name="Doe",
        role_name="signer",
        locale="de"
    )
]

document = create_document(
    client=client,
    template_id="template_123",
    document_name="Contract Agreement",
    recipients=recipients,
    user_defined_metadata={"contract_id": "CTR-2024-001"},
    expiration_date=datetime(2024, 12, 31)
)

def delete_document(client: OAuth2Client, document_id: str) -> None

Deletes a specific document.

Parameters:

client: Authenticated OAuth2Client instance
document_id: Unique identifier of the document to delete

Raises:

ESignBaseSDKError: If the API request fails

def get_credits(client: OAuth2Client) -> dict[str, Any]

Retrieves credit balance information.

Parameters:

client: Authenticated OAuth2Client instance

Returns:

Dictionary containing credit balance data

Raises:

ESignBaseSDKError: If the API request fails

Error Handling

All functions raise ESignBaseSDKError exceptions for API errors, network issues, or validation failures. Always wrap API calls in try-except blocks:

try:
    templates = get_templates(client)
except ESignBaseSDKError as e:
    print(f"API Error: {e}")

Complete Example

from datetime import datetime

# Setup client
client = OAuth2Client(
    id="your_client_id",
    secret="your_client_secret",
    grant_type=GrantType.CLIENT_CREDENTIALS,
    scope=[Scope.CREATE_DOCUMENT, Scope.READ]
)

# Authenticate
connect(client)

# Get available templates
templates = get_templates(client)

# Create a document
recipients = [
    Recipient(
        email="alice@example.com",
        first_name="Alice",
        last_name="Smith",
        role_name="Signer",
        locale="en"
    )
]
template_id = templates[0]["id"]

document = create_document(
    client=client,
    template_id=template_id,
    document_name="NDA Agreement",
    recipients=recipients
)

# Check document status
document_details = get_document(client, document["id"])

# Delete the document (if needed)
delete_document(client, document["id"])

Developer Notes:

To build the package, run the following commands inside a virtual environment from the directory containing this README file.

python -m pip install --upgrade build
python -m build --wheel

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

esignbase_sdk-1.0.1.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

esignbase_sdk-1.0.1-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file esignbase_sdk-1.0.1.tar.gz.

File metadata

  • Download URL: esignbase_sdk-1.0.1.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for esignbase_sdk-1.0.1.tar.gz
Algorithm Hash digest
SHA256 445caecd3c4840d825a7729ab210c516af47e35a27c36f3b0ae79df9e800f3a2
MD5 b0a5cf087c2ac6ef9c0cf42fc0413c54
BLAKE2b-256 9a7a14f265f399856fd47ae4f091cd5098d59f2d10be60897ce114f2189cd3de

See more details on using hashes here.

Provenance

The following attestation bundles were made for esignbase_sdk-1.0.1.tar.gz:

Publisher: python-publish.yml on matt-the-midnight-hacker/esignbase-python-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file esignbase_sdk-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: esignbase_sdk-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for esignbase_sdk-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ecddb2c4465605a4b16bc80f73d2519c10118ab8a6b54e9129dd2da1d291b8ef
MD5 75426435a222a70249018df9d37430b9
BLAKE2b-256 14fdce34a098293bde6ccaa32b465993da8841595d1c109e518762a51198b45a

See more details on using hashes here.

Provenance

The following attestation bundles were made for esignbase_sdk-1.0.1-py3-none-any.whl:

Publisher: python-publish.yml on matt-the-midnight-hacker/esignbase-python-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page