> ## 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.

# Quickstart

> Install the SDK and make your first authenticated request

This tutorial installs `@thelomadee/sdk` from the public npm registry and verifies your `authKey` with a read-only call to `sdk.terms.latest()`.

<Note>
  Your `authKey` is provided during Lomadee partner onboarding. If you do not have it yet, contact your Lomadee integration contact before continuing.
</Note>

## Before you begin

* A **server-side** TypeScript or JavaScript project with **ESM** enabled (`"type": "module"` in `package.json`, or `"module": "NodeNext"` in `tsconfig.json`)
* Your partner **`authKey`**, stored as `LOMADEE_AUTH_KEY` (or equivalent) in your environment

## Step 1 — Install the SDK

<CodeGroup>
  ```bash npm theme={null}
  npm install @thelomadee/sdk
  ```

  ```bash yarn theme={null}
  yarn add @thelomadee/sdk
  ```
</CodeGroup>

The package is public on [npm](https://www.npmjs.com/package/@thelomadee/sdk). No `.npmrc` or GitHub token is required.

## Step 2 — Create a client

Create a small script (for example `check-sdk.ts`) in your backend project:

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

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

const term = await sdk.terms.latest();

console.log('Latest terms version:', term.version);
console.log('Terms document URL:', term.fileUrl);
```

`environment` is optional and defaults to `'production'` when omitted. Use the `environment` and credentials provided during your Lomadee onboarding.

<Warning>
  Run this script on the server or in a local backend context where `LOMADEE_AUTH_KEY` is set. Do not expose the key to client-side code or logs.
</Warning>

## Step 3 — Run the script

Execute with your preferred TypeScript runner, for example:

```bash theme={null}
npx tsx check-sdk.ts
```

If authentication and network access are configured correctly, the script prints the latest terms **version** and **file URL**. That confirms your `authKey` works end-to-end through the SDK.

## What to explore next

You now have a working `Lomadee` instance. From here:

* Read [How the SDK works](/docs/sdk/concepts/how-the-sdk-works) to understand resource clients and shared configuration
* Browse the [API reference](/docs/sdk/reference/client) for `transactions`, `commissions`, `affiliates`, `contents`, and `terms`
* Follow [Environments and secrets](/docs/sdk/guides/environments-and-secrets) for staging setups and production hardening
* Review [Error handling](/docs/sdk/guides/error-handling) before adding retries or user-facing error messages

For public affiliate network endpoints (brands, campaigns, channels), continue to the [Affiliate API](/api-reference/introduction)—that product uses **`x-api-key`**, not the SDK's partner `authKey`.
