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

# Use the TypeScript SDK

> Install the Leadping TypeScript SDK, supply a Kiota request adapter, and call typed API routes.

* Package: [`@leadping/sdk`](https://www.npmjs.com/package/@leadping/sdk)
* Repository: [`leadpingai/leadping-typescript`](https://github.com/leadpingai/leadping-typescript)

## Install

```bash theme={null}
npm install @leadping/sdk @microsoft/kiota-http-fetchlibrary
```

## Create the client

```ts theme={null}
import { createLeadpingOpenApiClient } from "@leadping/sdk";
import { ApiKeyAuthenticationProvider, ApiKeyLocation } from "@microsoft/kiota-abstractions";
import { FetchRequestAdapter } from "@microsoft/kiota-http-fetchlibrary";

const credential = process.env.LEADPING_API_KEY;
if (!credential) throw new Error("LEADPING_API_KEY is not set.");

const authProvider = new ApiKeyAuthenticationProvider(
  `Bearer ${credential}`,
  "Authorization",
  ApiKeyLocation.Header,
  new Set(["api.leadping.ai"]),
);
const client = createLeadpingOpenApiClient(new FetchRequestAdapter(authProvider));
const lead = await client.leads.byId("lead-id").get();
```

The client defaults to `https://api.leadping.ai`. Set `LEADPING_API_KEY` to an organization API key. `client.users.me` requires a user access token; source keys are only for lead intake.

The SDK does not store or refresh credentials. See [API Authentication](/docs/api-authentication).

## Call routes

```ts theme={null}
const source = await client.sources.byId("source-id").get();
const lead = await client.leads.byId("lead-id").get();
// Requires a user access token.
const currentUser = await client.users.me.get();
```

Use generated request-body and model types from `@leadping/sdk` when creating or updating records. Confirm endpoint contracts in the [API Reference](/docs/api-reference), and handle `429` responses using the [rate-limit guide](/docs/rate-limits).
