Undersign
v1.1
Create Free Account
API Reference SDKs & Examples · Python
SDKs & Examples

Python Examples

Call the Undersign API from Python with the requests library. Keep tokens in environment variables.

Install requests

Shell
pip install requests

List templates

Python
import os
import requests

base_url = "https://toolkit.undersign.app/api/v1.1"
token = os.environ["UNDERSIGN_API_TOKEN"]

response = requests.get(
    f"{base_url}/templates",
    headers={"Authorization": f"Bearer {token}"}
)
data = response.json()

Create a signature request

Python
import os
import uuid
import requests

base_url = "https://toolkit.undersign.app/api/v1.1"
token = os.environ["UNDERSIGN_API_TOKEN"]

payload = {
    "mode": "email",
    "message": "Please sign the official documents.",
    "templates": [
        {
            "template_id": "<template-uuid>",
            "signers": [
                {"name": "John Doe", "email": "<signer-email-1>"}
            ]
        }
    ]
}

response = requests.post(
    f"{base_url}/signature-requests",
    headers={
        "Authorization": f"Bearer {token}",
        "Content-Type": "application/json",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json=payload
)
data = response.json()

Get signature request status

Python
import os
import requests

base_url = "https://toolkit.undersign.app/api/v1.1"
token = os.environ["UNDERSIGN_API_TOKEN"]

response = requests.get(
    f"{base_url}/signature-requests/<package-guid>",
    headers={"Authorization": f"Bearer {token}"}
)
data = response.json()