---
title: "Java"
description: "Java client for the Wildberries Seller API: io.github.valeryverkhoturov:wb-api-client on Maven Central, 13 API categories, redacted token."
lang: en-US
source: https://valeryverkhoturov.github.io/wb-api-client-docs/en/languages/java
---

# Java

Coordinates: `io.github.valeryverkhoturov:wb-api-client` on [Maven Central](https://central.sonatype.com/artifact/io.github.valeryverkhoturov/wb-api-client).

- **Java:** 8+ (compiled with `-source 1.8 -target 1.8`)
- **HTTP:** OkHttp 4
- **JSON:** Gson + gson-fire
- **Secret wrapper:** per-sub-module `SecretString`

## Install

**Maven**

```xml
<dependency>
  <groupId>io.github.valeryverkhoturov</groupId>
  <artifactId>wb-api-client</artifactId>
  <version>LATEST</version>
</dependency>
```

**Gradle (Kotlin)**

```kts
dependencies {
    implementation("io.github.valeryverkhoturov:wb-api-client:LATEST")
}
```

**Gradle (Groovy)**

```groovy
dependencies {
    implementation 'io.github.valeryverkhoturov:wb-api-client:LATEST'
}
```

**sbt**

```scala
libraryDependencies += "io.github.valeryverkhoturov" % "wb-api-client" % "LATEST"
```

Replace `LATEST` with the current `1.YYYYMMDD.N` version from [releases](https://github.com/ValeryVerkhoturov/wb-api-client/releases).

## Package layout

Base package: `io.github.valeryverkhoturov.wbapi`. Each WB category lives in a sub-package with its own `ApiClient`, models, and `api` classes.

```java
import io.github.valeryverkhoturov.wbapi.items.ApiClient;
import io.github.valeryverkhoturov.wbapi.items.api.ItemsApi;
```

## Sub-packages

`general`, `items`, `orders_fbs`, `orders_dbw`, `dbs`, `in_store_pickup`, `orders_fbw`, `promotion`, `communications`, `rates`, `analytics`, `reports`, `finances`.

Full per-module API class listing: [clients/java/README.md](https://github.com/ValeryVerkhoturov/wb-api-client/blob/main/clients/java/README.md).

## Auth

```java
import io.github.valeryverkhoturov.wbapi.items.ApiClient;
import io.github.valeryverkhoturov.wbapi.items.api.ItemsApi;

ApiClient client = new ApiClient();
client.setAccessToken("<your WB JWT>");

ItemsApi api = new ItemsApi(client);
```

`setAccessToken` takes a plain `String` and wraps it in the sub-module's `SecretString` internally — the token redacts under logging and debug dumps from that point on.

## One `SecretString` per sub-package — why?

The wrapper is generated into each sub-package rather than shared across the whole library because openapi-generator emits fully isolated SDKs per spec — there is no shared "core" module. Consolidating would require an additional generator pass with cross-module coupling. The cost is a class per sub-package; the benefit is the client remains a pure openapi-generator output with only surgical patches.

Practically you never touch them: `setAccessToken` wraps your plain string in the sub-module's own `SecretString` — `io.github.valeryverkhoturov.wbapi.items.SecretString` vs `.orders_fbs.SecretString` — automatically.

## Custom OkHttp client

Wire your own instance for proxying, interceptors, or custom timeouts:

```java
import okhttp3.OkHttpClient;
import java.time.Duration;

OkHttpClient http = new OkHttpClient.Builder()
    .connectTimeout(Duration.ofSeconds(5))
    .readTimeout(Duration.ofSeconds(120))
    .build();

ApiClient client = new ApiClient(http);
client.setAccessToken(TOKEN);
```

## Java 8 vs newer

The generator emits Java-8-compatible code with `threetenbp` for date/time. If you're on Java 11+, this still works — no need to add a "modern" dependency. If you'd rather use `java.time` directly, the models expose the underlying string values via `set*ToString` / `get*ToString` methods where applicable.

## Testing

Override the base path:

```java
ApiClient client = new ApiClient();
client.setBasePath("http://localhost:8080");
```

## See also

- [Authentication guide](https://valeryverkhoturov.github.io/wb-api-client-docs/en/guides/authentication)
- [Error handling](https://valeryverkhoturov.github.io/wb-api-client-docs/en/guides/error-handling)
- [Full per-module reference on GitHub](https://github.com/ValeryVerkhoturov/wb-api-client/blob/main/clients/java/README.md)

<p align="center">
  <img src="/pics/blueberry-java-animated.webp" style="height: 200px; width: auto; max-width: 100%; object-fit: contain" alt="wb-api-client mascot">
</p>
