Skip to main content

zelf-sdk (Python)

Official client for the Zelf API. Part of hellozelf/zelf-sdk.

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.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for zelf-sdk 1.1.0
File Size Uploaded Provenance
zelf_sdk-1.1.0.tar.gz 109.3 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for zelf-sdk 1.1.0
File Interpreter ABI Platform
zelf_sdk-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 175.6 kB

Release files / zelf_sdk-1.1.0.tar.gz

Download URL zelf_sdk-1.1.0.tar.gz
Size 109.3 kB
Tags Source
SHA-256 checksum
How to use checksums
0c75479991166cea26fc09899e1216f80d4144d27c14e5b0c714d185b815adb8
BLAKE2b-256 checksum
How to use checksums
1490e0b6ed4230ca165f1acb5f8677745d21b49342638e2cf5703dcc3c0059d8
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 21, 2026.

Transparency log

Release files / zelf_sdk-1.1.0-py3-none-any.whl

Download URL zelf_sdk-1.1.0-py3-none-any.whl
Size 66.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5b365f8d026bfc36ed89a8e3ef6bbd1f3cabb775c5dbf157222b8013ea07f1e5
BLAKE2b-256 checksum
How to use checksums
0e057ab66aa0c8b1a2ff42456714a0482b67a6d0e11556b3ff91bdf3fb46ab94
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 21, 2026.

Transparency log

Security for zelf-sdk 1.1.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.

Select from 2 files

Attestation for zelf_sdk-1.1.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 21, 2026.

Transparency log

A 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.

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page