Skip to main content
The Python SDK (omnicommerce) is generated from the same public OpenAPI spec as the TypeScript SDK. Every documented REST operation is a resource method. Responses are parsed JSON: objects are dicts, arrays are lists, and an empty body is None.

Install

Install the SDK from PyPI:
Requires Python 3.10+.

Authenticate

Use an organization API key (omni_sk_...) as a bearer token. Do not send organization_id on API-key requests.
Omit api_key to read OMNI_API_KEY. Override the host with base_url or environment (https://omnicommerce.sg by default). OmniEnvironment.LOCAL is http://localhost:3000. See Authentication.
Use the client as a context manager so the HTTP connection closes. AsyncOmni is the async client and uses async with.

Resource clients

Each call takes keyword arguments. Path, query, and JSON fields keep their wire names in snake_case: productId is product_id, minPrice is min_price.
Per-request overrides:
client.with_raw_response.orders.get(...) returns data, status_code, headers, and url.

Product inventory

Response keys keep their API casing even though method arguments use snake_case. Read page["items"] and each row’s stockQuantity, hasVariants, and variantCount.
stockQuantity is catalog stock, matching the Products page. Parent rows already aggregate their variants; virtual bundles already account for component stock and any manual cap. Preserve null or missing values as unknown. Do not read inventoryQuantity, inventory.quantity, or stock_quantity, and do not sum a missing variants array. See Product inventory for quantity semantics.

Coverage

Looks, returns, settlements, marketplaces, search, evaluate, monitor, sync, Zalora, and the remaining documented tags follow the same pattern.

Errors

Non-2xx responses raise OmniError subclasses. See SDK errors. GET, HEAD, OPTIONS, PUT, and DELETE retry on 5xx and network failures. 408 and 429 retry for every method. POST and PATCH are not retried on 5xx.

Webhooks

HMAC-SHA256 over {timestamp}.{raw_body} compared to X-Omni-Signature. See Webhooks.

Regenerate

From this repository: