Skip to Content
SDKsPython SDK (indox-client)

Python SDK

Package: indox-client, published on PyPI. Requires Python 3.9 or newer and requests 2.28 or newer.

Notebooks: runnable examples for every part of the SDK, to read here or download.

Install

pip install --upgrade indox-client

Set up a client

Create an API key under Dashboard → API keys. It is shown once and starts with indox_. The client reads it from INDOX_API_KEY, or takes it as api_key:

from indox_client import Indox with Indox() as client: # reads INDOX_API_KEY print(client.health.get()) with Indox(api_key="indox_...") as client: ...

The base URL defaults to https://indox.org. Point it at your own instance with Indox(base_url="https://api.example.com") or INDOX_BASE_URL. The context manager closes the HTTP session when the block ends.

Convert a file

Conversions are asynchronous: submit, wait, download. client.conversion.wait follows a conversion from any converter:

with Indox() as client: job = client.images.convert("photo.png", target_format="webp") client.conversion.wait(job["id"], timeout=120) client.media.download(job["id"], "photo.webp")

Fonts have a one-call helper that does all three steps:

with Indox() as client: client.fonts.convert_and_download( "MyFont.ttf", target_format="woff2", output_path="MyFont.woff2" )

More worked examples are in SDK Examples.

Resources

AttributeCoversReference
client.healthService health
client.images · client.videos · client.modelsMedia conversionMedia Conversion
client.mediaMedia job status, downloads, batches, creditsMedia Conversion
client.conversionget, wait and delete for any conversion idConversion Status
client.pdfDocument conversion, retry, keep policy, save to files, email, form fields, pipelines, phone scan, e-signingDocument Conversion, E-signing
client.pdf.formsPublic blank forms: list, fields, blank download URL, fillBlank Forms
client.pdf.aiAsk, fill, detect fields, suggest comments, check numbers, classify, edit (credits)PDF AI
client.docsDocument job status, batches, credits
client.fontsFormats, quota, upload, convert (with optional subsetting), validate, inspect, downloadFont Conversion
client.deckAI slide decks (credits)AI Slide Decks
client.officeOffice documents, import and export jobs (credits)Office Editor
client.webhooksCreate, list, update, delete, deliveries, test, rotate secretWebhooks
client.userSign-in and 2FA, profile, avatar, branding, integrations, preferences, storage files, usage, share linksAuth
client.notificationsIn-app notifications and email settingsNotifications
client.storageConnected Box, Dropbox, Google Drive and OneDriveCloud Storage
client.auditYour audit log, as a list or CSVAudit Log
client.billingCredit balance, thresholds, rate card, subscription, usage by feature, plans, purchasesBilling

Sign in for account operations

API keys cannot manage the account. These methods need a sign-in access token, passed per call as access_token=: user.update_me, user.change_email, user.create_share, user.delete_share, billing.purchase_initiate, billing.purchase_pay_as_you_go and billing.storage_initiate.

from indox_client import Indox, MfaRequired with Indox() as client: try: session = client.user.login(email="[email protected]", password="...") except MfaRequired as challenge: session = client.user.complete_2fa(challenge.mfa_token, input("2FA code: ")) token = session["external_token"] client.user.update_me(first_name="Ada", access_token=token)

client.user.refresh(refresh_token) rotates the access token, and client.user.logout() signs out. The REST side of this flow is in Auth.

Errors, retries and timeouts

Failures raise typed exceptions, all importable from indox_client and all subclasses of IndoxError. Errors that carry an HTTP response expose status_code and the parsed response:

ExceptionWhen
BadRequestError400, and 422 validation errors
AuthenticationError401; its subclass MfaRequired (with mfa_token) when login needs a 2FA code
PaymentRequiredError402, not enough credits
PermissionDeniedError403; its subclass ScopeError when the API key lacks the scope
NotFoundError404, including ids you do not own
GoneError410, an expired output or signing link
RateLimitError429 after the retries ran out; retry_after holds the server hint in seconds
InternalServerError5xx
APIStatusErrorAny other status, for example 409

APIConnectionError (the request never reached the API), ConversionError (a job failed server-side) and ConversionTimeoutError (a wait ran past its timeout) have no HTTP status. Catch IndoxError to cover everything.

from indox_client import Indox, BadRequestError with Indox() as client: try: client.images.convert("photo.png", target_format="nope") except BadRequestError as exc: print(exc.status_code, exc.message, exc.response)

The retry policy is the same in every SDK, see Retries and rate limits. Tune it per client; the defaults are the module constants DEFAULT_MAX_RETRIES, DEFAULT_MAX_RETRY_WAIT and DEFAULT_RETRY_BACKOFF, and max_retries=0 turns retrying off:

Indox(max_retries=5, max_retry_wait=30.0, retry_backoff=1.0)

Requests use a 5 s connect and 60 s read timeout by default. Change it with Indox(timeout=(5.0, 120.0)).

Upgrading from 0.5

The API changes every client inherits are listed in Upgrading from 0.5. In Python:

  • user.update_me(...) takes username, first_name and last_name. The email address moved to user.change_email(email, current_password=...).
  • user.upload_file(path, related_task_id=None): s3_key and storage_already_tracked are gone.
  • images, videos and models .convert: passing user_id in data raises ValueError.
  • pdf.submit_sign(token, otp) signs with the emailed code; call pdf.request_sign_otp(token) first.
  • pdf.create_signing_session(path, emails=[...], title=None) uploads the PDF as multipart.
  • docs.batch_collect(ids) and docs.hide(ids) take a list of UUIDs.
  • billing.task_completion: the server ignores credit_cost and the output_* fields; send task_type.
  • fonts.health() and fonts.quota() return the new shapes (engines, storage, max_upload_mb, …).
  • Waits return a partial conversion (some formats succeeded) instead of timing out.