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

# Introduction

> Get started with the TLDP TypeScript SDK.

`@tybrite-labs/tldp-sdk` is a fully typed TypeScript client for the TLDP API. It
turns rates, orders, shipments, tracking, returns, and webhooks into typed method
calls, and handles auth, retries, and idempotency for you.

## Installation

```bash npm theme={null}
npm install @tybrite-labs/tldp-sdk
```

```bash yarn theme={null}
yarn add @tybrite-labs/tldp-sdk
```

```bash pnpm theme={null}
pnpm add @tybrite-labs/tldp-sdk
```

## Initialize the client

```typescript theme={null}
import { TLDP } from '@tybrite-labs/tldp-sdk';

const client = new TLDP({
  apiKey: 'tybrite_sk_test_YOUR_KEY',
});
```

The base URL defaults to `https://api.tybritelabs.com/logistics`. Your key's middle segment
(`test` / `live`) selects the environment — see [Authentication](https://docs.tybritelabs.com/tldp/authentication.md).

## Calling a method

Methods are grouped into services on the client (`client.orders`,
`client.rates`, …). With the SDK's options style, you pass a single object with
the path/query params and a `requestBody` where applicable.

```typescript theme={null}
const quote = await client.rates.calculateRates({
  requestBody: {
    origin: { city: 'Nairobi' },
    destination: { city: 'Mombasa' },
    weight_kg: 2.5,
  },
});
```

## Idempotency & retries

Pass an `idempotencyKey` on writes so a retried request never double-creates:

```typescript theme={null}
const order = await client.orders.createOrder({
  idempotencyKey: 'order-1042-2026-06-08',
  requestBody: { /* … */ },
});
```

The client also retries transient network and `5xx` failures automatically with
exponential backoff.

## Error handling

Failed requests throw an `ApiError` carrying the HTTP status and the API's error
body:

```typescript theme={null}
import { TLDP, ApiError } from '@tybrite-labs/tldp-sdk';

try {
  await client.orders.getOrder({ orderId: 'missing' });
} catch (err) {
  if (err instanceof ApiError) {
    console.error(err.status, err.body); // 404, { error: { code, message } }
  }
}
```

## Services

> [card] [Orders](https://docs.tybritelabs.com/tldp/sdk/api-reference/classes/OrdersService.md)
>
> Create, fulfil, and manage orders.

> [card] [Shipments](https://docs.tybritelabs.com/tldp/sdk/api-reference/classes/ShipmentsService.md)
>
> Create and manage shipments directly.

> [card] [Rates](https://docs.tybritelabs.com/tldp/sdk/api-reference/classes/RatesService.md)
>
> Quote deliveries and list zones.

> [card] [Tracking](https://docs.tybritelabs.com/tldp/sdk/api-reference/classes/TrackingService.md)
>
> Public + detailed tracking.

> [card] [Proof of Delivery](https://docs.tybritelabs.com/tldp/sdk/api-reference/classes/ProofOfDeliveryService.md)
>
> Retrieve POD for a shipment.

> [card] [Returns](https://docs.tybritelabs.com/tldp/sdk/api-reference/classes/ReturnsService.md)
>
> Returns and exchanges.

> [card] [Webhooks](https://docs.tybritelabs.com/tldp/sdk/api-reference/classes/WebhooksService.md)
>
> Manage endpoints and test events.

> [card] [System](https://docs.tybritelabs.com/tldp/sdk/api-reference/classes/SystemService.md)
>
> API info and health.


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