SDK Examples
Worked examples for the Python client, indox-client 0.6.0.
Install it with pip install --upgrade indox-client; see the SDK status table for
the other seven languages.
Set up a client
from indox_client import Indox
client = Indox(api_key="your-api-key")Indox() with no arguments reads INDOX_API_KEY from the environment. The base URL defaults
to https://indox.org; INDOX_BASE_URL or the base_url argument overrides it for a
self-hosted deployment. Use it as a context manager to close the HTTP session cleanly:
with Indox(timeout=(5.0, 60.0)) as client: # (connect, read) seconds
print(client.base_url)
print(client.health.get()["status"]) # 'ok'Discover what a service can convert
client.images.formats() # raster + vector engines, inputs and outputs
client.videos.formats()
client.models.formats() # 3D models
client.pdf.formats()
client.fonts.formats.list()
client.fonts.formats.get("ttf") # only the outputs reachable from TTFEach returns the live engine table, so you never have to hardcode a format list.
Convert an image
Conversions are asynchronous: start the job, wait until it reaches a terminal status, then download the result.
job = client.images.convert("photo.png", target_format="webp")
# {'id': '8aa388e0-…', 'status': 'pending', 'service': 'image'}
final = client.conversion.wait(job["id"], timeout=120) # works for any converter
client.media.download(job["id"], "photo.webp") # returns a pathlib.Pathclient.models follows the same pattern for 3D models, and client.videos.convert() starts a
video job. client.docs and client.media expose the shared status, batch, and credit
endpoints for document and media jobs.
Convert a font
The font pipeline has a one-call form:
path = client.fonts.convert_and_download(
"MyFont.ttf",
target_format="woff2",
output_path="MyFont.woff2",
)…and a step-by-step form when you want to inspect, validate or subset first:
client.fonts.inspect("MyFont.ttf") # family, weight, glyph count, unicode ranges
client.fonts.validate("MyFont.ttf", target_format="woff2")
# {'valid': True, 'input': 'ttf', 'output': 'woff2', 'engine': 'fonttools', 'credits': 1}
upload = client.fonts.upload("MyFont.ttf") # -> {'s3_key': …, 'format': 'ttf', …}
job = client.fonts.convert(upload["s3_key"], target_format="woff2", subset_text="Hello")
client.fonts.conversions.wait(job["id"])
client.fonts.conversions.download(job["id"], "MyFont.woff2")Check quota, credits, and history
client.fonts.quota() # free-tier request window and max_upload_mb
client.docs.credits() # {'is_authenticated': True, 'remaining_credits': 10, …}
client.billing.credits_balance()
client.billing.rate_card() # current price of every operation
client.billing.current_subscription() # {} when there is no active cycle
client.billing.usage_by_feature(since="2026-10-01T00:00:00Z")
client.user.me()
client.user.recent_conversions()
client.webhooks.list()Handle errors
Every HTTP failure raises a subclass of APIStatusError carrying .status_code and the
decoded .response:
from indox_client import (
APIConnectionError,
BadRequestError,
ConversionError,
ConversionTimeoutError,
PaymentRequiredError,
RateLimitError,
ScopeError,
)
try:
job = client.images.convert("photo.png", target_format="webp")
final = client.conversion.wait(job["id"], timeout=120)
except BadRequestError as exc:
print(exc.status_code, exc.response)
except ScopeError:
print("this API key lacks the convert scope")
except PaymentRequiredError:
print("out of credits")
except RateLimitError as exc:
print("still rate limited, retry in", exc.retry_after, "s")
except ConversionTimeoutError:
print("still running past the timeout")
except ConversionError as exc:
print("job failed:", exc.conversion_id)
except APIConnectionError:
print("could not reach the API")The full exception list is in the Python SDK guide.
New in 0.6.0
Each area’s page has its own example:
| Area | First call | Page |
|---|---|---|
| Sign in, with a 2FA code | client.user.login(email=..., password=...) | Python SDK |
| E-signing with a one-time code | client.pdf.request_sign_otp(token) | E-signing |
| PDF AI (credits) | client.pdf.ai.ask("...", file_path="doc.pdf") | PDF AI |
| Blank government forms | client.pdf.forms.list(source="irs") | Blank Forms |
| AI slide decks (credits) | client.deck.projects.create(title="...") | AI Slide Decks |
| Office documents | client.office.import_file("budget.xlsx", kind="sheet") | Office Editor |
| Webhook secret rotation | client.webhooks.rotate_secret(webhook_id) | Webhooks |
| Notifications | client.notifications.unread_count() | Notifications |
| Audit log | client.audit.export("audit.csv") | Audit Log |
| Cloud drives | client.storage.contents("dropbox") | Cloud Storage |
| Any conversion’s status | client.conversion.get(conversion_id) | Conversion Status |