SDKs
Python SDK
signyt is a typed client for Python 3.10+, built on httpx and pydantic v2, with matching sync and async APIs.
Install#
pip install signytCreate a client#
import os
from signyt import Signyt
with Signyt(os.environ["SIGNYT_API_KEY"]) as client:
print([d.title for d in client.documents.list(limit=10)])| Option | Default | Description |
|---|---|---|
api_key | required | An sk_live_... key. |
base_url | https://api.sign.yt/v1 | API base URL. |
timeout | 30.0 | Seconds per request. |
max_retries | 2 | Retries for GET/PUT/DELETE on 429, 5xx and network errors. |
retry_backoff | 0.5 | Base backoff in seconds (exponential with jitter; Retry-After wins, capped at 60 s). |
http_client | none | Bring your own httpx.Client (proxies, custom transport). |
Async code uses AsyncSignyt with the same resources and await:
import asyncio
import os
from signyt import AsyncSignyt
async def main() -> None:
async with AsyncSignyt(os.environ["SIGNYT_API_KEY"]) as client:
doc = await client.documents.get(os.environ["DOC_ID"])
print(doc.status)
asyncio.run(main())Resources#
| Method | Endpoint |
|---|---|
documents.list(limit=50, offset=0) | GET /documents |
documents.get(id) | GET /documents/{id} |
documents.create(pdf, title, recipients, *, signing_order, verification_type, metadata, expires_at, allow_delegation, team_id, folder_id, filename) | POST /documents; pdf is bytes, a path or a binary file object |
documents.set_fields(id, fields) | PUT /documents/{id}/fields |
documents.detect_fields(id) | POST /documents/{id}/detect-fields |
documents.update_recipient(id, recipient_id, ...) | PATCH /documents/{id}/recipients/{recipient_id} |
documents.resend(id, recipient_id) | POST /documents/{id}/recipients/{recipient_id}/resend |
documents.send(id) | POST /documents/{id}/send |
documents.cancel(id, reason, copy_as_draft=False) | POST /documents/{id}/cancel |
documents.remind(id) | POST /documents/{id}/remind |
documents.delete(id), documents.restore(id) | DELETE /documents/{id}, POST /documents/{id}/restore |
documents.download_signed_pdf(id), documents.download_original_pdf(id) | Return bytes |
documents.audit(id) | GET /documents/{id}/audit |
templates.list(), templates.create(pdf, name, description, category), templates.use(id, title, recipients), templates.delete(id) | /templates |
webhooks.list(), webhooks.create(url, events), webhooks.update(id, *, url, events, active), webhooks.delete(id) | /webhooks |
Responses are pydantic models from signyt.models; request helpers RecipientInput and FieldInput are exported too (plain dicts work as well). Endpoints without a method (flows, template public links, webhook deliveries, signing links, evidence downloads, cursor pagination) can be called with any HTTP client; see the guides for examples.
End-to-end example#
import os
from signyt import Signyt
with Signyt(os.environ["SIGNYT_API_KEY"]) as client:
doc = client.documents.create(
"contract.pdf",
title="Service agreement",
recipients=[{"email": "[email protected]", "name": "Anna Nowak"}],
verification_type="EMAIL_OTP",
metadata={"crm_deal_id": "D-1042"},
)
client.documents.set_fields(doc.id, [{
"type": "SIGNATURE", "page": 1, "position_x": 15, "position_y": 80,
"width": 25, "height": 8, "recipient_id": doc.recipients[0].id,
}])
client.documents.send(doc.id)
print("sent", doc.id)Errors#
Non-2xx responses raise a subclass of SignytError with status, code, message, extra and request_id:
| Exception | Status |
|---|---|
BadRequestError | 400, 413, 422 |
AuthenticationError | 401 |
PaymentRequiredError | 402 |
PermissionDeniedError | 403 |
NotFoundError | 404 |
ConflictError | 409 |
RateLimitError | 429 (with retry_after) |
ServerError | 5xx |
APIConnectionError | Network failure or timeout |
import os
from signyt import ConflictError, Signyt, SignytError
client = Signyt(os.environ["SIGNYT_API_KEY"])
try:
client.documents.remind(os.environ["DOC_ID"])
except ConflictError as e:
if e.code == "document_not_pending":
print("nothing to remind: the document is not pending")
except SignytError as e:
print(e.status, e.code, e.message, e.request_id)Verify webhooks#
import os
from signyt import SignatureVerificationError
from signyt.webhooks import construct_event
def handle(raw_body: bytes, headers: dict[str, str]) -> int:
try:
event = construct_event(raw_body, headers, os.environ["SIGNYT_WEBHOOK_SECRET"])
except SignatureVerificationError:
return 400
if event["event"] == "document.completed":
print("completed:", event["data"]["id"])
return 204construct_event verifies X-Signyt-Signature against X-Signyt-Timestamp and the raw body, enforces a 5-minute window (tolerance=300) and returns the parsed envelope. See Webhooks.