Official Python SDK for the SpreadSpace API.
Project description
SpreadSpace Python SDK
Official Python client for the SpreadSpace API — document extraction and financial spreading for lending.
Some examples below require the generated core (built in CI) or a live sandbox key. They are marked [needs sandbox key] / [needs generated core].
Install
pip install spreadspace
Requires Python 3.9+.
Authentication
from spreadspace import SpreadSpace
client = SpreadSpace(api_key="ss_test_...") # or omit and set SPREADSPACE_API_KEY
The key prefix selects the environment:
ss_test_...— routes to your sandbox tenant (seed data, safe to experiment).ss_live_...— routes to your live tenant (real data).
If api_key is omitted, the client reads SPREADSPACE_API_KEY from the
environment. Never hard-code a live key; never commit any key.
Client options
client = SpreadSpace(
api_key="ss_test_...",
base_url="https://api.spreadspace.ai", # override for a private deployment
api_version="2026-05-03", # pins the SpreadSpace-Version header
timeout=60.0, # seconds, per request
max_retries=2, # 429 + 5xx + transport errors
)
API version pinning
Every request sends a dated SpreadSpace-Version header. The SDK pins a default
version per release (decoupled from the SDK's own semver). Pin it explicitly to
insulate your integration from server-side changes, and override per call when
you need a newer surface:
client.borrowers.list(api_version="2026-06-01") # one call on a newer version
Pagination (lazy, auto cursor)
List endpoints return a lazy iterator that walks cursors for you — it fetches the next page only as you consume it.
for borrower in client.borrowers.list():
print(borrower["id"])
# Filters pass straight through and persist across pages:
for job in client.jobs.list(status="completed", limit=50):
print(job["id"])
Async export + wait
Exports are asynchronous operations. create returns a handle; wait polls to
completion (or raises on timeout).
op = client.exports.create(borrower_id="...", format="xlsx")
result = op.wait(timeout=300) # seconds
print(result["download_url"])
Upload a document + wait for processing
job = client.documents.upload("statement.pdf", borrower_id="...")
final = job.wait(timeout=600) # seconds
print(final["status"])
The upload helper requests a presigned URL, PUTs the file bytes directly to
storage with the matching Content-Type (part of the V4 signature), then returns
a job handle you can wait on.
Error handling
All errors derive from SpreadSpaceError. Match on the typed subclass, never on
the message string:
from spreadspace import (
SpreadSpaceError, # base
NetworkError, # transport failure, no HTTP response
BadRequestError, # 400
AuthenticationError, # 401
PermissionDeniedError, # 403
NotFoundError, # 404
ConflictError, # 409
RateLimitError, # 429
InternalServerError, # 5xx
)
try:
client.borrowers.get("missing-id")
except RateLimitError as e:
print("retry after", e.retry_after, "seconds")
except NotFoundError as e:
print("not found")
except SpreadSpaceError as e:
# Every error carries request_id — quote it in support tickets.
print(e.message, e.status_code, e.request_id)
request_id comes from the X-Request-ID response header (falling back to the
error body). Transient failures (429, 5xx, transport errors) are retried
automatically up to max_retries with exponential backoff + full jitter,
honoring Retry-After.
Money is exact
Monetary values decode as decimal.Decimal, not float — the SDK reads the
literal digits off the wire, so amounts are exact with no float rounding:
b = client.borrowers.get("...") # [needs sandbox key]
assert b["total_revenue"] == Decimal("1234.56") # never 1234.5600000000001
Development
The generated OpenAPI core lives in src/spreadspace/_generated/ and is built in
CI (scripts/generate.sh, Java-based — not run locally). It is gitignored and
must never be hand-edited. The hand-written ergonomic layer (transport,
helpers, typed errors) is the only code committed by hand.
pip install -e '.[dev]'
pytest
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file spreadspace-0.1.0.tar.gz.
File metadata
- Download URL: spreadspace-0.1.0.tar.gz
- Upload date:
- Size: 33.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
38384a37535e7ceadb6a036f94b3b031526d89d38f3808d19d905905a0ba9dc2
|
|
| MD5 |
258a9e6abbf346b4bf799f1a9cd739ae
|
|
| BLAKE2b-256 |
c1986bee04090b7cd9d0542f3bc47bc6ab63d20b33f89b0d5ce4be5c457b364b
|
Provenance
The following attestation bundles were made for spreadspace-0.1.0.tar.gz:
Publisher:
sdk.yml on DocDissect/DocDissectOfficial
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
spreadspace-0.1.0.tar.gz -
Subject digest:
38384a37535e7ceadb6a036f94b3b031526d89d38f3808d19d905905a0ba9dc2 - Sigstore transparency entry: 1884474651
- Sigstore integration time:
-
Permalink:
DocDissect/DocDissectOfficial@9b97bb025439a34f265b4d62b9d84ee05b7a3de1 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/DocDissect
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
sdk.yml@9b97bb025439a34f265b4d62b9d84ee05b7a3de1 -
Trigger Event:
push
-
Statement type:
File details
Details for the file spreadspace-0.1.0-py3-none-any.whl.
File metadata
- Download URL: spreadspace-0.1.0-py3-none-any.whl
- Upload date:
- Size: 24.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eafa3491ad23c8b9ea0c219c46a58f1d07699b7cd14156b5430edad426e24009
|
|
| MD5 |
a17c39118a94ced6d158007d80308df3
|
|
| BLAKE2b-256 |
9b628ba069fc9c8cb76c26dcc58378b0f4b10f2634ac58e52dcd071deb24853f
|
Provenance
The following attestation bundles were made for spreadspace-0.1.0-py3-none-any.whl:
Publisher:
sdk.yml on DocDissect/DocDissectOfficial
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
spreadspace-0.1.0-py3-none-any.whl -
Subject digest:
eafa3491ad23c8b9ea0c219c46a58f1d07699b7cd14156b5430edad426e24009 - Sigstore transparency entry: 1884474836
- Sigstore integration time:
-
Permalink:
DocDissect/DocDissectOfficial@9b97bb025439a34f265b4d62b9d84ee05b7a3de1 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/DocDissect
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
sdk.yml@9b97bb025439a34f265b4d62b9d84ee05b7a3de1 -
Trigger Event:
push
-
Statement type: