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

# Client

> Lomadee class, SdkParams, and shared configuration types

The root export of `@thelomadee/sdk`. Instantiate `Lomadee` once per server process (or scoped factory) and access resource clients through its properties.

```typescript theme={null}
import { Lomadee } from '@thelomadee/sdk';
import type { SdkParams, Environment, SdkResponse } from '@thelomadee/sdk';

const sdk = new Lomadee({
  authKey: process.env.LOMADEE_AUTH_KEY!,
  environment: 'production',
});
```

Domain data types (`CreateOrderBody`, `CommissionData`, `TermData`, enums, etc.) are imported from `@thelomadee/sdk/domains`, not from the root package.

## Constructor

```typescript theme={null}
new Lomadee(config: SdkParams): Lomadee
```

Creates a client that shares one authenticated HTTP session (10 second timeout) across all resource properties. Authentication uses the partner `authKey` as the `x-auth-key` header on every request.

### `SdkParams`

<ParamField body="authKey" type="string" required>
  Partner credential provided during onboarding. Required.
</ParamField>

<ParamField body="environment" type="Environment">
  Target deployment. Union: `'staging' | 'production'`. Optional; defaults to `'production'` when omitted.
</ParamField>

## Properties

| Property       | Type          | Reference                                        |
| -------------- | ------------- | ------------------------------------------------ |
| `transactions` | `Transaction` | [Transactions](/docs/sdk/reference/transactions) |
| `commissions`  | `Commission`  | [Commissions](/docs/sdk/reference/commissions)   |
| `affiliates`   | `Affiliate`   | [Affiliates](/docs/sdk/reference/affiliates)     |
| `contents`     | `Content`     | [Contents](/docs/sdk/reference/contents)         |
| `terms`        | `Term`        | [Terms](/docs/sdk/reference/terms)               |

### `terms.acceptances`

Nested on `terms`, type `TermAcceptance`. Exposes `create` and `list` for term acceptance records. See [Terms — acceptances](/docs/sdk/reference/terms#acceptances).

<Note>
  Resource return types are defined per client. For example, `transactions` methods return `Promise<unknown>`; `commissions.list` returns `CommissionListResponse`; `affiliates.list` returns `AffiliateListResponse`; other methods may use `SdkResponse<T>` or concrete domain types. See each resource reference page.
</Note>

## Root exports

| Export           | Kind  | Description                                          |
| ---------------- | ----- | ---------------------------------------------------- |
| `Lomadee`        | class | Root client                                          |
| `SdkParams`      | type  | Constructor configuration                            |
| `Environment`    | type  | `'staging' \| 'production'`                          |
| `SdkResponse<T>` | type  | Response envelope `{ data: T }` used by some clients |

Advanced resource **implementation** classes are available through dedicated subpaths. Prefer the root client; use these imports only when you intentionally construct a resource class outside `Lomadee`:

| Root property  | Advanced import                       | Class                    |
| -------------- | ------------------------------------- | ------------------------ |
| `transactions` | `@thelomadee/sdk/domains/orders`      | `Transaction`            |
| `commissions`  | `@thelomadee/sdk/domains/commissions` | `Commission`             |
| `affiliates`   | `@thelomadee/sdk/domains/affiliates`  | `Affiliate`              |
| `contents`     | `@thelomadee/sdk/domains/contents`    | `Content`                |
| `terms`        | `@thelomadee/sdk/domains/terms`       | `Term`, `TermAcceptance` |

The recommended entry point remains `new Lomadee(...)` on `@thelomadee/sdk`.

## Example

```typescript theme={null}
import { Lomadee } from '@thelomadee/sdk';

const sdk = new Lomadee({
  authKey: process.env.LOMADEE_AUTH_KEY!,
});

const term = await sdk.terms.latest();
console.log(term.version);
```

## Related

* [Quickstart](/docs/sdk/quickstart)
* [Environments and secrets](/docs/sdk/guides/environments-and-secrets)
* [How the SDK works](/docs/sdk/concepts/how-the-sdk-works)
