Skip to main content

Python SDK for the ContractSign API

Project description

contractsign

Python SDK for the ContractSign API. Create contracts, send them for digital signing, manage templates, and track signing status — all from Python.

Install

pip install contractsign

Quick start

from contractsign import ContractSign, CreateContractInput, CreateSigningInput, SignerInput, SignerRole, SigningMethod

client = ContractSign(api_key="cs_...")

# Create a contract
contract = client.contracts.create(CreateContractInput(
    title="Consulting Agreement",
    content="<h1>Consulting Agreement</h1><p>...</p>",
))
contract_id = contract["data"]["id"]

# Send for signing
signing = client.signing.create(CreateSigningInput(
    contract_id=contract_id,
    signers=[
        SignerInput(
            name="Jane Doe",
            email="jane@example.com",
            role=SignerRole.SIGNER,
            signing_method=SigningMethod.SMS_OTP,
            order=1,
        ),
    ],
))

print(f"Signing request created: {signing['data']['id']}")

Context manager

The client can be used as a context manager to ensure the HTTP connection is closed:

with ContractSign(api_key="cs_...") as client:
    contracts = client.contracts.list(limit=10)
    for contract in contracts["data"]:
        print(contract["title"])

Resources

Resource Methods
client.contracts list(), get(), create(), update(), delete(), duplicate(), pdf(), list_parties(), add_party(), update_party(), delete_party()
client.signing create(), get(), cancel(), remind()
client.templates list(), get(), create(), update(), delete()
client.folders list(), get(), create(), update(), delete()
client.tags list(), create(), update(), delete()
client.account me(), get_organization(), update_organization(), list_api_keys(), create_api_key(), delete_api_key()

Error handling

from contractsign import ContractSign, NotFoundError, AuthenticationError, ValidationError

client = ContractSign(api_key="cs_...")

try:
    contract = client.contracts.get("nonexistent-id")
except NotFoundError:
    print("Contract not found")
except AuthenticationError:
    print("Invalid API key")
except ValidationError as e:
    print(f"Invalid input: {e.message}")

Configuration

client = ContractSign(
    api_key="cs_...",
    base_url="https://contractsign.net",  # default
    timeout=30.0,                          # seconds, default
)

Types

All input and output types are available as dataclasses with full type hints:

from contractsign import (
    ContractStatus,
    SigningOrder,
    SignerRole,
    SigningMethod,
    CreateContractInput,
    CreateSigningInput,
    CreateTemplateInput,
    CreateFolderInput,
    CreateTagInput,
    CreatePartyInput,
    PartyType,
)

License

MIT

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

contractsign-0.1.0.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

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

contractsign-0.1.0-py3-none-any.whl (12.2 kB view details)

Uploaded Python 3

File details

Details for the file contractsign-0.1.0.tar.gz.

File metadata

  • Download URL: contractsign-0.1.0.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for contractsign-0.1.0.tar.gz
Algorithm Hash digest
SHA256 becf70b3d39ab5ba08dd1678869b2b0c30907beac8b5ed460452a91b409ebda1
MD5 17b58283d7e57004698793584e5cb232
BLAKE2b-256 7eebca8718dbd864149c97a778db997afab00c42ed5cf21f030bb9c58846e5f9

See more details on using hashes here.

File details

Details for the file contractsign-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: contractsign-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for contractsign-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 51174698cb2face6721f2cc4e8f2061cd5059e4720ee25bf757b671bbbefb24a
MD5 f94b8628e1924ff5a787771188130d92
BLAKE2b-256 03936fa66b5c71a2c4f1a0464cb1a0b7dc314b88c81b7282c887916a225faca3

See more details on using hashes here.

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