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

# Installation

> Install the Law4Devs Java SDK and make your first API call.

## Requirements

* Java 17 or later
* Maven 3.6+ (build tool)
* No runtime dependencies — uses Java standard library only

## Install

Add to your `pom.xml`:

```xml theme={null}
<dependency>
  <groupId>eu.law4devs.sdk</groupId>
  <artifactId>java</artifactId>
  <version>1.0.0</version>
</dependency>
```

Then run:

```bash theme={null}
mvn install
```

To pin to a specific version:

```xml theme={null}
<dependency>
  <groupId>eu.law4devs.sdk</groupId>
  <artifactId>java</artifactId>
  <version>1.0.0</version>
</dependency>
```

## First Call

```java theme={null}
import eu.law4devs.sdk.Law4DevsClient;
import eu.law4devs.sdk.models.Framework;
import eu.law4devs.sdk.pagination.Page;

Law4DevsClient client = Law4DevsClient.builder()
    .apiKey(System.getenv("LAW4DEVS_API_KEY"))
    .build();

Page<Framework> page = client.frameworks().list();
System.out.println(page.data().get(0).name()); // e.g. "Cyber Resilience Act"
```

## Configuration

```java theme={null}
import eu.law4devs.sdk.Law4DevsClient;
import java.time.Duration;

Law4DevsClient client = Law4DevsClient.builder()
    .apiKey(System.getenv("LAW4DEVS_API_KEY"))
    .baseUrl("https://api.law4devs.eu/v1") // default
    .timeout(Duration.ofSeconds(30))           // default 30s
    .maxRetries(3)                             // retries on 429/5xx, default 3
    .build();
```

| Option       | Type       | Default                  | Description                                         |
| ------------ | ---------- | ------------------------ | --------------------------------------------------- |
| `apiKey`     | `String`   | `null`                   | Your API key (required for authenticated endpoints) |
| `baseUrl`    | `String`   | Production URL           | Override for dev/staging environment                |
| `timeout`    | `Duration` | `Duration.ofSeconds(30)` | Per-request HTTP timeout                            |
| `maxRetries` | `int`      | `3`                      | Retries on 429/5xx responses                        |

## Environment Variable

```bash theme={null}
export LAW4DEVS_API_KEY="your-key"
```

```java theme={null}
Law4DevsClient client = Law4DevsClient.builder()
    .apiKey(System.getenv("LAW4DEVS_API_KEY"))
    .build();
```

<Warning>
  Never hardcode your API key in source code or commit it to version control.
</Warning>

## Verify the Install

```java theme={null}
// VerifyInstall.java
import eu.law4devs.sdk.Law4DevsClient;

public class VerifyInstall {
    public static void main(String[] args) {
        var client = Law4DevsClient.builder()
            .apiKey(System.getenv("LAW4DEVS_API_KEY"))
            .build();
        System.out.println(client.frameworks().list().meta().total() + " frameworks");
    }
}
```

```bash theme={null}
LAW4DEVS_API_KEY=your-key mvn compile exec:java -Dexec.mainClass="VerifyInstall"
# → 19 frameworks
```
