> ## 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 Java SDK

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

* Package: `ai.leadping:leadping`
* Repository: [`leadpingai/leadping-java`](https://github.com/leadpingai/leadping-java)

## Install

With Gradle:

```gradle theme={null}
implementation "ai.leadping:leadping:<version>"
implementation "com.microsoft.kiota:microsoft-kiota-bundle:1.9.3"
```

With Maven:

```xml theme={null}
<dependency>
  <groupId>ai.leadping</groupId>
  <artifactId>leadping</artifactId>
  <version>VERSION</version>
</dependency>
```

## Create the client

```java theme={null}
import ai.leadping.openapi.LeadpingOpenApiClient;
import com.microsoft.kiota.authentication.ApiKeyAuthenticationProvider;
import com.microsoft.kiota.authentication.ApiKeyLocation;
import com.microsoft.kiota.http.OkHttpRequestAdapter;

String credential = System.getenv("LEADPING_API_KEY");
if (credential == null || credential.isBlank()) {
    throw new IllegalStateException("LEADPING_API_KEY is not set.");
}

var authProvider = new ApiKeyAuthenticationProvider(
        "Bearer " + credential,
        "Authorization",
        ApiKeyLocation.HEADER,
        "api.leadping.ai");
var client = new LeadpingOpenApiClient(new OkHttpRequestAdapter(authProvider));
var lead = 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.

## Call routes

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

The SDK does not store credentials. Use generated request-body classes when creating or updating records, confirm contracts in the [API Reference](/docs/api-reference), and follow the [rate-limit guide](/docs/rate-limits).
