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

# Configure the Java Client

> Configure the Repost Java client: credential precedence, timeouts, retries, in-flight budgets, and proxy, TLS, and mTLS transport options.

`RepostClient.create()` reads the environment. To configure explicitly, build `ClientOptions` and pass it to `create(ClientOptions)`:

```java theme={"languages":{"custom":["/languages/repost.json"]}}
ClientOptions options = ClientOptions.builder()
        .apiKey(System.getenv("REPOST_SEND_API_KEY"))
        .baseUri("https://api.repost.sh")
        .operationTimeout(Duration.ofSeconds(30))
        .maxAttempts(4)
        .maxInFlightOperations(128)
        .build();
return RepostClient.create(options);
```

## Credential and endpoint precedence

**Credential precedence**, highest first: a `.apiKeyProvider(...)` (resolved per send) → a fixed `.apiKey(...)` → the `REPOST_SEND_API_KEY` environment variable → the `REPOST_TOKEN` environment variable. With none set, the first send fails with a `CONFIGURATION` error and never touches the network. **Base URI**: an explicit `.baseUri(...)` → `REPOST_API_URL` → the default `https://api.repost.sh`. Plain `http://` is accepted only for loopback hosts.

## Defaults

The defaults are production-ready:

| Option                             | Default     | Notes                                                                                     |
| ---------------------------------- | ----------- | ----------------------------------------------------------------------------------------- |
| `connectTimeout`                   | 10s         | Connection establishment.                                                                 |
| `attemptTimeout`                   | 30s         | One HTTP attempt.                                                                         |
| `operationTimeout`                 | 120s        | Whole operation, including retries — the one deadline that bounds a send.                 |
| `maxAttempts`                      | 4           | 1–10. Transport attempts before giving up.                                                |
| `retryBaseDelay` / `retryMaxDelay` | 250ms / 60s | Exponential backoff with jitter.                                                          |
| `maxInFlightOperations`            | 256         | 1–65536. Bounded admission — see [Reliability](/docs/send/java/reliability#bounded-admission). |
| `maxBufferedBytes`                 | 64 MiB      | 4 MiB–1 GiB. Aggregate request/response byte budget.                                      |

`ClientOptions.toString()` is redacted — it never prints your credential.

## Proxy, TLS, and mTLS

Build `HttpTransportOptions` and pass it via `.httpTransportOptions(...)`: an explicit `HttpProxyOptions` (with an optional credentials provider), a borrowed `SSLContext` for a custom truststore or mutual TLS, and an allowlisted TLS protocol (TLS 1.2/1.3) and cipher list. HTTP redirects are disabled.

## Continue

<Columns cols={3} className="gap-y-4">
  <Card title="Reliability" icon="shield-check" href="/docs/send/java/reliability" cta="Outcomes" arrow="true">
    Idempotency, the five delivery states, cancellation, and backpressure.
  </Card>

  <Card title="Observability" icon="activity" href="/docs/send/java/observability" cta="Observe" arrow="true">
    Diagnostics, lifecycle observers, Micrometer, and OpenTelemetry.
  </Card>

  <Card title="Frameworks" icon="boxes" href="/docs/send/java/frameworks" cta="Inject" arrow="true">
    Spring Boot properties, Jakarta CDI config, and container lifecycle.
  </Card>
</Columns>
