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

# Client

> Initialize and configure the Docent client

The `Docent` class is the main entry point for the SDK. All API operations are methods on this client.

## Initialization

```python theme={null}
from docent import Docent

# Minimal — reads API key from a discovered config file or environment
client = Docent()

# With explicit configuration
client = Docent(
    api_key="your-api-key",
    collection_id="my-default-collection",
)
```

## Constructor Parameters

**api\_key** `str | None`

API key for authentication. Falls back to the discovered config file
(`~/.docent/docent.env` when no project-level file is found), then the
`DOCENT_API_KEY` environment variable. See the
[configuration priority table](https://docs.transluce.org/sdk/authentication.md#configuration-priority) for
the full resolution order. Required unless one AWS authentication mode is
enabled.

**aws\_oidc\_identity** `bool` (default: False)

Authenticate with an AWS outbound OIDC token. The active IAM role and its
account-specific issuer must be connected to a Docent service account. This
is the preferred AWS workload authentication mode.

**aws\_federated\_identity** `bool` (default: False)

Authenticate with the legacy audience-bound signed STS request protocol.
Use only for an existing service-account binding without an OIDC issuer.

**aws\_profile** `str | None`

Optional named AWS profile used by either AWS authentication mode.

**aws\_region** `str | None`

Optional regional STS endpoint for AWS authentication. Outbound OIDC does
not work through the global STS endpoint.

> [!NOTE]
>
> `api_key`, `aws_oidc_identity=True`, and `aws_federated_identity=True` are
> mutually exclusive. The client raises `ValueError` if more than one is set.

**collection\_id** `str | None`

Stored as `default_collection_id` for your convenience, but SDK methods
do **not** fall back to it automatically — you must pass `collection_id`
explicitly to each method call. Falls back to `DOCENT_COLLECTION_ID` from
the config file.

**api\_url** `str | None`

Direct URL of the Docent API server. Overrides URL derived from `domain`.
Falls back to `DOCENT_API_URL` environment variable.

**frontend\_url** `str | None`

Direct URL of the Docent frontend UI. Overrides URL derived from `domain`.
Falls back to `DOCENT_FRONTEND_URL` environment variable.

**domain** `str | None` (default: docent.transluce.org)

Domain of the Docent instance. API and frontend URLs are derived as
`https://api.{domain}` and `https://{domain}` unless overridden.

**use\_https** `bool` (default: True)

Whether to use HTTPS when constructing URLs from the domain.

**config\_file** `str | Path | None`

Explicit path to a dotenv config file. If not provided, the SDK searches for
project-level `docent.env` overrides from the current directory upward, then
checks the default global config file at `~/.docent/docent.env`.

**log\_stream** `IO[str] | None`

Output stream for SDK log messages. Defaults to `sys.stdout`.

## Properties

**frontend\_url** `str`

The resolved Docent frontend base URL.

**backend\_url** `str`

The resolved Docent API base URL.

**default\_collection\_id** `str | None`

The default collection ID, if configured.

## Example: Full Configuration

```python theme={null}
from docent import Docent

client = Docent(
    api_key="your-api-key",
    collection_id="my-collection",
    api_url="https://api.my-docent.example.com",
    frontend_url="https://my-docent.example.com",
)

print(client.frontend_url)  # https://my-docent.example.com
print(client.backend_url)   # https://api.my-docent.example.com/rest
```

See [Authentication](https://docs.transluce.org/sdk/authentication.md) for AWS workload examples and
deployment prerequisites.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.