Metadata-Version: 2.4
Name: clment-sdk
Version: 0.1.0
Summary: Official client for the Clment contract-intelligence API — upload contracts, run AI reviews against your rulebooks, and generate tracked-changes redlines.
Home-page: https://clment.com/developers
Author: Contract Eagle Limited
Author-email: Contract Eagle Limited <info@clment.com>
License-Expression: MIT
Project-URL: Homepage, https://clment.com/developers
Project-URL: Documentation, https://clment.com/help/api-authentication
Project-URL: Bug Reports, https://clment.com/contact
Keywords: clment,contract,contract-review,contract-intelligence,legal,redline,api,sdk
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Office/Business
Classifier: Typing :: Typed
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: urllib3<3.0.0,>=2.7.0
Requires-Dist: python-dateutil>=2.8.2
Requires-Dist: pydantic>=2.11
Requires-Dist: typing-extensions>=4.7.1
Dynamic: author
Dynamic: home-page

# Clment Python SDK

Official client for the [Clment](https://clment.com) contract-intelligence API.
Generated from the published [OpenAPI document](https://clment.com/help/api/openapi.yaml),
so it cannot drift from the API it calls.

```bash
pip install clment-sdk
```

## Get the region right

Your contracts **and** your API keys live in exactly one region, and **a
valid key sent to the wrong region fails exactly like an invalid one** —
a 401 that sends people hunting for a new key when the host was the
problem. Set the base URL for your own region:

| Region | Base URL |
| --- | --- |
| United States | `https://api-us.clment.com/v1` |
| European Union | `https://api-eu.clment.com/v1` |
| United Kingdom | `https://api-uk.clment.com/v1` |
| Australia | `https://api-au.clment.com/v1` |
| New Zealand | `https://api-nz.clment.com/v1` |
| Canada | `https://api-ca.clment.com/v1` |

Your region is shown in **Settings → API & Integrations**.

## First call

```python
import os
import clment_sdk
from clment_sdk.api.contracts_api import ContractsApi

configuration = clment_sdk.Configuration(
    # Your organisation's region: us | eu | uk | au | nz | ca
    host="https://api-nz.clment.com/v1",
)
configuration.access_token = os.environ["CLMENT_API_KEY"]

with clment_sdk.ApiClient(configuration) as client:
    page = ContractsApi(client).list_contracts(status="active", take=20)
    print(f"{len(page.data.contracts)} of {page.data.total} active contracts")
```

## Things worth knowing

- **Long-running work returns a job id.** Uploads, reviews and redlines
  run in the background: call the start operation, then poll the matching
  job operation until it reports `complete`. A review runs for minutes;
  the start response carries an advisory `estimateSeconds`.
- **Uploads are not idempotent.** The same file twice creates two
  contracts. Keep a record of what you have sent.
- **AI operations consume credits**; reads are free. Check
  `GetUsage` / `get_usage` before a batch rather than discovering
  exhaustion as a 402 halfway through one.
- **Rate limits** arrive as 429 with `Retry-After`. Retry 429, 5xx and
  connection failures; a 401, 403 or 404 will not fix itself.
- **This client already retries 429 for you — three times, sleeping for
  whatever `Retry-After` says.** That is urllib3's default, inherited by
  every generated Python client, and it happens before the exception
  reaches your code: a `Retry-After: 300` blocks your thread for fifteen
  minutes with no output. If your service needs to react to a 429 itself
  — shed load, switch queue, raise an alert — turn it off and handle the
  status yourself:

  ```python
  configuration.retries = 0
  ```

  The TypeScript SDK does the opposite: it raises immediately and hands
  you the delay to act on.

- **Comparing two versions is a review** with `scope: two_version`,
  not a separate endpoint.
- **A few field names are escaped by the generator.** Where a name would
  collide with something in the target language it is renamed rather
  than dropped — a key date's `date` arrives as `var_date`. If an attribute you expect is missing, look for a `var_` prefix.

## Documentation

- [Developer hub](https://clment.com/developers)
- [API reference](https://clment.com/help/api)
- [Authentication](https://clment.com/help/api-authentication)
- [Workflow examples](https://clment.com/help/api-workflows)

Building in TypeScript or JavaScript? Use
[`@clment/sdk`](https://clment.com/help/sdk-typescript) instead — it is
hand-written over generated types and has a friendlier surface.

## Licence

MIT © Contract Eagle Limited, trading as Clment.
