> ## Documentation Index
> Fetch the complete documentation index at: https://platform-docs.sarj.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Python SDK

> Install and use the typed synchronous and asynchronous Sarj.ai Developer API client.

The `sarj-platform-sdk` package is generated from the same OpenAPI contract as this reference and supports Python 3.10 or newer.

## Install

<CodeGroup>
  ```bash pip theme={null}
  pip install sarj-platform-sdk
  ```

  ```bash uv theme={null}
  uv add sarj-platform-sdk
  ```
</CodeGroup>

## Create a client

```python theme={null}
import os

from sarj_platform_sdk import SDK

sdk = SDK(api_key_auth=os.environ["SARJ_API_KEY"])
```

Keep API keys in environment variables or a secret manager; never embed them in source code.

## Create and inspect a call

```python theme={null}
created = sdk.calls.create_call(
    phone_number="+966512345678",
    scenario_id="scn_abc123",
    language="ar",
)

call = sdk.calls.get_call(call_id=created.data.id)
print(call.data.status)
```

The SDK also exposes async variants for every operation:

```python theme={null}
created = await sdk.calls.create_call_async(
    phone_number="+966512345678",
    scenario_id="scn_abc123",
    language="ar",
)
```

## Errors, timeouts, and retries

Non-success responses raise typed SDK errors when the API documents their response shape. Read `exception.data.error.type` and retain `exception.data.meta.request_id` for support.

Pass `timeout_ms` to a generated method for an application-specific deadline. Retries are disabled unless you explicitly pass a retry configuration to the method or SDK; take extra care before enabling them for write operations.

## Resources

* [API reference](/api-reference/overview)
* [PyPI package](https://pypi.org/project/sarj-platform-sdk/)
* [Source repository](https://github.com/sarj-ai/platform/tree/main/libraries/python/platform-sdk)
