Skip to main content

aisquare-pipe-docusign

DocuSign source and sink connectors for aisquare.pipe. Ships with the aisquare-pipe[full] extras bundle.

Install

pip install aisquare-pipe-docusign

aisquare-pipe is pulled in transitively — no separate install needed.

For development:

cd connectors/docusign
pip install -e ".[dev]"

Configuration

Two authentication flows are supported. The connector picks the right one based on which keys are present in config.

# Flow 1: JWT Grant (recommended for server-to-server / platform integrations)
config = {
    "integration_key": "YOUR_INTEGRATION_KEY",
    "user_id":         "USER_GUID_TO_IMPERSONATE",
    "private_key":     "-----BEGIN RSA PRIVATE KEY-----\n...",  # str or bytes
    "auth_server":     "account-d.docusign.com",  # "account.docusign.com" for prod
    "account_id":      "optional — auto-discovered if omitted",
}

# Flow 2: Authorization Code refresh-token (user OAuth)
config = {
    "client_id":     "INTEGRATION_KEY",
    "client_secret": "SECRET_KEY",
    "refresh_token": "REFRESH_TOKEN",
    "auth_server":   "account-d.docusign.com",
    "account_id":    "optional",
}

JWT consent: the first time JWT Grant is used for a given integration key + user, a one-time consent URL must be visited manually. See DocuSign's JWT Grant Authentication guide.

Usage

Pull signed documents (default mode)

from aisquare.pipe import PullParams
from aisquare_pipe_docusign import DocusignSource

source = DocusignSource()
params = PullParams(params={
    "status": "completed",
    "from_date": "2024-01-01",
    "limit": 50,
})

for envelope in source.pull(config, params):
    # envelope.data is PDF bytes; metadata has envelope_id, document_id, filename, status
    print(envelope.metadata["filename"], len(envelope.data), "bytes")

Pull envelope metadata instead

params = PullParams(params={
    "mode": "envelopes",
    "status": "completed",
    "from_date": "2024-01-01",
})

for envelope in source.pull(config, params):
    # envelope.data is a dict of envelope fields (status, subject, recipients, ...)
    print(envelope.metadata["envelope_id"], envelope.data["status"])

Send a document for signature

from aisquare.pipe import DataEnvelope
from aisquare_pipe_docusign import DocusignSink

sink = DocusignSink()
with open("contract.pdf", "rb") as f:
    pdf_bytes = f.read()

envelope = DataEnvelope(
    content_type="application/pdf",
    data=pdf_bytes,
    source_id="my-app",
    metadata={
        "filename": "contract.pdf",
        "signers": [
            {"name": "Alice Example", "email": "alice@example.com"},
            {"name": "Bob Example",   "email": "bob@example.com"},
        ],
        "subject": "Please sign this contract",
        "email_blurb": "Sign at your convenience.",
    },
)
result = sink.push(envelope, config)
print(f"Sent envelope: {result.ref}")

Pull params reference

Key Default Meaning
mode "documents" "documents" → one envelope per signed PDF; "envelopes" → one envelope per signing transaction as JSON
status (none) Filter — "completed", "sent", "delivered", ...
from_date (none) ISO date; DocuSign requires at least one of from_date/envelope_ids
to_date (none) ISO date
folder_id (none) Restrict to a folder
envelope_ids (none) List of specific envelope IDs; skips listing
include_combined False Documents mode: also fetch the combined PDF (document_id="combined")
limit (none) Cap total envelopes
account_id (auto) Override account

Push metadata reference

Key Required Meaning
filename yes Document filename shown to signers
signers yes List of {name, email, recipient_id?, routing_order?} dicts
subject no Email subject (default: "Please sign")
email_blurb no Email body

Features

  • Two auth flows — JWT Grant (server-to-server) and Authorization Code refresh-token (user OAuth)
  • Two source modes — pull signed PDFs or envelope metadata via params["mode"]
  • Status / date / folder / envelope-id filters — translated into the list_status_changes call
  • Rate-limit aware — exponential backoff on HTTP 429 / 503
  • Auto-discovery of account_id — supplied by get_user_info, overridable via config["account_id"]

Metadata

Release files for aisquare-pipe-docusign 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aisquare-pipe-docusign 0.1.0
File Size Uploaded Provenance Actions
aisquare_pipe_docusign-0.1.0.tar.gz 14.6 kB Without provenance Details for aisquare_pipe_docusign-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for aisquare-pipe-docusign 0.1.0
File Interpreter ABI Platform Actions
aisquare_pipe_docusign-0.1.0-py3-none-any.whl Python 3 none any Details for aisquare_pipe_docusign-0.1.0-py3-none-any.whl

Total release size: 25.4 kB

Release files / aisquare_pipe_docusign-0.1.0.tar.gz

Download URL aisquare_pipe_docusign-0.1.0.tar.gz
Size 14.6 kB
Tags Source
SHA-256 checksum
How to use checksums
f02edbc97d4ad4873e00bbb6292e835038db93fb1d492d79fd8e8265cac59650
BLAKE2b-256 checksum
How to use checksums
df3cae8229c37fbb0ec4d7fc8f15c65132b4d9e71fb02e6427d38cca3f884ee2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.9

Release files / aisquare_pipe_docusign-0.1.0-py3-none-any.whl

Download URL aisquare_pipe_docusign-0.1.0-py3-none-any.whl
Size 10.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
52c554fb232cb268fec68b1d6dfe20711fb6923492436845a81eaeed589e5f09
BLAKE2b-256 checksum
How to use checksums
599616a18aa10ee253f157ba1ddaca5076520d3808955dd722f5f7c9a7bc4bf6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.9

Security for aisquare-pipe-docusign 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page