zelf (Python)
Official client for the Zelf API. Part of hellozelf/zelf-sdk, which holds the same client in eight languages.
Install
pip install zelf-sdk
from zelf import ZelfAPIClient
client = ZelfAPIClient(api_key="sk_zelf_...")
There is an async client with the same surface:
from zelf import ZelfAPIClientAsync
async with ZelfAPIClientAsync() as client:
page = await client.content.list(brand_id="brd_1")
Client options
| Option | Default | What it does |
|---|---|---|
api_key |
ZELF_API_KEY |
Brand API key, sent as x-api-key |
base_url |
ZELF_BASE_URL, else production |
Point at the sandbox or another deployment |
timeout |
60s | Bounds each individual attempt, not the whole call |
max_retries |
2 | How many times a retryable response is retried |
retry_writes |
off | Allow non-idempotent requests to be retried |
default_headers |
none | Added to every request |
http_client |
built in | Supply your own HTTP client |
Pagination
A list call returns one page. The page carries its rows and the envelope that came with them.
| On the page | Meaning |
|---|---|
results |
the rows, already decoded |
item_count |
rows on this page |
page |
1-based page number |
next / previous |
neighbouring page numbers, or nothing at the ends |
applied_filters |
the filters the API actually applied |
log_id |
quote this in a support request |
Walking the rest takes one of three bounds: everything, at most N pages, or at most N items. The item bound never fetches a page it does not need.
page = client.content.list(page_size=50)
for item in page: # this page only
...
for item in page.auto_paging(): # every page
...
for item in page.auto_paging(max_pages=5):
...
for item in page.auto_paging(max_items=100):
...
Errors
Every failure is a typed error carrying the status, the API's error code and
the log_id.
try:
client.content.details("con_nope")
except zelf.NotFoundError as error:
print(error.status_code, error.code, error.log_id)
The type follows the status: bad request, authentication, permission denied, not found, conflict, rate limit, internal server, service unavailable. Network problems raise a connection or timeout error instead.
Retries
A failed GET is retried twice by default, honouring Retry-After and otherwise
backing off exponentially with jitter, capped at 8 seconds.
Writes are never retried. The API publishes no Idempotency-Key, so a
retried create would start a second billable run. Opt in with retry_writes if your
call site can tolerate it.
Webhooks
from zelf import webhooks
event = webhooks.parse(body, headers, secret)
if event.event_type is webhooks.EventType.CONTENT_SNAPSHOT:
for row in event.items:
...
verify returns the decoded payload, parse returns a typed event with
items, files and statistics reachable. A handler verifies once and routes
by event type. For a manifest delivery, rows downloads the NDJSON files and
checks the published SHA-256 before yielding anything.
Sandbox
ZELF_BASE_URL=https://sandbox-api.hellozelf.com
ZELF_API_KEY=sk_zelf_sandbox_demo
Same response shapes and pagination as production, with canned data. It honours
page and page_size and ignores other filters.
The sandbox is not a stand-in for production behaviour. It validates nothing,
and it never reads a path parameter, so INVALID_ID and the other error cases
cannot be reached there. Test error handling and validation against production.
Tests
uv run pytest tests -q
See the repository README for the API surface, and docs/contributing.md for how these are generated.
Metadata
Release files for zelf-sdk 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| zelf_sdk-1.0.0.tar.gz | 106.5 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| zelf_sdk-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 169.7 kB
Release files / zelf_sdk-1.0.0.tar.gz
| Download URL | zelf_sdk-1.0.0.tar.gz |
|---|---|
| Size | 106.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
677d47f4d5fe4c2b46cf475df6d0d81c06d1a4ab661d7028e1bdc019290291fd
|
|
BLAKE2b-256 checksum How to use checksums |
256ad981a18b2d242147951a2065ca21e3fc57ae2f12adceb7260a190c6d4c53
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.
Transparency logRelease files / zelf_sdk-1.0.0-py3-none-any.whl
| Download URL | zelf_sdk-1.0.0-py3-none-any.whl |
|---|---|
| Size | 63.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
14c0b2dff5376413e6e97305ad177669d67136befc73e16cdf73973219787509
|
|
BLAKE2b-256 checksum How to use checksums |
f338598218a04c5d4614300200c25c3963f3b68710fc5463818119cecbf0f20b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.
Transparency logSecurity for zelf-sdk 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for zelf_sdk-1.0.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.