SDK Version
documenso_sdk (Python) — latest as of 2026-02-28
Description
documenso.envelopes.items.download() throws an error when the Documenso API correctly responds with a PDF file (Content-Type: application/pdf). The SDK does not handle binary responses, interpreting the raw PDF bytes as a text/JSON body and raising an unexpected response error.
Steps to Reproduce
from documenso_sdk import Documenso
import documenso_sdk
with Documenso(api_key="<API_KEY>", server_url="https://sign.example.com") as client:
data = client.envelopes.items.download(
envelope_item_id="envelope_item_xxxxxxxxxxxx",
version=documenso_sdk.EnvelopeItemDownloadVersion.SIGNED,
)
Expected Behavior
Returns the signed PDF content as bytes.
Actual Behavior
Unexpected response received: Status 200 Content-Type application/pdf.
Body: %PDF-1.7
%����
1 0 obj
<<
/Type /Pages
...
The SDK treats the raw PDF binary data as an error body and raises an exception.
Workaround
Use the raw REST API directly instead of the SDK:
import requests
resp = requests.get(
f"{base_url}/api/v2/envelope/item/{item_id}/download",
headers={"Authorization": api_key},
timeout=60,
)
pdf_bytes = resp.content #works correctly, returns ~993KB PDF
Additional Notes
- The correct endpoint is
GET /api/v2/envelope/item/{item_id}/download
- The
item_id must be the envelopeItems[0].id from the envelope details, not the envelope ID itself
- Passing the envelope ID (e.g.
envelope_xxxxxx) instead of the item ID (e.g. envelope_item_xxxxxx) results in a 404
SDK Version
documenso_sdk(Python) — latest as of 2026-02-28Description
documenso.envelopes.items.download()throws an error when the Documenso API correctly responds with a PDF file (Content-Type: application/pdf). The SDK does not handle binary responses, interpreting the raw PDF bytes as a text/JSON body and raising an unexpected response error.Steps to Reproduce
Expected Behavior
Returns the signed PDF content as
bytes.Actual Behavior
The SDK treats the raw PDF binary data as an error body and raises an exception.
Workaround
Use the raw REST API directly instead of the SDK:
Additional Notes
GET /api/v2/envelope/item/{item_id}/downloaditem_idmust be theenvelopeItems[0].idfrom the envelope details, not the envelope ID itselfenvelope_xxxxxx) instead of the item ID (e.g.envelope_item_xxxxxx) results in a 404